SAP MDG · REPLICATION OUTBOUND
How do I implement a common outbound proxy call pattern in SAP MDG or a business application?
Use the standard outbound proxy sequence: collect source data, normalize and validate it, fill the generated request structure, instantiate the proxy, call the outbound method, handle technical faults as business messages, and commit only if the call succeeds and persistence is needed.
Use the standard outbound proxy sequence: collect source data, normalize and validate it, fill the generated request structure, instantiate the proxy, call the outbound method, handle technical faults as business messages, and commit only if the call succeeds and persistence is needed.
Use this pattern when an MDG or business application must collect runtime data, populate a generated proxy payload, and send it to an external or downstream system. The documented flow is: source data collection, normalization, proxy structure filling, proxy instantiation, outbound method call, technical fault handling, and optional commit/logging.
Process flow
- Collect the source data from the business context.
- Copy the input to a working variable or local structure.
- Normalize names, search terms, partner numbers, country, and language if required.
- Fill the generated proxy root structure and nested child nodes.
- Create the proxy object.
- Call the outbound proxy method.
- Catch `cx_ai_system_fault` and convert the text into a readable message.
- Commit work only when the call succeeds and persistence is required; then write logs or update follow-up status.
Report wrapper for a controlled proxy test entry point
Use as a repeatable harness for manually supplied parameters and outbound proxy validation.
Referenced tables
| Object | Purpose |
|---|---|
N/A | No specific configuration table is defined in the retrieved common outbound proxy pattern. |
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 do I collect runtime data, fill a generated proxy, and send it to an external system in SAP?
- What is the standard implementation pattern for an outbound proxy call with error handling and commit control?
- How do I structure outbound proxy mapping, exception handling, and post-processing in MDG?
Possible questions
- How do I normalize source data before proxy mapping?
- How do I handle cx_ai_system_fault in an outbound proxy call?
- When should I use a report wrapper like ZSAM_TEST for proxy testing?
- What should be documented in an outbound proxy scenario?
- How do I build a nested request structure for an outbound proxy?