SAP MDG · UTILITIES
How do I retrieve a list of SAP MDG change requests for a business partner number?
Use BP → partner GUID → BP_HEADER technical key → USMD1213 to find linked change requests, then read USMD120C for the CR header data and sort the result by date/time.
Use BP → partner GUID → BP_HEADER technical key → USMD1213 to find linked change requests, then read USMD120C for the CR header data and sort the result by date/time.
The reusable pattern in the source resolves SAP MDG change requests from a Business Partner number in four stages: convert and validate the BP, read its partner GUID, determine whether it is linked to vendor/customer master data, then locate the BP_HEADER technical key and follow USMD1213 to the related change requests. The resulting CRs are then enriched from USMD120C with description and creation timestamp
Process flow
- Normalize the input BP with `CONVERSION_EXIT_ALPHA_INPUT`.
- Read `BUT000` to get `PARTNER_GUID` for the BP.
- Read `CVI_VEND_LINK` and `CVI_CUST_LINK` to identify the BP type.
- Call `CL_USMD_ADAPTER_PROVIDER=>GET_MODEL_GENERATION_ADAPTER` for model `BP`.
- Call `GET_GENERATED_OBJECTS` and find `TMX_BP_BP_HEADER`.
- Read the generated BP header table to obtain `USMDKBPBP_HEADER` and `/1MD/BPBP_HEADER`.
- Read `USMD1213` where `
USMD_ENTITY= 'BP_HEADER'` and `USMD_VALUE= <technical key>`. - Read `USMD120C` for the CR header details of the returned CR numbers.
No explicit IMG/SPRO configuration is required in the source for this read-only search logic; it uses standard MDG/BP runtime tables and adapter APIs.
Referenced tables
| Object | Purpose |
|---|---|
BUT000 | Business Partner master data; used here to resolve `PARTNER_GUID` from the BP number. |
CVI_VEND_LINK | Links BP partner GUID to vendor number. |
CVI_CUST_LINK | Links BP partner GUID to customer number. |
USMD1213 | MDG link table used to find change requests by entity technical key. |
USMD120C | Change request header table used to read CR description and creation timestamp. |
ILLUSTRATIVE ABAP SAMPLE
ABAP example: find MDG change requests by BP number
Copied from the documented pattern and formatted as a reusable class method implementation.
1CLASS zcl_bp_cr_search DEFINITION PUBLIC FINAL CREATE PUBLIC.
2 PUBLIC SECTION.
3 TYPES: BEGIN OF ty_cr_list,
4 part_type TYPE text10,
5 partner TYPE char10,
6 cr TYPE usmd_crequest,
7 cr_desc TYPE text50,
8 date TYPE sy-datum,
9 time TYPE sy-uzeit,
10 supplier TYPE char10,
11 customer TYPE char10,
12 END OF ty_cr_list.
13 TYPES tt_cr_list TYPE TABLE OF ty_cr_list.
14
15 CLASS-METHODS get_crs_by_bp
16 IMPORTING iv_bp TYPE bu_partner
17 EXPORTING et_cr_list TYPE tt_cr_list
18 ev_message TYPE text100.
19ENDCLASS.
20
21CLASS zcl_bp_cr_search IMPLEMENTATION.
22 METHOD get_crs_by_bp.
23 DATA: lv_bp_int TYPE bu_partner,
24 lv_bp_guid TYPE but000-partner_guid,
25 lv_vendor TYPE lifnr,
26 lv_customer TYPE kunnr,
27 lv_part_type TYPE text10.
28
29 lv_bp_int = iv_bp.
30 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
31 EXPORTING input = lv_bp_int
32 IMPORTING output = lv_bp_int.
33
34 SELECT SINGLE partner_guid INTO @lv_bp_guid
35 FROM but000 WHERE partner = @lv_bp_int.
36 IF sy-subrc <> 0 OR lv_bp_guid IS INITIAL.
37 ev_message = |Business Partner { iv_bp } does not exist.|.
38 RETURN.
39 ENDIF.
40
41 SELECT SINGLE vendor INTO @lv_vendor
42 FROM cvi_vend_link WHERE partner_guid = @lv_bp_guid.
43 SELECT SINGLE customer INTO @lv_customer
44 FROM cvi_cust_link WHERE partner_guid = @lv_bp_guid.
45
46 IF lv_vendor IS NOT INITIAL AND lv_customer IS NOT INITIAL.
47 lv_part_type = 'BOTH'.
48 ELSEIF lv_vendor IS NOT INITIAL.
49 lv_part_type = 'VENDOR'.
50 ELSEIF lv_customer IS NOT INITIAL.
51 lv_part_type = 'CUSTOMER'.
52 ELSE.
53 lv_part_type = 'BP'.
54 ENDIF.
55
56 CALL METHOD cl_usmd_adapter_provider=>get_model_generation_adapter
57 EXPORTING i_usmd_model = 'BP'
58 IMPORTING eo_model_gen_adapter = DATA(lo_model_gen_adapter).
59
60 CALL METHOD lo_model_gen_adapter->get_generated_objects
61 IMPORTING et_log_phys_name = DATA(lt_log_phys_name).
62
63 SORT lt_log_phys_name BY log_name.
64 READ TABLE lt_log_phys_name INTO DATA(ls_log_phys_name)
65 WITH KEY log_name = 'TMX_BP_BP_HEADER' BINARY SEARCH.
66 IF sy-subrc <> 0.
67 ev_message = 'TMX generated table not found.'.
68 RETURN.
69 ENDIF.
70
71 DATA: lv_techkey TYPE usmd_tech_key,
72 lv_bpval TYPE bu_businesspartner.
73
74 SELECT SINGLE usmdkbpbp_header, /1md/bpbp_header
75 FROM (ls_log_phys_name-phys_name)
76 INTO (@lv_techkey, @lv_bpval)
77 WHERE /1md/bpbp_header = @lv_bp_int.
78
79 IF sy-subrc <> 0 OR lv_techkey IS INITIAL.
80 ev_message = 'No technical key found for BP'.
81 RETURN.
82 ENDIF.
83
84 SELECT * FROM usmd1213 INTO TABLE @DATA(lt_1213)
85 WHERE usmd_entity = 'BP_HEADER'
86 AND usmd_value = @lv_techkey.
87
88 IF lt_1213 IS INITIAL.
89 ev_message = |No change requests found for BP { iv_bp }.|.
90 RETURN.
91 ENDIF.
92
93 SORT lt_1213 BY usmd_crequest.
94 DELETE ADJACENT DUPLICATES FROM lt_1213 COMPARING usmd_crequest.
95
96 SELECT * FROM usmd120c INTO TABLE @DATA(lt_120c)
97 FOR ALL ENTRIES IN @lt_1213
98 WHERE usmd_crequest = @lt_1213-usmd_crequest.
99
100 LOOP AT lt_120c INTO DATA(ls_120c).
101 DATA(ls_out) = VALUE ty_cr_list(
102 part_type = lv_part_type
103 partner = lv_bp_int
104 supplier = lv_vendor
105 customer = lv_customer
106 cr = ls_120c-usmd_crequest
107 cr_desc = ls_120c-usmd_creq_text ).
108
109 IF ls_120c-usmd_created_at IS NOT INITIAL.
110 DATA(lv_ts) = ls_120c-usmd_created_at.
111 ls_out-date = lv_ts(8).
112 ls_out-time = lv_ts+8(6).
113 ENDIF.
114
115 APPEND ls_out TO et_cr_list.
116 ENDLOOP.
117
118 SORT et_cr_list BY date DESCENDING time DESCENDING cr DESCENDING.
119 ENDMETHOD.
120ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I find all change requests linked to a Business Partner in MDG?
- How can I resolve a CR list by BP number using the BP technical key?
- How do I read USMD1213 links for BP change requests?
Possible questions
- How do I retrieve the BP number from a change request?
- Which Model-Ext API method returns the CR object list?
- How do I read BP_HEADER from a change request?
- How do I debug MDG derivation in SLG1?
- Which program can test derivation for a CR?