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
- Open SE18 and display BAdI
USMD_RULE_SERVICEto confirm interface IF_EX_USMD_RULE_SERVICE and the filter dependency. - Create or open the implementation in SE19 and assign the correct data-model filter.
- Assign or create the implementing class and activate the class skeleton.
- Implement IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY and leave unused interface methods as RETURN.
- Inside DERIVE_ENTITY, CLEAR ET_MESSAGE, gate by ID_ENTITYTYPE, and loop over CT_DATA.
- Use ASSIGN COMPONENT to read and write the generic entity fields.
- Set derived values only when the target field is initial unless overwrite is intended.
- Use CL_USMD_APP_CONTEXT when derivation must depend on CR type or CR step; add only informational messages to ET_MESSAGE.
SE18BAdI definition USMD_RULE_SERVICE
Display the BAdI definition and verify the interface IF_EX_USMD_RULE_SERVICE and filter dependency.
SE19BAdI implementation for USMD_RULE_SERVICE
Create and maintain the BAdI implementation, assign the implementation class, and maintain the data-model filter.
Referenced tables
| Object | Purpose |
|---|---|
USMD_S_MESSAGE | Message row structure used for derivation info messages. |
USMD_TS_MESSAGE | Message 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_SERVICEin 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?