SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG entity derivation in `USMD_RULE_SERVICE~DERIVE_ENTITY` with safe defaulting and debugging?

Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` as deterministic defaulting/enrichment only: read the CR context once, gate by `ID_ENTITYTYPE`, loop through `CT_DATA`, and fill only initial target fields. Use a BAdI implementation created in SE18/SE19, keep derivation logic separate from validation, and debug at method entry by checking `ID_ENTITYTYPE`, `CT_DATA`, and the CR context.

Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` as deterministic defaulting/enrichment only: read the CR context once, gate by `ID_ENTITYTYPE`, loop through `CT_DATA`, and fill only initial target fields. Use a BAdI implementation created in SE18/SE19, keep derivation logic separate from validation, and debug at method entry by checking `ID_ENTITYTYPE`, `CT_DATA`, and the CR context.

Implement `USMD_RULE_SERVICE` in `SE18`/`SE19`, assign the implementing class, and code `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` as deterministic enrichment only. The recommended pattern is to read the change-request context once, route by `ID_ENTITYTYPE`, loop over `CT_DATA`, and default only empty fields so user-entered values are preserved.

Process flow

  1. Open `SE18` and display BAdI definition `USMD_RULE_SERVICE`.
  2. Check the interface name `IF_EX_USMD_RULE_SERVICE` and confirm whether the definition is filter-dependent.
  3. Open `SE19` and create the BAdI implementation with a Z* name, package, and transport.
  4. Assign or create the implementing class and ensure `IF_EX_USMD_RULE_SERVICE` is implemented.
  5. Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` with entity gating and safe defaulting.
  6. Activate the class, then activate the BAdI implementation.
  7. Trigger the MDG scenario and debug the method entry to verify `ID_ENTITYTYPE`, `CT_DATA`, and CR context values.

Referenced tables

ObjectPurpose
USMD_RULE_SERVICEBAdI definition used for MDG rule-service derivation and validation.
USMD_S_MESSAGEMessage structure used when derivation logic needs to return informational or technical messages.

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

Related questions and keywords

Alternative questions

  • How do I build a `DERIVE_ENTITY` BAdI for MDG without overwriting user data?
  • What is the implementation pattern for `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` in SAP MDG?
  • How do I debug and activate MDG derivation logic in `USMD_RULE_SERVICE`?

Possible questions

  • How do I implement SAP MDG entity derivation in `USMD_RULE_SERVICE~DERIVE_ENTITY`?
  • How do I default fields in MDG using BAdI `USMD_RULE_SERVICE`?
  • How do I debug `DERIVE_ENTITY` when the target field is not populated?
  • How do I create the BAdI implementation from SE18/SE19?
  • How do I avoid dynamic assign dumps in MDG derivation?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICEDERIVE_ENTITYSE18SE19defaultingderivationCT_DATAID_ENTITYTYPEdynamic assignBP derivation