SAP MDG · REPLICATION INBOUND
How do I implement the SAP MDG CRA inbound proxy to create change requests, log results, and send email attachments?
The CRA inbound proxy follows a simple runtime pattern: read inbound records, normalize the customer ID, create the change request, import the processing logs from memory, turn the mail log into an XSTRING attachment, send the email, and persist the application log entries.
The CRA inbound proxy follows a simple runtime pattern: read inbound records, normalize the customer ID, create the change request, import the processing logs from memory, turn the mail log into an XSTRING attachment, send the email, and persist the application log entries.
The CRA inbound proxy is implemented as an orchestration method that reads the inbound records, normalizes the customer number, creates the change request, and then handles logging plus notification output. In the documented sample, the method imports processing logs from ABAP memory, converts the mail log to an attachment, sends the email, and finally updates the interface log table.
Process flow
- Read inbound CRA records from `input-mt_mdg_cra-record`.
- Normalize `customer_id` with `CONVERSION_EXIT_ALPHA_INPUT`.
- Populate `lt_bpartner` with customer, company-code, and industry-code values.
- Call `me->create_crequest( it_bpartner = lt_bpartner )`.
- Import `lt_log` from memory ID `ZCRA_LOG`.
- Import `lt_msg_log` from memory ID `ZCRA_MAIL_LOG`.
- If `lt_msg_log` is not initial, convert it to XSTRING with `zcl_mdg_cust_util=>itab_to_xstring` and call `me->write_email( iv_attachment = lv_xstring )`.
- If `lt_log` is not initial, save it with `MODIFY zmdg_bp_intf_log FROM TABLE lt_log`.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_BP_INTF_LOG | Interface log table written at the end of the CRA inbound flow. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1METHOD zii_si_mdg_cra_inbound~si_mdg_cra_inbound.
2*** **** INSERT IMPLEMENTATION HERE **** ***
3 TYPES: BEGIN OF ty_cra_bp,
4 bpartner TYPE zmdg_bp_intf_log-bpartner,
5 pro_industry_code TYPE zmdg_bp_intf_log-industry_code,
6 cur_industry_code TYPE zmdg_bp_intf_log-industry_code,
7 company_code TYPE zmdg_bp_intf_log-company_code,
8 END OF ty_cra_bp .
9
10 TYPES: BEGIN OF ty_msg,
11 customer TYPE kunnr,
12 error_description TYPE char1024,
13 attempt TYPE zmdg_de_attempt,
14 END OF ty_msg.
15
16 DATA: lt_bpartner TYPE STANDARD TABLE OF ty_cra_bp,
17 ls_bpartner LIKE LINE OF lt_bpartner,
18 lt_log TYPE STANDARD TABLE OF zmdg_bp_intf_log,
19 lt_msg_log TYPE STANDARD TABLE OF ty_msg.
20* lv_bp TYPE
21
22 DATA(lt_input) = input-mt_mdg_cra-record.
23 IF lt_input IS NOT INITIAL.
24 LOOP AT lt_input INTO DATA(ls_input).
25 ls_bpartner-bpartner = ls_input-customer_id.
26 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
27 EXPORTING
28 input = ls_bpartner-bpartner
29 IMPORTING
30 output = ls_bpartner-bpartner.
31 ls_bpartner-company_code = ls_input-company_code.
32 ls_bpartner-cur_industry_code = ls_input-cur_industry_code.
33 ls_bpartner-pro_industry_code = ls_input-pro_industry_code.
34 APPEND ls_bpartner TO lt_bpartner.
35 ENDLOOP.
36
37 me->create_crequest( it_bpartner = lt_bpartner ).
38 IMPORT lt_log TO lt_log FROM MEMORY ID 'ZCRA_LOG'.
39 IMPORT lt_msg_log TO lt_msg_log FROM MEMORY ID 'ZCRA_MAIL_LOG'.
40 IF lt_msg_log IS NOT INITIAL.
41 GET REFERENCE OF lt_msg_log INTO DATA(lo_data_ref).
42 DATA(lv_xstring) = zcl_mdg_cust_util=>itab_to_xstring( lo_data_ref ).
43 me->write_email( iv_attachment = lv_xstring ).
44 ENDIF.
45 IF lt_log IS NOT INITIAL.
46 MODIFY zmdg_bp_intf_log FROM TABLE lt_log."#EC CI_SUBRC
47 ENDIF.
48 ENDIF.
49 ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- What is the runtime pattern for ZCL_SI_MDG_CRA_INBOUND?
- How should SI_MDG_CRA_INBOUND process inbound CRA records?
- How do I build an inbound proxy that creates a change request and writes logs in SAP MDG?
Possible questions
- How do I implement the SAP MDG CRA inbound proxy to create change requests, log results, and send email attachments?
- What is the runtime pattern for ZCL_SI_MDG_CRA_INBOUND?
- How should SI_MDG_CRA_INBOUND process inbound CRA records?
- How do I build an inbound proxy that creates a change request and writes logs in SAP MDG?
- Which method creates the change request in the CRA inbound flow?
- How is the email attachment built in the CRA inbound proxy?