SAP MDG · CONSOLIDATION
How do I implement custom partner numbering and custom extension-table persistence in ZCL_MDC_MODEL_BP for BP Consolidation?
Implement ZCL_MDC_MODEL_BP as a subclass of CL_MDC_MODEL_BP and redefine MAP_BUSINESS_PARTNER_2API, MAP_EXTENSIONS_2API, READ_ALL_DATA, and SAVE_BUSINESS_PARTNER_ACTIVE to add idempotent custom BP numbering, dynamic extension-field mapping, custom source-table loading, and update-task persistence.
Implement ZCL_MDC_MODEL_BP as a subclass of CL_MDC_MODEL_BP and redefine MAP_BUSINESS_PARTNER_2API, MAP_EXTENSIONS_2API, READ_ALL_DATA, and SAVE_BUSINESS_PARTNER_ACTIVE to add idempotent custom BP numbering, dynamic extension-field mapping, custom source-table loading, and update-task persistence.
Implement the custom BP consolidation logic in ZCL_MDC_MODEL_BP by keeping the standard superclass flow and adding four redefined methods: MAP_BUSINESS_PARTNER_2API for idempotent partner/customer numbering, MAP_EXTENSIONS_2API for RTTI-based extension mapping, READ_ALL_DATA for loading custom PRC data, and SAVE_BUSINESS_PARTNER_ACTIVE for update-task persistence of the active Z-table.
Process flow
- Create or extend ZCL_MDC_MODEL_BP inheriting from CL_MDC_MODEL_BP.
- Redefine MAP_BUSINESS_PARTNER_2API to implement idempotent numbering for grouping ZTRA using ZMDG_BP_MDC_MAP and Z_NEXT_NUM_ZTRA.
- Redefine MAP_EXTENSIONS_2API to map custom PRC fields dynamically with CL_ABAP_STRUCTDESCR into the CVI extension data and datax structures.
- Redefine READ_ALL_DATA to call the superclass, respect package read mode, and load ZLFA1_EXT into MR_ZZLFA1_EXT_PRC.
- Redefine SAVE_BUSINESS_PARTNER_ACTIVE to resolve the BP number, map extension data back to ZLFA1_EXT, and call Z_BP_ZLFA1_EXT_UPDATE in update task.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_BP_MDC_MAP | Stores process-wise BP number mappings so reruns reuse the same number. |
ZLFA1_EXT | Custom extension table used as the source and active persistence structure for custom BP-related data. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: ZCL_BI_CUST_CR_SI_ERP.clas.abap
Exact relevant implementation excerpt from the knowledge document set.
1class ZCL_BI_CUST_CR_SI_ERP definition
2 public
3 final
4 create public .
5
6public section.
7
8 interfaces IF_BADI_INTERFACE .
9 interfaces IF_MDG_BS_CUST_SUPP_CR_SI .
10
11 methods CONSTRUCTOR .
12protected section.
13
14 data MO_CUSTOMER type ref to CL_MDG_BS_CUST_CR_SI_ERP_IMPL .
15private section.
16ENDCLASS.
17
18
19
20CLASS ZCL_BI_CUST_CR_SI_ERP IMPLEMENTATION.
21
22
23 METHOD constructor.
24 CREATE OBJECT mo_customer.
25 ENDMETHOD.
26
27
28 method IF_MDG_BS_CUST_SUPP_CR_SI~MAP_BP_TO_STAGING_WO_CR.
29 mo_customer->if_mdg_bs_cust_supp_cr_si~map_bp_to_staging_wo_cr(
30 EXPORTING
31 is_bp_api = is_bp_api
32 iv_temp_sta_bp_id = iv_temp_sta_bp_id
33 CHANGING
34 ct_bp_staging = ct_bp_staging
35 ct_messages = ct_messages ).
36 endmethod.
37
38
39 METHOD if_mdg_bs_cust_supp_cr_si~set_supplier_data_2_sta.
40
41 mo_customer->if_mdg_bs_cust_supp_cr_si~set_supplier_data_2_sta(
42 EXPORTING
43 is_bp_api = is_bp_api
44 ir_cr_api = ir_cr_api
45 ir_gov_api = ir_gov_api
46 iv_crequest_id = iv_crequest_id
47 iv_temp_sta_bp_id = iv_temp_sta_bp_id
48 CHANGING
49 ct_return_messages = ct_return_messages ).
50 ENDMETHOD.
51ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I extend CL_MDC_MODEL_BP for custom BP numbering?
- How do I map custom extension fields in BP consolidation?
- How do I persist Z-table data during BP activation in MDC consolidation?
Possible questions
- Show the ABAP sample for MAP_BUSINESS_PARTNER_2API
- Show the ABAP sample for MAP_EXTENSIONS_2API
- Show the ABAP sample for READ_ALL_DATA and SAVE_BUSINESS_PARTNER_ACTIVE
- What is the purpose of ZMDG_BP_MDC_MAP?
- What is the purpose of MR_ZZLFA1_EXT_PRC?