SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG entity-level validation in BAdI USMD_RULE_SERVICE using CHECK_ENTITY?
Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and implement CHECK_ENTITY to validate one entity type at a time. Gate by id_entitytype, read the entity rows from it_data, and return business errors in et_message instead of raising MESSAGE type E.
Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and implement CHECK_ENTITY to validate one entity type at a time. Gate by id_entitytype, read the entity rows from it_data, and return business errors in et_message instead of raising MESSAGE type E.
Use BAdI USMD_RULE_SERVICE for MDG entity validation and put the logic in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY. The canonical pattern is: clear et_message, optionally gate by id_entitytype and CR context, loop over it_data, read fields dynamically with ASSIGN COMPONENT, apply the rule, and append usmd_s_message entries when a record fails.
Process flow
- Open SE18 and display BAdI
USMD_RULE_SERVICEto confirm interface IF_EX_USMD_RULE_SERVICE and whether filters are required. - Open SE19 and create the BAdI implementation for
USMD_RULE_SERVICE. - Assign or create the implementing class and ensure it implements IF_EX_USMD_RULE_SERVICE.
- Maintain the filter for the correct MDG data model, such as MM, BP, or 0G.
- Implement CHECK_ENTITY: clear et_message, gate by id_entitytype, read CR context if needed, loop over it_data, and validate fields dynamically.
- On validation failure, fill usmd_s_message and append it to et_message.
- Activate the class and BAdI implementation, then test the rule in the relevant MDG change-request scenario.
SE18BAdI definition USMD_RULE_SERVICE
Review the BAdI definition, interface IF_EX_USMD_RULE_SERVICE, and filter behavior before implementation.
SE19New BAdI Implementation -> Enhancement Spot / BAdI USMD_RULE_SERVICE
Create and activate the BAdI implementation and assign the implementing class.
Referenced tables
| Object | Purpose |
|---|---|
usmd_s_message / usmd_ts_message | Message structure and message table used to return validation errors to the MDG framework. |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I validate a single MDG entity in CHECK_ENTITY?
- Which BAdI method is used for MDG entity validations?
- How do I return validation errors from
USMD_RULE_SERVICE?
Possible questions
- How do I set up
USMD_RULE_SERVICEin SE19? - How do I read CR step in CHECK_ENTITY?
- How do I build ET_MESSAGE in MDG validation?
- How do I do a four-eye principle check in CHECK_ENTITY?
- How do I gate validation by entity type in MDG?