SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG entity-level validation in BAdI USMD_RULE_SERVICE method CHECK_ENTITY?
Implement validations in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY by checking the application context and entity type, looping over IT_DATA, building USMD_S_MESSAGE entries with MSGID/MSGNO/MSGTY/FIELDNAME/MSGV1, appending them to ET_MESSAGE, and then optionally enriching row navigation and normalizing severity centrally.
Implement validations in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY by checking the application context and entity type, looping over IT_DATA, building USMD_S_MESSAGE entries with MSGID/MSGNO/MSGTY/FIELDNAME/MSGV1, appending them to ET_MESSAGE, and then optionally enriching row navigation and normalizing severity centrally.
Implement entity-level MDG validation in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY by gating on the application context and entity type, reading IT_DATA dynamically, and appending well-formed USMD_S_MESSAGE entries to ET_MESSAGE. The documented patterns show both direct append logic and an orchestrator style that collects local messages, enriches them for navigation, and normalizes severity afterward.
Process flow
- Open SE18 and inspect the BAdI definition
USMD_RULE_SERVICEand interface IF_EX_USMD_RULE_SERVICE. - Create or open the implementation in SE19 and assign the implementing class.
- Implement CHECK_ENTITY with guards for model, entity type, and application context.
- Loop over IT_DATA and check fields dynamically using ASSIGN COMPONENT.
- Build
USMD_S_MESSAGEentries with MSGID, MSGNO, MSGTY, FIELDNAME, and MSGV1. - Append messages to ET_MESSAGE, then enrich row navigation if needed.
- Call ADJUST_MESSAGES last to normalize severity based on control settings.
- Activate the class, BAdI implementation, and dependent message/customizing objects, then test the validation scenario.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_MSG_CTRL | Message-control table used by ADJUST_MESSAGES to rewrite message severity based on step, type, status, message id/number, and group. |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I write CHECK_ENTITY validation for SAP MDG?
- What is the implementation pattern for IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
- How do I return ET_MESSAGE correctly from an MDG validation BAdI?
Possible questions
- Which BAdI and method are used for SAP MDG entity validation?
- How should ET_MESSAGE be populated in CHECK_ENTITY?
- How do I add field-level navigation to MDG validation messages?
- How do I structure MDG validations to avoid a monolithic CHECK_ENTITY?
- What is the difference between direct append and delegated message collection in CHECK_ENTITY?