SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG Business Partner derivation logic for vendor general data, company code, address, purchasing org, and vendor class defaults in a custom class?

Implement the derivation as a delta-safe MDG rule service pattern: read changed BP data from the delta buffer, inspect the current model/context, derive only initial fields, and write back through the governance API or write buffer. In the provided pattern, ZCL_MDGBP_BP_DEFAULTS separates vendor general data, company code, address, purchasing org, and class derivation into dedicated methods and uses account group and CR type as the main control inputs.

Implement the derivation as a delta-safe MDG rule service pattern: read changed BP data from the delta buffer, inspect the current model/context, derive only initial fields, and write back through the governance API or write buffer. In the provided pattern, ZCL_MDGBP_BP_DEFAULTS separates vendor general data, company code, address, purchasing org, and class derivation into dedicated methods and uses account group and CR type as the main control inputs.

Use a rule-service derivation exit pattern: read from IF_USMD_DELTA_BUFFER_READ, inspect context via CL_USMD_APP_CONTEXT and IF_USMD_MODEL_EXT, derive only missing fields, and write the result back with IF_USMD_DELTA_BUFFER_WRITE or the governance conversion API.

In the provided ZCL_MDGBP_BP_DEFAULTS pattern, the derivation is split into focused methods for vendor general data, company code, address, purchasing org, and class defaults. The logic is controlled primarily by account group, BP classification, and change request type, and it avoids overwriting already-filled target fields.

Process flow

  1. Identify the derivation hook used in your MDG BP scenario.
  2. Read CR type and step from the application context.
  3. Read changed entities from IF_USMD_DELTA_BUFFER_READ.
  4. Inspect current BP data through IF_USMD_MODEL_EXT or the governance conversion API.
  5. Derive general data first, then company code, address, and purchasing org data.
  6. Populate only initial fields and keep the logic idempotent.
  7. Write derived data back through the MDG write API.
  8. Test domestic, intercompany, empty-field, and prefilled-field scenarios.

Referenced tables

