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
- Open `SE18` and display BAdI definition `
USMD_RULE_SERVICE`. - Check the interface name `IF_EX_USMD_RULE_SERVICE` and confirm whether the definition is filter-dependent.
- Open `SE19` and create the BAdI implementation with a Z* name, package, and transport.
- Assign or create the implementing class and ensure `IF_EX_USMD_RULE_SERVICE` is implemented.
- Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` with entity gating and safe defaulting.
- Activate the class, then activate the BAdI implementation.
- Trigger the MDG scenario and debug the method entry to verify `ID_ENTITYTYPE`, `CT_DATA`, and CR context values.
Referenced tables
| Object | Purpose |
|---|---|
USMD_RULE_SERVICE | BAdI definition used for MDG rule-service derivation and validation. |
USMD_S_MESSAGE | Message 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?