SAP MDG · VALIDATION DERIVATION

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

Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and method DERIVE_ENTITY to default non-key entity fields by changing CT_DATA rows in place, typically after key entry and only when the target field is initial.

Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and method DERIVE_ENTITY to default non-key entity fields by changing CT_DATA rows in place, typically after key entry and only when the target field is initial.

Use BAdI `USMD_RULE_SERVICE` with interface `IF_EX_USMD_RULE_SERVICE` when you want MDG to derive or default non-key entity fields after key entry. In `DERIVE_ENTITY`, you change `CT_DATA` in place, usually after checking `ID_ENTITYTYPE` and, if needed, CR context from `CL_USMD_APP_CONTEXT`. For derivation, return informational messages only; business errors belong in `CHECK_ENTITY`.

Process flow

  1. Open SE18 and display BAdI USMD_RULE_SERVICE.
  2. Confirm the interface is IF_EX_USMD_RULE_SERVICE and whether a filter is required.
  3. Create or open the implementation in SE19.
  4. Assign the Z class and activate it.
  5. Implement IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY.
  6. Gate the logic by ID_ENTITYTYPE.
  7. Loop over CT_DATA and default only initial target fields.
  8. Activate and test the MDG change request flow.
SE18

BAdI definition USMD_RULE_SERVICE

Validate the BAdI definition and confirm the interface and method intent before coding.

SE19

Classic BAdI implementation for USMD_RULE_SERVICE

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

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

Related questions and keywords

Alternative questions

  • How do I default non-key fields in an MDG entity after key entry?
  • What is the SAP MDG BAdI for entity derivation?
  • How do I implement USMD_RULE_SERVICE~DERIVE_ENTITY in ABAP?

Possible questions

  • Which BAdI and method are used for MDG entity derivation?
  • What is the difference between DERIVE_ENTITY and CHECK_ENTITY?
  • How do I register USMD_RULE_SERVICE in SE19?
  • Can DERIVE_ENTITY change key fields?
  • How do I read CR context in MDG derivation?
  • What is the recommended ABAP pattern for defaulting fields in CT_DATA?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICEDERIVE_ENTITYdefaultingderivationCT_DATACL_USMD_APP_CONTEXTSE18SE19