SAP MDG · DATA MODEL UI
How do I implement a custom SAP MDG Business Partner access handler for custom entities, BP header mapping, and additional data persistence?
Use a custom class inheriting from `CL_MDG_BS_ECC_HANDLER`, include the required entities in `SORT_ENTITIES`, read and map them in `GET_OBJECT_DATA_BY_ENTITY` and `MAP_DATA_2STA`, attach them back to the BP API structure in `PREPARE_EI_HEADER_MAP_2API`, and persist changes in `SAVE_ADDITIONAL_OBJECT_DATA`.
Use a custom class inheriting from `CL_MDG_BS_ECC_HANDLER`, include the required entities in `SORT_ENTITIES`, read and map them in `GET_OBJECT_DATA_BY_ENTITY` and `MAP_DATA_2STA`, attach them back to the BP API structure in `PREPARE_EI_HEADER_MAP_2API`, and persist changes in `SAVE_ADDITIONAL_OBJECT_DATA`.
Implement a subclass of `CL_MDG_BS_ECC_HANDLER` and redefine the BP access-handler methods you need. The sample shows the full pattern for two custom entities: `ZNPSCDUP` is read from `ZMDG_BP_ZNPSCDUP`, `YTBKVID` is derived from `KNB1-YY1_BKVID_ST_CCO`, both are included in entity sorting, mapped into staging, attached back to the BP API structure, and persisted via an update-task function module.
Process flow
- Create a class inheriting from `CL_MDG_BS_ECC_HANDLER`.
- Redefine `IF_MDG_BS_BP_ACCESS_HANDLER~SORT_ENTITIES` and append the custom entities when they are available in `IT_ENTITIES_ALL`.
- Redefine `GET_OBJECT_DATA_BY_ENTITY` to read `ZNPSCDUP` from `ZMDG_BP_ZNPSCDUP` and derive `YTBKVID` from `KNB1-YY1_BKVID_ST_CCO`.
- Redefine `MAP_DATA_2STA` to move source rows into the staging structures and stamp the BP header value.
- Redefine `PREPARE_EI_HEADER_MAP_2API` to attach the custom rows back onto the matching BP external structure.
- Redefine `SAVE_ADDITIONAL_OBJECT_DATA` to split insert and delete rows and persist them in update task.
- Keep `MAP_DATA_2API` and `READ_OBJECT_DATA` empty if the scenario does not need them.
- Use a helper like `GET_VALUE` for dynamic field access in deep BP structures.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_BP_ZNPSCDUP | Custom table used as the persistence source and target for the `ZNPSCDUP` entity. |
KNB1 | Source table read for `YTBKVID` by parsing `YY1_BKVID_ST_CCO`. |
ZMDG_D_UTIL_SYST | Configuration table used in the sample to control BP ID-number update logic by request type and change-request type. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: Create_or_Redefine_UI_Feeder_Class.abap
Exact relevant implementation excerpt from the knowledge document set.
1*---------------------------------------------------------------------*
2* TITLE: Create or Redefine a UI Feeder Class
3* SOURCE: SAP How-To Guide
4*---------------------------------------------------------------------*
5* TAGS:
6* SAP MDG
7* SAP Master Data Governance
8* UI Feeder Class
9* FPM
10* Floorplan Manager
11* Web Dynpro ABAP
12* UIBB
13* Form UIBB
14* CL_BS_BP_GUIBB_FORM
15* CL_BS_BP_GUIBB_LIST
16* CL_BS_CU_GUIBB_GENERAL_DATA
17* ZCL_BS_CU_GUIBB_GENERAL_DATA
18* IF_FPM_GUIBB_FORM~GET_DEFINITION
19* OVS_HANDLE_PHASE_2
20* GET_JOIN_ENTITY_DATA
21* GET_ENTITY_DATA
22* OVS Search Help
23* KDKG1
24* KDKG1__TEXT
25* TVKGG
26* TVKGGT
27* genIL
28* BUPA
29* BUPA_CUSP
30* CL_BS_CUSTOMER_GENIL
31* ZCL_BS_GENIL_CUSTOM
32* GENIL_MODEL_BROWSER
33* USMD_TXT_FLD_EXC
34* USMD_TXT_FLD_MAP_DELETE
35*---------------------------------------------------------------------*
36
37*---------------------------------------------------------------------*
38* CLASS: ZCL_BS_CU_GUIBB_GENERAL_DATA
39* METHOD: IF_FPM_GUIBB_FORM~GET_DEFINITION
40*---------------------------------------------------------------------*
41METHOD if_fpm_guibb_form~get_definition.
42
43*! Get the definition of the feeder class / UIBB.
44
45 "inherit first
46 super->if_fpm_guibb_form~get_definition(
47 IMPORTING
48 eo_field_catalog = eo_field_catalog
49 et_field_description = et_field_description
50 et_action_definition = et_action_definition
51 et_special_groups = et_special_groups
52 et_dnd_definition = et_dnd_definition
53 es_options = es_options
54 es_message = es_message
55 ev_additional_error_info = ev_additional_error_info ).
56
57 "set the OVS search help for field Condition Group 1 (KDKG1) to the
58 "current class
59 READ TABLE et_field_description ASSIGNING FIELD-SYMBOL(<description>)
60 WITH KEY name = 'KDKG1'.
61
62 IF sy-subrc = 0.
63 <description>-ovs_name = me->class_name.
64 ENDIF.
65
66ENDMETHOD.
67
68*---------------------------------------------------------------------*
69* CLASS: ZCL_BS_CU_GUIBB_GENERAL_DATA
70* METHOD: OVS_HANDLE_PHASE_2
71*---------------------------------------------------------------------*
72METHOD ovs_handle_phase_2.
73
74 CASE iv_field_name.
75 WHEN 'KDKG1'.
76 "Implement the OVS search result for the Condition Group 1.
77 "The corresponding customizing tables are TVKGG & TVKGGT.
78 TYPES:
79 BEGIN OF ty_s_ovs_condition,
80 kdkg1 TYPE kdkgr,
81 kdkg1__text TYPE vtext,
82 END OF ty_s_ovs_condition,
83 ty_t_ovs_condition TYPE STANDARD TABLE OF ty_s_ovs_condition.
84
85 CREATE DATA er_output TYPE ty_t_ovs_condition.
86 FIELD-SYMBOLS <output> TYPE ty_t_ovs_condition.
87 ASSIGN er_output->* TO <output>.
88
89 SELECT * FROM tvkgg INTO TABLE @DATA(conditions).
90
91 IF conditions IS NOT INITIAL.
92 SELECT * FROM tvkggt INTO TABLE @DATA(texts)
93 FOR ALL ENTRIES IN @conditions
94 WHERE kdkgr = @conditions-kdkgr
95 AND spras = @sy-langu.
96 ENDIF.
97
98 LOOP AT conditions ASSIGNING FIELD-SYMBOL(<condition>).
99 APPEND INITIAL LINE TO <output> ASSIGNING FIELD-SYMBOL(<line>).
100 <line>-kdkg1 = <condition>-kdkgr.
101 <line>-kdkg1__text = <condition>-kdkgr.
102
103 READ TABLE texts ASSIGNING FIELD-SYMBOL(<text>)
104 WITH KEY kdkgr = <condition>-kdkgr
105 spras = sy-langu.
106
107 CHECK sy-subrc = 0
108 AND <text>-vtext IS NOT INITIAL.
109
110 <line>-kdkg1__text = <text>-vtext.
111 ENDLOOP.
112
113 WHEN OTHERS.
114 "The method is called for each field using an OVS. To support
115 "SAP owned fields with their standard logic, the OTHERS simply
116 "calls the parent class.
117 super->ovs_handle_phase_2(
118 EXPORTING
119 iv_field_name = iv_field_name
120 ir_query_parameter = ir_query_parameterThe remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I extend the MDG BP access handler for custom entity processing?
- How do I map custom BP entities in `IF_MDG_BS_BP_ACCESS_HANDLER`?
- How do I persist custom BP extension data from an MDG access handler?
Possible questions
- How do I implement `IF_MDG_BS_BP_ACCESS_HANDLER~GET_OBJECT_DATA_BY_ENTITY` for a custom BP entity?
- How do I add a custom entity to `SORT_ENTITIES` in an MDG BP handler?
- How do I attach custom entity data in `PREPARE_EI_HEADER_MAP_2API`?
- How do I save custom BP extension rows in `SAVE_ADDITIONAL_OBJECT_DATA`?
- How do I update BP ID numbers from an MDG access handler?