SAP MDG · DATA MODEL UI
How can I extend the MDG Business Partner search result list to show related customer and company-code details on selection?
Extend `BS_BP_QUERY_RESULT` with a custom feeder class that raises `BP_SELECTED`, then add a Web Dynpro component that receives the selected partner and loads assigned customer and company-code data on demand.
Extend `BS_BP_QUERY_RESULT` with a custom feeder class that raises `BP_SELECTED`, then add a Web Dynpro component that receives the selected partner and loads assigned customer and company-code data on demand.
This solution extends the MDG-BP search result list with an on-demand drilldown instead of loading all related customer data upfront. The custom feeder class captures the selected Business Partner, raises `BP_SELECTED`, and a Web Dynpro component receives that event to display assigned customer and company-code details.
Process flow
- Customize `BS_BP_QUERY_RESULT` and replace `CL_BS_BP_QUERY_RESULT` with `YY_CL_BS_BP_QUERY_RESULT`.
- In `IF_FPM_GUIBB_LIST~PROCESS_EVENT`, detect the lead-selection event and read field `PARTNER` from the selected row.
- Raise FPM event `BP_SELECTED` with event data key `PARTNER`.
- Create Web Dynpro component `ZMDG_SEARCH_RSLT_DET_CUS` with structures `YSTR_RESULT_DETAILS_CUS` and `YSTR_RESULT_DETAILS_CUS_CC`.
- Implement component-controller `PROCESS_EVENT` to receive `BP_SELECTED` and load assigned customers into node `CUST`.
- Implement `ONACTIONSELECT_CC` to load company-code rows from `KNB1` into node `CUST_CC`.
- Create UI configuration `YY_SEARCH_RESULT_DETAILS` based on `FPM_COMPOSITE_UIBB_TEMPLATE`.
- Add the configuration to `BS_BP_DQUERY` as an `FPM_COMPOSITE_UIBB`.
Referenced tables
| Object | Purpose |
|---|---|
MDG_MLT_ASSGMNT | Maps the Business Partner to assigned customer objects; used to find customer rows for the selected BP. |
KNA1 | Customer general data source used for BP drilldown details. |
KNB1 | Customer company-code data source used for the second-level drilldown. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1*---------------------------------------------------------------------*
2* Source: Extend the Search Result List for MDG for Business Partner
3* Version: 3.0 - December 2024
4* Purpose: Code implementations reproduced from the source guide.
5*---------------------------------------------------------------------*
6
7*---------------------------------------------------------------------*
8* Implementation 1: Method IF_FPM_GUIBB_LIST~PROCESS_EVENT
9*---------------------------------------------------------------------*
10METHOD if_fpm_guibb_list~process_event.
11
12 CONSTANTS lc_event_id_bp_selected TYPE fpm_event_id VALUE 'BP_SELECTED'.
13
14 DATA lr_event TYPE REF TO cl_fpm_event.
15 DATA lr_iterator TYPE REF TO if_bol_entity_col_iterator.
16 DATA lr_bol_entity TYPE REF TO cl_crm_bol_entity.
17
18 FIELD-SYMBOLS <ls_data> TYPE any.
19 FIELD-SYMBOLS <lv_partner> TYPE any.
20
21 " Super Call...
22 CALL METHOD super->if_fpm_guibb_list~process_event
23 EXPORTING
24 io_event = io_event
25 iv_raised_by_own_ui = iv_raised_by_own_ui
26 iv_lead_index = iv_lead_index
27 iv_event_index = iv_event_index
28 it_selected_lines = it_selected_lines
29 io_ui_info = io_ui_info
30 IMPORTING
31 ev_result = ev_result
32 et_messages = et_messages.
33
34 " check if the right event has been raised
35 CHECK iv_lead_index >= 1
36 AND io_event->mv_event_id = 'FPM_GUIBB_LIST_ON_LEAD_SELECTI'.
37
38 " fetch the selected BP ID
39 ASSIGN mr_entity_data->* TO <ls_data>.
40 lr_iterator = mo_collection->get_iterator( ).
41 lr_bol_entity = lr_iterator->get_by_index( iv_lead_index ).
42 lr_bol_entity->get_properties(
43 IMPORTING
44 es_attributes = <ls_data> ).
45
46 ASSIGN COMPONENT 'PARTNER' OF STRUCTURE <ls_data> TO <lv_partner>.
47
48 CHECK sy-subrc = 0
49 AND <lv_partner> IS NOT INITIAL.
50
51 " fire event
52 CREATE OBJECT lr_event
53 EXPORTING
54 iv_event_id = lc_event_id_bp_selected.
55
56 lr_event->mo_event_data->set_value(
57 EXPORTING
58 iv_key = 'PARTNER'
59 iv_value = <lv_partner> ).
60
61 cl_fpm_factory=>get_instance( )->raise_event( io_event = lr_event ).
62
63ENDMETHOD.
64
65*---------------------------------------------------------------------*
66* Implementation 2: Component Controller - PROCESS_EVENT
67*---------------------------------------------------------------------*
68METHOD process_event.
69
70 DATA lo_nd_cust TYPE REF TO if_wd_context_node.
71 DATA lt_cust TYPE wd_this->elements_cust.
72
73 CHECK io_event->mv_event_id = 'BP_SELECTED'.
74
75 wd_context->invalidate( ).
76
77 io_event->mo_event_data->get_value(
78 EXPORTING
79 iv_key = 'PARTNER'
80 IMPORTING
81 ev_value = wd_this->selected_bp ).
82
83 CHECK wd_this->selected_bp IS NOT INITIAL.
84
85 SELECT knd~kunnr
86 knd~ktokd
87 knd~aufsd
88 knd~loevm
89 INTO CORRESPONDING FIELDS OF TABLE lt_cust
90 FROM mdg_mlt_assgmnt AS mtl INNER JOIN kna1 AS knd
91 ON mtl~object_id = knd~kunnr
92 WHERE mtl~assignment_cat = 'CUST'
93 AND mtl~object_id = wd_this->selected_bp.
94
95 CHECK lt_cust IS NOT INITIAL.
96
97 lo_nd_cust = wd_context->get_child_node( name = wd_this->wdctx_cust ).
98 CHECK lo_nd_cust IS BOUND.
99 lo_nd_cust->bind_table( new_items = lt_cust
100 set_initial_elements = abap_true ).
101
102ENDMETHOD.
103
104*---------------------------------------------------------------------*
105* Implementation 3: ONACTIONSELECT_CC
106*---------------------------------------------------------------------*
107METHOD onactionselect_cc.
108 DATA lo_nd_cust TYPE REF TO if_wd_context_node.
109 DATA lo_el_cust TYPE REF TO if_wd_context_element.
110 DATA ls_cust TYPE wd_this->element_cust.
111 DATA lo_nd_cust_cc TYPE REF TO if_wd_context_node.
112 DATA lt_cust_cc TYPE wd_this->elements_cust_cc.
113
114 lo_nd_cust = wd_context->get_child_node( name = wd_this->wdctx_cust ).
115 lo_el_cust = lo_nd_cust->get_element( ).
116 lo_el_cust->get_static_attributes(
117 IMPORTING
118 static_attributes = ls_cust ).
119
120 IF ls_cust-kunnr IS NOT INITIAL.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I add a drilldown to the MDG-BP search result list?
- How can I display customer details when a Business Partner is selected in MDG?
- How do I extend BS_BP_QUERY_RESULT in MDG-BP?
Possible questions
- How do I customize BS_BP_QUERY_RESULT for BP selection?
- How do I create the Web Dynpro component for BP drilldown details?
- How do I bind customer and company-code data after BP selection?
- Which event and UI configuration are used for MDG-BP search result drilldown?
- How do I adapt the example for supplier or sales-area details?