SAP MDG · REPLICATION INBOUND
How do I implement failed-entry logging in an SAP MDG STA inbound proxy method?
In the STA inbound flow, failed entries are collected from the input log, a new GUID is generated with GUID_CREATE, and each error record is inserted into ZMDG_BP_INTF_LOG with interface = 'STA', attempt = '1', and the relevant business partner and message fields copied across.
In the STA inbound flow, failed entries are collected from the input log, a new GUID is generated with GUID_CREATE, and each error record is inserted into ZMDG_BP_INTF_LOG with interface = 'STA', attempt = '1', and the relevant business partner and message fields copied across.
In the STA inbound pattern, failed records are filtered from the internal log by `status = 'E'`, assigned a generated `message_id` via `GUID_CREATE`, and written to `ZMDG_BP_INTF_LOG` with interface-specific context such as `interface = 'STA'` and `attempt = '1'`. The method is intentionally simple: collect only error rows, copy the relevant business fields, and persist the log entry for downstream troubleshooting.
Process flow
- Call `LOG_FAILED_STA_ENTRIES` after STA processing identifies error rows.
- Ensure `it_log` contains runtime error context in `zmdg_s_intf_log` format.
- For each failed row, generate a unique `message_id` via `GUID_CREATE`.
- Map the business and interface fields into `zmdg_bp_intf_log`.
- Insert the row into `ZMDG_BP_INTF_LOG`.
- Check `sy-subrc` after the insert if you need error handling or duplicate protection.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_BP_INTF_LOG | Persistent STA interface log table used to store failed entries. |
ZMDG_S_INTF_LOG | Source log structure that carries the inbound STA processing data before persistence. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1method log_failed_sta_entries.
2
3 data: ls_log type zmdg_s_intf_log,
4 ls_intf_log type zmdg_bp_intf_log,
5 lv_guid type guid_32.
6
7 loop at it_log into ls_log where status = 'E'.
8 clear ls_intf_log.
9
10 call function 'GUID_CREATE'
11 importing
12 ev_guid_32 = lv_guid.
13 ls_intf_log-mandt = sy-mandt.
14 ls_intf_log-timestamp = ls_log-timestamp.
15 ls_intf_log-bpartner = ls_log-bpartner.
16 ls_intf_log-interface = 'STA'.
17 ls_intf_log-message_id = lv_guid.
18 ls_intf_log-status = ls_log-status.
19 ls_intf_log-attempt = '1'.
20 ls_intf_log-error1 = ls_log-error1.
21 ls_intf_log-customer = ls_log-customer.
22 ls_intf_log-organization_id = ls_log-organization_id.
23 ls_intf_log-partner_function = ls_log-partner_function.
24 ls_intf_log-company_code = ls_log-company_code.
25 ls_intf_log-sales_territory_org_id = ls_log-sales_territory_org_id.
26 ls_intf_log-transaction_code = ls_log-transaction_code.
27 ls_intf_log-distribution_chnl = ls_log-distribution_chnl.
28 ls_intf_log-division = ls_log-division.
29 ls_intf_log-default_partner_indicator = ls_log-default_partner_indicator.
30
31 insert zmdg_bp_intf_log from ls_intf_log. "#EC CI_SUBRC
32 if sy-subrc = 0.
33
34 endif.
35
36 endloop.
37
38endmethod.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I store STA inbound errors in a custom interface log table?
- What is the pattern for logging failed STA records in MDG inbound processing?
- How do I copy STA error records into ZMDG_BP_INTF_LOG?
Possible questions
- How do I implement failed-entry logging in an SAP MDG STA inbound proxy method?
- How do I store STA inbound errors in a custom interface log table?
- What is the pattern for logging failed STA records in MDG inbound processing?
- How do I copy STA error records into ZMDG_BP_INTF_LOG?
- Which method writes failed STA records to the interface log?