SAP MDG · VALIDATION DERIVATION

How do I implement vendor general data derivation from Business Partner change data in SAP MDG?

Implement the derivation in a BP-based MDG exit that reads changed entity data, checks the current BP context, and writes back defaults only when target fields are initial. The documented pattern derives vendor general data from BP_VENGEN, BP_COMPNY, BP_CENTRL, BP_HEADER, and ZBP_SUPPL using IF_USMD_CONV_SOM_GOV_API and change-buffer reads.

Implement the derivation in a BP-based MDG exit that reads changed entity data, checks the current BP context, and writes back defaults only when target fields are initial. The documented pattern derives vendor general data from BP_VENGEN, BP_COMPNY, BP_CENTRL, BP_HEADER, and ZBP_SUPPL using IF_USMD_CONV_SOM_GOV_API and change-buffer reads.

This vendor derivation pattern reads BP change data and updates related vendor entities in place. It uses the MDG governance API to inspect BP_VENGEN, BP_COMPNY, BP_CENTRL, BP_HEADER, and ZBP_SUPPL, derives defaults only when fields are still initial, and writes the modified entity data back to the change request.

Process flow

  1. Open the relevant MDG BP derivation implementation in SE19 or the custom class that contains DERIVE_VENDOR_GENERAL_DATA.
  2. Confirm the BP model is the active model for the rule-service derivation path.
  3. Read the changed entity list with I_IO_CHANGED_DATA->GET_ENTITY_TYPES( ).
  4. Read inserted and updated rows for each target entity using I_IO_CHANGED_DATA->READ_DATA( ).
  5. Check account group values before overwriting any field.
  6. Fill only initial target fields such as REF_VENGE, BEGRU_B, ALTKN, BPKIND, BU_SORT1, and ZCOMCODE.
  7. Insert the changed rows back into the entity tables.
  8. Write the entity data back through IF_USMD_CONV_SOM_GOV_API->WRITE_ENTITY_DATA( ).

Referenced tables

