SAP MDG · UTILITIES
How do I build a change request replication status timeline from DRF and IDoc history in SAP MDG?
Use a small reusable ABAP reader class to fetch `DRFD_OBJ_REP_STA` rows for the change request, then enrich them with `EDIDS` status text and `EDIDC` receiver data, and finally sort the result by replication date/time descending.
Use a small reusable ABAP reader class to fetch `DRFD_OBJ_REP_STA` rows for the change request, then enrich them with `EDIDS` status text and `EDIDC` receiver data, and finally sort the result by replication date/time descending.
Use a reusable reader class to collect DRF replication entries for one change request, enrich them with IDoc status details, and return a clean timeline for display in a dashboard or audit view. The documented pattern reads `DRFD_OBJ_REP_STA` first, then fetches matching `EDIDS` and `EDIDC` records, builds the text from `STATXT`, and sorts the final list by date/time descending.
Process flow
- Select DRF replication status rows from `DRFD_OBJ_REP_STA` for the requested change request.
- Filter to the relevant business object values used in the scenario (`'159'` and `'266'` in the source pattern).
- Collect the IDoc numbers from `MSG_LINK` into an internal table.
- Read matching IDoc status lines from `EDIDS` using `FOR ALL ENTRIES`.
- Read matching control records from `EDIDC` to get the receiver/target system.
- Build one output row per status line and enrich it with change request, object ID, run ID, target, and resolved status text.
- Split `LAST_REPLICATION` into date and time fields.
- Sort the final result by date and time descending.
Referenced tables
| Object | Purpose |
|---|---|
DRFD_OBJ_REP_STA | Stores DRF replication status entries, including change request, object ID, run ID, message link, and last replication timestamp. |
EDIDS | Contains IDoc status records used to derive status code and status text. |
EDIDC | Contains IDoc control records used to read receiver/partner information. |
ILLUSTRATIVE ABAP SAMPLE
Reusable DRF/IDoc replication history reader
Source-supported example adapted from the documented reader pattern. Replace the business object filter only if your scenario requires different DRF objects.
1CLASS zcl_cr_replication_reader DEFINITION PUBLIC FINAL CREATE PUBLIC.
2 PUBLIC SECTION.
3 TYPES: BEGIN OF ty_rep_details,
4 status TYPE char1,
5 change_request TYPE usmd_crequest,
6 object_id TYPE drfd_obj_rep_sta-object_id,
7 idoc_number TYPE edidc-docnum,
8 date TYPE sy-datum,
9 time TYPE sy-uzeit,
10 status_text TYPE string,
11 run_id TYPE drf_run_id,
12 target TYPE rcvprn,
13 END OF ty_rep_details.
14 TYPES tt_rep_details TYPE TABLE OF ty_rep_details.
15
16 CLASS-METHODS fetch_rep_details
17 IMPORTING iv_cr TYPE usmd_crequest
18 EXPORTING et_rep_details TYPE tt_rep_details.
19ENDCLASS.
20
21CLASS zcl_cr_replication_reader IMPLEMENTATION.
22 METHOD fetch_rep_details.
23 DATA: lt_idocs TYPE STANDARD TABLE OF edidc-docnum,
24 ls_rep_details TYPE ty_rep_details.
25
26 SELECT * INTO TABLE @DATA(lt_rep_data)
27 FROM drfd_obj_rep_sta
28 WHERE change_request = @iv_cr
29 AND ( business_object = '159' OR business_object = '266' ).
30
31 LOOP AT lt_rep_data INTO DATA(ls_rep).
32 APPEND ls_rep-msg_link TO lt_idocs.
33 ENDLOOP.
34
35 CHECK lt_idocs IS NOT INITIAL.
36
37 SELECT * FROM edids INTO TABLE @DATA(lt_edids)
38 FOR ALL ENTRIES IN @lt_idocs
39 WHERE docnum = @lt_idocs-table_line.
40
41 SELECT * FROM edidc INTO TABLE @DATA(lt_edidc)
42 FOR ALL ENTRIES IN @lt_idocs
43 WHERE docnum = @lt_idocs-table_line.
44
45 LOOP AT lt_rep_data INTO DATA(ls_rep_data).
46 LOOP AT lt_edids INTO DATA(ls_edids)
47 WHERE docnum = ls_rep_data-msg_link.
48
49 IF ls_edids-statxt IS INITIAL.
50 CONTINUE.
51 ENDIF.
52
53 ls_rep_details-change_request = ls_rep_data-change_request.
54 ls_rep_details-idoc_number = ls_rep_data-msg_link.
55 ls_rep_details-object_id = ls_rep_data-object_id.
56 ls_rep_details-run_id = ls_rep_data-run_id.
57
58 READ TABLE lt_edidc INTO DATA(ls_edidc)
59 WITH KEY docnum = ls_rep_data-msg_link.
60 IF sy-subrc = 0.
61 ls_rep_details-target = ls_edidc-rcvprn.
62 ENDIF.
63
64 ls_rep_details-status = ls_edids-status.
65
66 REPLACE FIRST OCCURRENCE OF '&' IN ls_edids-statxt WITH ls_edids-stapa1.
67 REPLACE FIRST OCCURRENCE OF '&' IN ls_edids-statxt WITH ls_edids-stapa2.
68 REPLACE FIRST OCCURRENCE OF '&' IN ls_edids-statxt WITH ls_edids-stapa3.
69 REPLACE FIRST OCCURRENCE OF '&' IN ls_edids-statxt WITH ls_edids-stapa4.
70 ls_rep_details-status_text = ls_edids-statxt.
71
72 DATA(lv_datetime) = ls_rep_data-last_replication.
73 ls_rep_details-date = lv_datetime+0(8).
74 ls_rep_details-time = lv_datetime+8(6).
75
76 APPEND ls_rep_details TO et_rep_details.
77 CLEAR ls_rep_details.
78 ENDLOOP.
79 ENDLOOP.
80
81 SORT et_rep_details BY date DESCENDING time DESCENDING.
82 ENDMETHOD.
83ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I read replication status details for a change request from DRF and IDoc tables?
- Which tables and ABAP logic are used to show replication history for an MDG change request?
- How do I create a reusable ABAP reader for DRF and IDoc replication status?
Possible questions
- How do I build a change request replication status timeline from DRF and IDoc history in SAP MDG?
- How can I read replication status details for a change request from DRF and IDoc tables?
- Which tables and ABAP logic are used to show replication history for an MDG change request?
- How do I create a reusable ABAP reader for DRF and IDoc replication status?
- How do I troubleshoot missing replication status text for a CR?