SAP MDG · REPLICATION OUTBOUND
How do I implement an outbound proxy pattern in SAP MDG for a generated proxy payload?
Use the outbound proxy pattern to collect runtime data, normalize and validate it, fill the generated request structure, call the proxy, catch technical faults, and commit only after a successful send when persistence is required.
Use the outbound proxy pattern to collect runtime data, normalize and validate it, fill the generated request structure, call the proxy, catch technical faults, and commit only after a successful send when persistence is required.
Use this pattern when an MDG or business application must build a generated proxy payload and send it to a downstream system. The standard flow is to collect source data, normalize and validate it, fill the proxy request structure, create the proxy object, call the outbound method, and then handle technical faults with a readable return message.
Process flow
- Identify the trigger: button action, report, change-request event, validation, or update step.
- Read the business input into local variables.
- Normalize and validate the values.
- Fill the generated proxy root and child structures.
- Create the proxy instance.
- Call the outbound proxy method.
- Catch technical exceptions and map them to a readable message.
- Commit work or write logs only after success, if required.
No explicit SPRO path is provided in the retrieved pattern. This is an implementation pattern answer, not a customizing-step answer.
Referenced tables
| Object | Purpose |
|---|---|
— No specific database tables are mandated by the retrieved pattern. Use your application or MDG source structures and any custom trace/log tables required by your implementation. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: generic_outbound_proxy_sample.abap
Exact relevant implementation excerpt from the knowledge document set.
1"==============================================================================
2" Generic Outbound Proxy Sample
3" Purpose:
4" - Show the common pattern for preparing data, filling generated proxy
5" structures, calling the proxy, and handling technical faults.
6" Flow:
7" - Collect source values
8" - Normalize the values
9" - Fill the nested request structure
10" - Create the proxy instance
11" - Call the proxy method
12" - Convert technical failures into a readable return message
13"==============================================================================
14
15REPORT zsam_outbound_proxy_sample.
16
17PARAMETERS:
18 p_partner TYPE kunnr,
19 p_reqid TYPE char3,
20 p_country TYPE land1,
21 p_name1 TYPE name1_gp,
22 p_name2 TYPE name2_gp.
23
24DATA:
25 ls_request TYPE zmt_partner_transfer_gts_req,
26 ls_response TYPE zmt_partner_transfer_gts_res,
27 lo_proxy TYPE REF TO zco_si_partner_transfer_gts_in,
28 lv_message TYPE string.
29
30START-OF-SELECTION.
31
32 " Keep the input in local working variables so the mapping is explicit.
33 DATA(lv_partner) = p_partner.
34 DATA(lv_reqid) = p_reqid.
35 DATA(lv_country) = p_country.
36 DATA(lv_name1) = p_name1.
37 DATA(lv_name2) = p_name2.
38
39 " Normalize the values that the receiver expects in a stable format.
40 TRANSLATE lv_name1 TO UPPER CASE.
41 TRANSLATE lv_name2 TO UPPER CASE.
42
43 " Fill the generated proxy structure step by step.
44 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_key-partner_id = lv_partner.
45 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_key-partner_typ = '02'.
46 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_head-extern_no = lv_partner.
47 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_head-partn_cat = '2'.
48 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-central-partnerexternal = lv_partner.
49 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-central_org-name1 = lv_name1.
50 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-central_org-name2 = lv_name2.
51 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_address-country = lv_country.
52 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-iv_upd_task_pntbp = abap_false.
53
54 " Add any additional business controls or derived values here.
55 IF lv_reqid IS NOT INITIAL.
56 ls_request-mt_partner_transfer_gts_req-partner_inbound_gts-partner-partner_key-org_logsystem = sy-sysid.
57 ENDIF.
58
59 TRY.
60 " Create the proxy object and send the payload.
61 CREATE OBJECT lo_proxy.
62 lo_proxy->si_partner_transfer_gts_inboun(
63 EXPORTING
64 input = ls_request
65 IMPORTING
66 output = ls_response ).
67
68 lv_message = |Proxy call completed successfully for partner { lv_partner }|.
69
70 CATCH cx_ai_system_fault INTO DATA(lx_system_fault).
71 " Convert the technical error into a readable message for the caller.
72 lv_message = lx_system_fault->get_text( ).
73 ENDTRY.
74
75 " Display the final status for the test harness.
76 WRITE: / lv_message.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How should I build and send an outbound proxy request from MDG data?
- What is the standard implementation pattern for MDG outbound proxy enrichment?
- How do I populate a generated proxy structure and call the outbound proxy method in SAP?
Possible questions
- What is the trigger for the outbound proxy call?
- Where does the source data come from for the proxy payload?
- How do I map MDG data into the proxy request structure?
- How should I handle technical faults during proxy outbound processing?
- When should I commit work after a proxy call?
- How do I document a GTS-style proxy validation/update flow?