SAP MDG · REPLICATION OUTBOUND
How do I implement a custom MDG BP/customer DRF outbound class that filters address usage, identification, role, and tax category nodes and resolves BP key mapping before sending?
Use the DRF outbound lifecycle in `IF_DRF_OUTBOUND~INITIALIZE`, `IF_DRF_OUTBOUND~READ_COMPLETE_DATA`, `IF_DRF_OUTBOUND~APPLY_NODE_INST_FILTER_MULTI`, and `IF_DRF_OUTBOUND~SEND_MESSAGE`, then implement node-specific filters for role, identification, address usage, and tax category plus BP key mapping via `IF_MDG_ID_MATCHING_API_BS`. The custom class `ZCL_MDG_BP_CUSTOMER_PROXY_DRF` shows the pattern: build filter objects with `CL_DRF_SERVICE_TOOLS=>FILTER_OBJECT_FACTORY`, apply them with `APPLY_FILTER`, prune `CT_BS_BP_EXTERN`, and resolve receiver keys with `CL_MDG_ID_MATCHING_API_BS=>GET_INSTANCE` and `GET_MATCHING`.
Use the DRF outbound lifecycle in `IF_DRF_OUTBOUND~INITIALIZE`, `IF_DRF_OUTBOUND~READ_COMPLETE_DATA`, `IF_DRF_OUTBOUND~APPLY_NODE_INST_FILTER_MULTI`, and `IF_DRF_OUTBOUND~SEND_MESSAGE`, then implement node-specific filters for role, identification, address usage, and tax category plus BP key mapping via `IF_MDG_ID_MATCHING_API_BS`. The custom class `ZCL_MDG_BP_CUSTOMER_PROXY_DRF` shows the pattern: build filter objects with `CL_DRF_SERVICE_TOOLS=>FILTER_OBJECT_FACTORY`, apply them with `APPLY_FILTER`, prune `CT_BS_BP_EXTERN`, and resolve receiver keys with `CL_MDG_ID_MATCHING_API_BS=>GET_INSTANCE` and `GET_MATCHING`.
`ZCL_MDG_BP_CUSTOMER_PROXY_DRF` follows a standard proxy-based DRF outbound pattern: initialize the runtime instance, read and reduce the outbound scope, filter BP subnodes, and resolve cross-system keys before send. The class filters role, identification, address usage, and tax category data by creating DRF filter objects with `CL_DRF_SERVICE_TOOLS=>FILTER_OBJECT_FACTORY`, applying external criteria, and deleting non-relevant subnode entries from `CT_BS_BP_EXTERN`. It also resolves outbound BP key mapping with `CL_MDG_ID_MATCHING_API_BS` so the send logic can determine the receiver partner keys.
Process flow
- Implement `IF_DRF_OUTBOUND~INITIALIZE` to create the runtime instance and return `ES_RUNTIME_PARAM_OUT_IMPL`.
- Use `IF_DRF_OUTBOUND~READ_COMPLETE_DATA` to collect the outbound BP object list and suppress non-replicable entries.
- In `IF_DRF_OUTBOUND~APPLY_NODE_INST_FILTER_MULTI`, call `ROLE_NODE_FILTER`, `IDENTIFICATION_NODE_FILTER`, `ADDRESS_USAGE_NODE_FILTER`, and `TAXCAT_NODE_FILTER`.
- In each node filter, create a `CL_DRF_FILTER_OBJECT` with `CL_DRF_SERVICE_TOOLS=>FILTER_OBJECT_FACTORY`, initialize it with `INIT_OBJECTS`, and call `APPLY_FILTER`.
- Delete child entries from `CT_BS_BP_EXTERN` that are not contained in the filtered result tables.
- Implement `GET_BP_KEY_MAPPING` with `CL_MDG_ID_MATCHING_API_BS=>GET_INSTANCE` and `GET_MATCHING` to fill receiver keys.
- Use `GET_BP_BUPA_OUTBOUND` and `GET_BP_RELSHIP_OUTBOUND` to obtain the SOA outbound implementations for sending.
DRF framework / outbound implementation customizing
Define and assign the custom outbound implementation used by the DRF lifecycle methods in the BP/customer replication scenario.
Referenced tables
| Object | Purpose |
|---|---|
MDG_BS_BP_TT_MAPPING_KEYS | Internal cache of BP sender-to-receiver key mappings. |
MDG_BS_BP_S_MAPPING_KEYS | Single key-mapping structure filled by `GET_BP_KEY_MAPPING`. |
MDG_BS_BP_T_EXTERN | External BP structure that is filtered by the node-filter helpers. |
MDG_BS_BP_S_TB009 | Address usage filter result set keyed by `ADR_KIND`. |
MDG_BS_BP_S_TB039A | Identification filter result set keyed by identification type. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1class ZCL_MDG_BP_CUSTOMER_PROXY_DRF definition
2 public
3 inheriting from CL_MDG_BS_BP_SUPER_DRF
4 create public .
5
6public section.
7
8*"* public components of class ZCL_MDG_BP_CUSTOMER_PROXY_DRF
9*"* do not include other source files here!!!
10 interfaces IF_DRF_OUTBOUND .
11
12 class-data GV_CURRENT_STATE type ABAP_BOOL .
13
14 class-methods CLASS_CONSTRUCTOR .
15protected section.
16
17 constants GC_ETERNAL_DATE type BU_DATTO value '99991231' ##NO_TEXT.
18 METHODS get_bp_bupa_outbound RETURNING VALUE(ro_bp_bupa_outbound) TYPE REF TO if_bs_bp_soa_service_impl_out.
19 METHODS get_bp_relship_outbound RETURNING VALUE(ro_bp_relship_outbound) TYPE REF TO if_bs_bp_soa_service_impl_out.
20private section.
21
22 data:
23 GT_MSG_LINK type sorted table of MDG_BS_BP_ADMIN_MESSAGE_DATA with unique key objkey .
24*"* private components of class ZCL_MDG_BP_CUSTOMER_PROXY_DRF
25*"* do not include other source files here!!!
26 data MV_RECEIVER_BSKEY type MDG_EXTR_BSKEY .
27 data MT_KEY_MAPPING type MDG_BS_BP_TT_MAPPING_KEYS .
28
29 methods RAISE_DRF_EXCEPTION
30 importing
31 !IR_EXCEPTION type ref to CX_ROOT
32 raising
33 CX_DRF_EXCEPTION .
34 methods ROLE_NODE_FILTER
35 importing
36 !IT_EXTERNAL_CRITERIA type RSDS_TRANGE
37 !IV_IGNORE_FILTER type ABAP_BOOL
38 changing
39 !CT_BS_BP_EXTERN type MDG_BS_BP_T_EXTERN
40 raising
41 CX_DRF_EXCEPTION .
42 methods SAME_REL_PARTNER
43 importing
44 !IS_RELATION type MDG_BS_BP_REL_S_EXTERN
45 returning
46 value(RV_SAME_TARGET_BP) type ABAP_BOOL .
47 methods GET_BP_KEY_MAPPING
48 importing
49 !IV_PARTNER type BU_PARTNER
50 exporting
51 !ES_KEY_MAPPING type MDG_BS_BP_S_MAPPING_KEYS .
52 methods IDENTIFICATION_NODE_FILTER
53 importing
54 !IT_EXTERNAL_CRITERIA type RSDS_TRANGE
55 !IV_IGNORE_FILTER type ABAP_BOOL
56 changing
57 !CT_BS_BP_EXTERN type MDG_BS_BP_T_EXTERN
58 raising
59 CX_DRF_EXCEPTION .
60 methods ADDRESS_USAGE_NODE_FILTER
61 importing
62 !IT_EXTERNAL_CRITERIA type RSDS_TRANGE
63 !IV_IGNORE_FILTER type ABAP_BOOL
64 changing
65 !CT_BS_BP_EXTERN type MDG_BS_BP_T_EXTERN
66 raising
67 CX_DRF_EXCEPTION .
68 methods TAXCAT_NODE_FILTER
69 importing
70 !IT_EXTERNAL_CRITERIA type RSDS_TRANGE
71 !IV_IGNORE_FILTER type ABAP_BOOL
72 changing
73 !CT_BS_BP_EXTERN type MDG_BS_BP_T_EXTERN
74 raising
75 CX_DRF_EXCEPTION .
76
77ENDCLASS.
78
79
80
81CLASS ZCL_MDG_BP_CUSTOMER_PROXY_DRF IMPLEMENTATION.
82
83
84METHOD ADDRESS_USAGE_NODE_FILTER.
85
86 DATA: lt_address_usage TYPE SORTED TABLE OF MDG_BS_BP_S_TB009 WITH UNIQUE KEY ADR_KIND.
87 DATA: lt_bupa_address TYPE bus_ei_bupa_address_t.
88 DATA: lt_bupa_address_usage TYPE BUS_EI_BUPA_ADDRESSUSAGE_t.
89 DATA: mo_bp_address_usage_filter TYPE REF TO cl_drf_filter_object.
90 DATA: lx_drf_exception TYPE REF TO cx_drf_exception.
91
92 FIELD-SYMBOLS: <ls_bupa_address> TYPE bus_ei_bupa_address.
93 FIELD-SYMBOLS: <ls_bupa_address_usage> TYPE bus_ei_bupa_addressusage.
94 FIELD-SYMBOLS: <ls_bs_bp_extern> TYPE mdg_bs_bp_s_extern.
95
96
97* Segement filter ADDRESS USAGE
98 TRY.
99 mo_bp_address_usage_filter = cl_drf_service_tools=>filter_object_factory(
100 iv_appl = ms_runtime_param-appl
101 iv_business_system = ms_runtime_param-business_system
102 iv_filter_object = '98698'
103 iv_outb_impl = ms_runtime_param-outb_impl
104 io_bal = ms_runtime_param-bal
105 iv_dlmod = ms_runtime_param-dlmod
106 iv_runmod = ms_runtime_param-runmod ).
107
108 CATCH cx_drf_exception INTO lx_drf_exception.
109 RAISE EXCEPTION TYPE cx_drf_exception
110 EXPORTING
111 previous = lx_drf_exception.
112 ENDTRY.
113
114
115* Initialise DRF ADDRESS USAGE filter
116 CALL METHOD mo_bp_address_usage_filter->init_objects
117 EXPORTING
118 iv_use_object_ref = 'X' "=> lt_address_usage is treaten as an reference
119 CHANGING "-> apply_filter will directly update into lt_address_usage
120 ct_objects = lt_address_usage.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- What is the implementation pattern for ZCL_MDG_BP_CUSTOMER_PROXY_DRF?
- How do BP/customer outbound node filters work in MDG DRF?
- How is GET_BP_KEY_MAPPING used in a custom BP replication class?
Possible questions
- How do I implement a custom MDG BP/customer DRF outbound class that filters nodes and resolves BP key mapping?
- Which methods are used in ZCL_MDG_BP_CUSTOMER_PROXY_DRF for outbound processing?
- How does ADDRESS_USAGE_NODE_FILTER work in this class?
- How is GET_BP_KEY_MAPPING implemented for customer/BP replication?
- Which outbound lifecycle methods should I implement for proxy-based BP replication?