SAP MDG · DATA MODEL UI

How do I enable MDG-BP custom fields in query and file-download searches?

Use a custom handler class for model BP when custom BP fields must work in query-based functions such as file download. Implement ZCL_CUSTOM_BP_HANDLER inheriting from CL_MDG_BS_FND_HANDLER, redefine IF_MDG_BS_BP_ACCESS_HANDLER~EXECUTE_QUERY, map selection criteria to BUT000 ranges including ZZLOB and ZZSTAGE, and register the class in MDGIMG for model BP.

Use a custom handler class for model BP when custom BP fields must work in query-based functions such as file download. Implement ZCL_CUSTOM_BP_HANDLER inheriting from CL_MDG_BS_FND_HANDLER, redefine IF_MDG_BS_BP_ACCESS_HANDLER~EXECUTE_QUERY, map selection criteria to BUT000 ranges including ZZLOB and ZZSTAGE, and register the class in MDGIMG for model BP.

A custom BP handler is needed when custom fields must participate in MDG query processing, including file-download scenarios. The documented pattern is to create ZCL_CUSTOM_BP_HANDLER, inherit from CL_MDG_BS_FND_HANDLER, redefine IF_MDG_BS_BP_ACCESS_HANDLER~EXECUTE_QUERY, and extend the selection handling so custom attributes such as ZZLOB and ZZSTAGE are passed into the BUT000 selection and returned through the MDG query framework.

Process flow

  1. Implement SAP Notes 3223641, 3223718, and 3223776.
  2. Create class ZCL_CUSTOM_BP_HANDLER inheriting from CL_MDG_BS_FND_HANDLER.
  3. Redefine IF_MDG_BS_BP_ACCESS_HANDLER~EXECUTE_QUERY.
  4. Build RANGE tables for standard fields and custom fields such as ZZLOB and ZZSTAGE.
  5. Loop over IT_SEL and append each selection criterion to the correct range table.
  6. Select from BUT000 with the custom ranges included in the WHERE clause.
  7. Map the selected rows to ET_DATA using go_mapper->map.
  8. Derive GENDER from XSEXF and XSEXM if needed by your result structure. Call me->filter_query_result to return the final data set. Register the handler in MDGIMG for model BP under Central Governance for Business Partner → Specify Handler
MDGIMG

Central Governance for Business Partner → Specify Handler Processed by Access Class

Assign the custom handler class to model BP so query/file-download access uses the custom EXECUTE_QUERY logic.

Structure
MDGIMG
Master Data Governance
Classic Mode in SAP MDG
Central Governance
Central Governance for Business Partner
Specify Handler Processed by Access Class

Referenced tables

ObjectPurpose
BUT000Business Partner central table used in the sample SELECT for query/file-download handling.

ILLUSTRATIVE ABAP SAMPLE

ZCL_CUSTOM_BP_HANDLER — EXECUTE_QUERY sample

Source-supported ABAP sample for MDG-BP custom-field search and file-download query handling. Add further selectable BUT000 fields in the same pattern: one RANGE table, one CASE branch from IT_SEL, one IN clause on the SELECT.