ObjectPurpose
ZIF_BP_CONSTANTS=>ENTITY_TYPEEntity-type constants used to identify BP_VENGEN, BP_COMPNY, BP_CENTRL, BP_HEADER, and ZBP_SUPPL.
ZIF_BP_CONSTANTS=>KTOKKAccount-group constants used in derivation conditions such as Z010, Z002, V010, V002, VD10, and VD02.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1* Purpose: Derive vendor general data and account group defaults from BP change data. 2 3 METHOD derive_vendor_general_data. 4 CONSTANTS : lc_ico TYPE begru VALUE 'ICO'. 5 FIELD-SYMBOLS: 6 <fs_bp_vengen> TYPE /mdgbpx/_s_bp_pp_bp_vengen, 7 <fs_bp_compny> TYPE any, 8 <fs_bu_partner> TYPE bu_partner, 9 <fs_t_tabl_data_all> TYPE ANY TABLE, 10 <fs_t_tabl_data> TYPE ANY TABLE, 11 <fs_tabl_data_all> TYPE any, 12 <fs_temp> TYPE any, 13 <fs_t_bp_vengen> TYPE ANY TABLE, 14 <fs_t_bp_compny> TYPE ANY TABLE, 15 <fs_t_vengen_chg> TYPE ANY TABLE, 16 <fs_vengen_ins> TYPE any, 17 <fs_t_company_chg> TYPE ANY TABLE, 18 <fs_t_bp_centrl> TYPE ANY TABLE, 19 <fs_t_centrl_chg> TYPE ANY TABLE, 20 <fs_bp_centrl> TYPE any, 21 <fs_t_bp_suppl> TYPE ANY TABLE, 22 <fs_t_suppl_chg> TYPE ANY TABLE, 23 <fs_bp_suppl> TYPE any, 24 <fs_compny_ins> TYPE any, 25 <fs_centrl_ins> TYPE any, 26 <fs_suppl_ins> TYPE any, 27 <fs_authgrp> TYPE any, 28 <fs_ktokk> TYPE any, 29 <fs_entity_insert_tbl> TYPE ANY TABLE, 30 <fs_t_bp_mlt_as_mod> TYPE ANY TABLE, 31 <fs_centrl_upd> TYPE any, 32 <fs_header_upd> TYPE any, 33 <fs_t_centrl_upd> TYPE ANY TABLE, 34 <fs_t_header_upd> TYPE ANY TABLE, 35 <fs_t_bp_header> TYPE ANY TABLE, 36 <fs_bp_header> TYPE any, 37 <fs_t_vengen> TYPE ANY TABLE, 38 <fs_t_data_all_bp_vengen> TYPE ANY TABLE. 39 DATA : lv_exist TYPE boolean, 40 lv_buffer TYPE xstring, 41 lv_comcode TYPE matkl, 42 lt_changed_entities TYPE usmd_t_entity, 43 ls_bp_vengen TYPE REF TO data, 44 lt_bp_vengen TYPE REF TO data, 45 ls_bp_compny TYPE REF TO data, 46 lt_bp_compny TYPE REF TO data, 47 lr_suppl_ins TYPE REF TO data, 48 ls_bp_suppl TYPE REF TO data, 49 lt_bp_suppl TYPE REF TO data, 50 lr_vengen_ins TYPE REF TO data, 51 lr_compny_ins TYPE REF TO data, 52 lr_centrl_ins TYPE REF TO data, 53 lr_centrl_upd TYPE REF TO data, 54 ls_bp_centrl TYPE REF TO data, 55 lt_bp_centrl TYPE REF TO data, 56 wa_changed_entities LIKE LINE OF lt_changed_entities, 57 lo_conv_gov_api TYPE REF TO if_usmd_conv_som_gov_api, 58 lt_entity_data TYPE usmd_gov_api_ts_ent_data, 59 wa_entity_data TYPE usmd_gov_api_s_ent_data, 60 lx_error TYPE REF TO cx_root, 61 lv_chg_flag TYPE boolean, 62 lv_flag TYPE boolean, 63 ls_bp_header TYPE REF TO data, 64 lt_bp_header TYPE REF TO data, 65 lo_app_context TYPE REF TO if_usmd_app_context, 66 lo_singleton TYPE REF TO zcl_mdg_singleton, 67 lt_entities TYPE usmd_t_crequest_entity. 68 lo_app_context = cl_usmd_app_context=>get_context( ). 69 i_io_changed_data->get_entity_types( 70 IMPORTING 71 et_entity = lt_changed_entities ). 72 73 TRY. 74 CALL METHOD cl_usmd_conv_som_gov_api=>get_instance 75 EXPORTING 76 iv_model_name = 'BP' 77 RECEIVING 78 ro_so_gov_api = lo_conv_gov_api. 79 CATCH cx_usmd_gov_api . 80 ENDTRY. 81 82 CHECK lo_conv_gov_api IS BOUND. 83 84 READ TABLE lt_changed_entities 85 TRANSPORTING NO FIELDS 86 WITH KEY table_line = zif_bp_constants=>entity_type-bp_mlt_as. 87 IF sy-subrc EQ 0. 88 i_io_changed_data->read_data( 89 EXPORTING 90 i_entity = zif_bp_constants=>entity_type-bp_mlt_as " Entity Type 91 IMPORTING 92 er_t_data_mod = DATA(lr_bp_mlt_as_mod) 93 ). 94 95 ASSIGN lr_bp_mlt_as_mod->* TO <fs_t_bp_mlt_as_mod>. 96 97 "Get Conv API Instance 98 CALL METHOD cl_usmd_conv_som_gov_api=>check_instance_exists 99 EXPORTING 100 iv_model_name = 'BP' 101 RECEIVING 102 rv_exists = lv_exist. 103 ENDIF. 104 105************************* 106 FIELD-SYMBOLS: <fs_t_data_bp_centrl> TYPE SORTED TABLE, 107 <fs_value> TYPE any. 108 DATA: lv_acc_grp_changed TYPE boolean, 109 lv_zzktokk TYPE ktokk. 110 i_io_changed_data->read_data( 111 EXPORTING 112 i_entity = 'BP_CENTRL' 113 i_struct = if_usmd_model_ext=>gc_struct_key_attr " Type of Data Structure 114 IMPORTING 115 er_t_data_mod = DATA(lo_data_mod_bp_centrl) 116 ). 117 ASSIGN lo_data_mod_bp_centrl->* TO <fs_t_data_bp_centrl>. 118 IF <fs_t_data_bp_centrl> IS ASSIGNED. 119 LOOP AT <fs_t_data_bp_centrl> ASSIGNING FIELD-SYMBOL(<fs_s_data_bp_centrl1>). 120 ASSIGN COMPONENT 'USMDX_S_UPDATE' OF STRUCTURE <fs_s_data_bp_centrl1> TO <fs_value>.

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

Related questions and keywords

Alternative questions

  • How can I default vendor general data from BP data in MDG?
  • How do I derive account group and authorization group values for vendor general data?
  • How do I write a DERIVE_ENTITY-style enhancement for vendor general data in MDG?

Possible questions

  • What is the ABAP pattern for deriving vendor general data from BP change requests?
  • Which MDG entities are updated when BP data changes?
  • How do I default KTOKK, BEGRU, ALTKN, BPKIND, and search term values in vendor derivation?
  • How do I use IF_USMD_CONV_SOM_GOV_API in a vendor derivation exit?
  • What changes when the CR type is ZSUPINT1?

Keywords

SAP MDGBusiness PartnerVendor General DataBP_VENGENBP_COMPNYBP_CENTRLZBP_SUPPLaccount groupKTOKKBEGRUALTKNBPKINDBU_SORT1IF_USMD_CONV_SOM_GOV_APIwrite_entity_dataderive_entitydefaulting