ObjectPurpose
T001Company code country lookup used in company-code derivation.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1class ZCL_MDGBP_BP_DEFAULTS definition 2 public 3 final 4 create public . 5 6public section. 7 8 interfaces ZIF_TE_DERIVATION . 9 10 class-methods AUTO_DERIVE_COMPANY_CODE 11 importing 12 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 13 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 14 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 15 !I_IO_CRNUMBER type USMD_CREQUEST 16 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 17 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional 18 !I_IV_ACC_GRP type KTOKK optional . 19 class-methods DERIVE_VENDOR_GENERAL_DATA 20 importing 21 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 22 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 23 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 24 !I_IO_CRNUMBER type USMD_CREQUEST 25 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 26 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional 27 exporting 28 !E_KTOKK type KTOKK . 29 class-methods DERIVE_VENDOR_CLASS 30 importing 31 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 32 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 33 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 34 !I_IO_CRNUMBER type USMD_CREQUEST 35 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 36 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional . 37 class-methods DERIVE_VENDOR_PORG_ZTERM 38 importing 39 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 40 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 41 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 42 !I_IO_CRNUMBER type USMD_CREQUEST 43 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 44 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional . 45 class-methods DERIVE_VENDOR_PORG 46 importing 47 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 48 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 49 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 50 !I_IO_CRNUMBER type USMD_CREQUEST 51 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 52 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional . 53 class-methods AUTO_DERIVE_PORG 54 importing 55 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 56 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 57 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 58 !I_IO_CRNUMBER type USMD_CREQUEST 59 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 60 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional . 61 class-methods DERIVE_VENDOR_ADDRESS 62 importing 63 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 64 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 65 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 66 !I_IO_CRNUMBER type USMD_CREQUEST 67 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 68 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional . 69 class-methods DERIVE_VENDOR_ORG_DATA 70 importing 71 !I_IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ 72 !I_IO_WRITE_DATA type ref to IF_USMD_DELTA_BUFFER_WRITE 73 !I_IO_MODEL type ref to IF_USMD_MODEL_EXT 74 !I_IO_CRNUMBER type USMD_CREQUEST 75 !I_IT_CHANGED_ENTITIES type USMD_T_ENTITY optional 76 !I_IV_CR_TYPE type USMD_CREQUEST_TYPE optional 77 !IV_BU_GROUP type BU_GROUP optional . 78protected section. 79private section. 80ENDCLASS. 81 82 83 84CLASS ZCL_MDGBP_BP_DEFAULTS IMPLEMENTATION. 85 86 87 METHOD derive_vendor_general_data. 88 CONSTANTS : lc_ico TYPE begru VALUE 'ICO'. 89 FIELD-SYMBOLS: 90 <fs_bp_vengen> TYPE /mdgbpx/_s_bp_pp_bp_vengen, 91 <fs_bp_compny> TYPE any, 92 <fs_bu_partner> TYPE bu_partner, 93 <fs_t_tabl_data_all> TYPE ANY TABLE, 94 <fs_t_tabl_data> TYPE ANY TABLE, 95 <fs_tabl_data_all> TYPE any, 96 <fs_temp> TYPE any, 97 <fs_t_bp_vengen> TYPE ANY TABLE, 98 <fs_t_bp_compny> TYPE ANY TABLE, 99 <fs_t_vengen_chg> TYPE ANY TABLE, 100 <fs_vengen_ins> TYPE any, 101 <fs_t_company_chg> TYPE ANY TABLE, 102 <fs_t_bp_centrl> TYPE ANY TABLE, 103 <fs_t_centrl_chg> TYPE ANY TABLE, 104 <fs_bp_centrl> TYPE any, 105 <fs_t_bp_suppl> TYPE ANY TABLE, 106 <fs_t_suppl_chg> TYPE ANY TABLE, 107 <fs_bp_suppl> TYPE any, 108 <fs_compny_ins> TYPE any, 109 <fs_centrl_ins> TYPE any, 110 <fs_suppl_ins> TYPE any, 111 <fs_authgrp> TYPE any, 112 <fs_ktokk> TYPE any, 113 <fs_entity_insert_tbl> TYPE ANY TABLE, 114 <fs_t_bp_mlt_as_mod> TYPE ANY TABLE, 115 <fs_centrl_upd> TYPE any, 116 <fs_header_upd> TYPE any, 117 <fs_t_centrl_upd> TYPE ANY TABLE, 118 <fs_t_header_upd> TYPE ANY TABLE, 119 <fs_t_bp_header> TYPE ANY TABLE, 120 <fs_bp_header> TYPE any,

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

Related questions and keywords

Alternative questions

  • How do I build MDG BP defaulting logic for supplier creation and processing?
  • How is vendor data derived in ZCL_MDGBP_BP_DEFAULTS?
  • What is the implementation pattern for SAP MDG derivation using IF_USMD_DELTA_BUFFER_READ and IF_USMD_DELTA_BUFFER_WRITE?

Possible questions

  • How do I implement SAP MDG Business Partner derivation logic for vendor general data, company code, address, purchasing org, and vendor class defaults in a custom class?
  • Which methods should I use for MDG BP default derivation in a custom class?
  • How do I read changed data and write derived values in an MDG derivation exit?
  • How do I default company code fields such as reconciliation account, payment terms, sort key, and tolerance group in MDG BP?
  • How do I control derivation by account group and CR type in SAP MDG?

Keywords

SAP MDGBusiness Partnersupplier derivationvendor general datacompany code derivationpurchasing organizationaddress derivationIF_USMD_DELTA_BUFFER_READIF_USMD_DELTA_BUFFER_WRITEIF_USMD_MODEL_EXTCL_USMD_APP_CONTEXTUSMD_RULE_SERVICEDERIVE_ENTITYZCL_MDGBP_BP_DEFAULTS