SAP MDG · VALIDATION DERIVATION

How do I implement entity-level derivation in SAP MDG with BAdI USMD_RULE_SERVICE and method DERIVE_ENTITY?

Implement BAdI USMD_RULE_SERVICE, method IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY, and change ct_data in place for the target entity type. Use it for defaulting and deterministic derivations only; return informational messages if needed, and avoid business errors.

Implement BAdI USMD_RULE_SERVICE, method IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY, and change ct_data in place for the target entity type. Use it for defaulting and deterministic derivations only; return informational messages if needed, and avoid business errors.

Implement entity-level derivation in SAP MDG by using BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and method DERIVE_ENTITY. The method defaults or derives values by modifying CT_DATA rows in place, typically only when the target field is initial so you do not overwrite user input.

Process flow

  1. Open SE18 and display BAdI USMD_RULE_SERVICE to confirm interface IF_EX_USMD_RULE_SERVICE and the filter dependency.
  2. Create or open the implementation in SE19 and assign the correct data-model filter.
  3. Assign or create the implementing class and activate the class skeleton.
  4. Implement IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY and leave unused interface methods as RETURN.
  5. Inside DERIVE_ENTITY, CLEAR ET_MESSAGE, gate by ID_ENTITYTYPE, and loop over CT_DATA.
  6. Use ASSIGN COMPONENT to read and write the generic entity fields.
  7. Set derived values only when the target field is initial unless overwrite is intended.
  8. Use CL_USMD_APP_CONTEXT when derivation must depend on CR type or CR step; add only informational messages to ET_MESSAGE.
SE18

BAdI definition USMD_RULE_SERVICE

Display the BAdI definition and verify the interface IF_EX_USMD_RULE_SERVICE and filter dependency.

SE19

BAdI implementation for USMD_RULE_SERVICE

Create and maintain the BAdI implementation, assign the implementation class, and maintain the data-model filter.

Referenced tables

ObjectPurpose
USMD_S_MESSAGEMessage row structure used for derivation info messages.
USMD_TS_MESSAGEMessage table type returned in ET_MESSAGE.

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

Related questions and keywords

Alternative questions

  • How do I default fields in MDG using DERIVE_ENTITY?
  • What is the implementation pattern for USMD_RULE_SERVICE~DERIVE_ENTITY?
  • How do I set derived values in ct_data in SAP MDG?

Possible questions

  • How do I implement entity-level derivations in SAP MDG?
  • What is the difference between DERIVE_ENTITY and DERIVE?
  • How do I register USMD_RULE_SERVICE in SE19?
  • How do I derive a default value only when a field is initial?
  • How do I read CR context in a DERIVE_ENTITY implementation?

Keywords

USMD_RULE_SERVICEDERIVE_ENTITYIF_EX_USMD_RULE_SERVICEct_dataCL_USMD_APP_CONTEXTSE18SE19usmd_s_messageusmd1_cs_msgtyBRF+