1CLASS zcl_custom_bp_handler DEFINITION 2 PUBLIC 3 INHERITING FROM cl_mdg_bs_fnd_handler 4 CREATE PUBLIC. 5 6 PUBLIC SECTION. 7 METHODS if_mdg_bs_bp_access_handler~execute_query REDEFINITION. 8ENDCLASS. 9 10CLASS zcl_custom_bp_handler IMPLEMENTATION. 11 12 METHOD if_mdg_bs_bp_access_handler~execute_query. 13 14 DATA: 15 ls_sel TYPE mdg_bs_bp_s_sel, 16 lt_but000 TYPE STANDARD TABLE OF but000, 17 lr_partner TYPE RANGE OF bu_partner, 18 lr_name_org1 TYPE RANGE OF bu_nameor1, 19 lr_name_last TYPE RANGE OF bu_namep_l, 20 lr_searchterm1 TYPE RANGE OF bu_sort1, 21 lr_zzlob TYPE RANGE OF zzlob, " CUSTOM ATTRIBUTE 22 lr_zz1_zext_wkf1_bus TYPE RANGE OF zz1_zext_wkf1. " CUSTOM ATTRIBUTE (backend name) 23 24 FIELD-SYMBOLS: 25 <ls_but000> TYPE but000, 26 <ls_data> TYPE any. 27 28 CLEAR et_data. 29 30 LOOP AT it_sel INTO ls_sel. 31 CASE ls_sel-fieldname. 32 WHEN 'PARTNER'. 33 APPEND VALUE #( 34 sign = ls_sel-sign 35 option = ls_sel-option 36 low = ls_sel-low 37 high = ls_sel-high ) TO lr_partner. 38 39 WHEN 'NAME_ORG1'. 40 APPEND VALUE #( 41 sign = ls_sel-sign 42 option = ls_sel-option 43 low = ls_sel-low 44 high = ls_sel-high ) TO lr_name_org1. 45 46 WHEN 'NAME_LAST'. 47 APPEND VALUE #( 48 sign = ls_sel-sign 49 option = ls_sel-option 50 low = ls_sel-low 51 high = ls_sel-high ) TO lr_name_last. 52 53 WHEN 'SEARCHTERM1'. 54 APPEND VALUE #( 55 sign = ls_sel-sign 56 option = ls_sel-option 57 low = ls_sel-low 58 high = ls_sel-high ) TO lr_searchterm1. 59 60 WHEN 'ZZLOB'. " CUSTOM ATTRIBUTE 61 APPEND VALUE #( 62 sign = ls_sel-sign 63 option = ls_sel-option 64 low = ls_sel-low 65 high = ls_sel-high ) TO lr_zzlob. 66 67 WHEN 'ZZSTAGE'. " MDG attr → BUT000-ZZ1_ZEXT_WKF1_BUS 68 APPEND VALUE #( 69 sign = ls_sel-sign 70 option = ls_sel-option 71 low = ls_sel-low 72 high = ls_sel-high ) TO lr_zz1_zext_wkf1_bus. 73 ENDCASE. 74 ENDLOOP. 75 76 SELECT * 77 FROM but000 78 INTO TABLE lt_but000 79 WHERE partner IN lr_partner 80 AND name_org1 IN lr_name_org1 81 AND name_last IN lr_name_last 82 AND bu_sort1 IN lr_searchterm1 83 AND zzlob IN lr_zzlob 84 AND zz1_zext_wkf1_bus IN lr_zz1_zext_wkf1_bus. 85 86 LOOP AT lt_but000 ASSIGNING <ls_but000>. 87 APPEND INITIAL LINE TO et_data ASSIGNING <ls_data>. 88 89 go_mapper->map( 90 EXPORTING 91 is_source = <ls_but000> 92 CHANGING 93 cs_target = <ls_data> ). 94 95 " Derived GENDER from XSEXF / XSEXM flags 96 ASSIGN COMPONENT 'GENDER' OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_gender>). 97 IF <lv_gender> IS ASSIGNED. 98 IF <ls_but000>-xsexf = abap_true. 99 <lv_gender> = '2'. 100 ELSEIF <ls_but000>-xsexm = abap_true. 101 <lv_gender> = '1'. 102 ELSE. 103 <lv_gender> = '0'. 104 ENDIF. 105 ENDIF. 106 ENDLOOP. 107 108 me->filter_query_result( 109 EXPORTING 110 it_sel = it_sel 111 CHANGING 112 ct_data = et_data ). 113 114 ENDMETHOD. 115 116ENDCLASS.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • When is a custom BP handler class required in MDG?
  • Which class and method must I implement for MDG-BP EXECUTE_QUERY?
  • How do I add ZZLOB and ZZSTAGE to MDG-BP query handling?

Possible questions

  • When is a custom BP handler class required in MDG?
  • Which class and method must I implement for MDG-BP EXECUTE_QUERY?
  • How do I add ZZLOB and ZZSTAGE to MDG-BP query handling?
  • How do I register the custom handler in MDGIMG?
  • What SAP Notes are needed for MDG-BP handler query methods?

Keywords

ZCL_CUSTOM_BP_HANDLERCL_MDG_BS_FND_HANDLERIF_MDG_BS_BP_ACCESS_HANDLER~EXECUTE_QUERYMDGIMGBPBUT000ZZLOBZZSTAGEZZ1_ZEXT_WKF1_BUSfile downloadquery method