SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG entity validation in USMD_RULE_SERVICE~CHECK_ENTITY?
Implement USMD_RULE_SERVICE in SE18/SE19, assign a Z class that implements IF_EX_USMD_RULE_SERVICE, and code CHECK_ENTITY to guard by model/context, loop IT_DATA dynamically, build USMD_S_MESSAGE rows, and append findings to ET_MESSAGE. Use FIELDNAME and MSGV1..MSGV4 for UI navigation, and optionally enrich or normalize messages centrally.
Implement USMD_RULE_SERVICE in SE18/SE19, assign a Z class that implements IF_EX_USMD_RULE_SERVICE, and code CHECK_ENTITY to guard by model/context, loop IT_DATA dynamically, build USMD_S_MESSAGE rows, and append findings to ET_MESSAGE. Use FIELDNAME and MSGV1..MSGV4 for UI navigation, and optionally enrich or normalize messages centrally.
Implement `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` in the BAdI `USMD_RULE_SERVICE` to validate the current entity payload in MDG. The standard pattern is: read application context, guard by model/entity type, loop through `IT_DATA`, check the required fields or cross-entity rules, then return all findings in `ET_MESSAGE` as `USMD_S_MESSAGE` rows with proper message IDs, numbers, types, and field navigation metadata.
Process flow
- Open SE18 and display BAdI definition `
USMD_RULE_SERVICE`. - Confirm interface `IF_EX_USMD_RULE_SERVICE` and whether the BAdI is filter-dependent.
- Open SE19 and create a BAdI implementation with a Z* name.
- Assign or create the implementing class and implement `IF_EX_USMD_RULE_SERVICE`.
- Code `CHECK_ENTITY` with context guard, model guard, and entity-type routing.
- Validate `IT_DATA` dynamically and append `
USMD_S_MESSAGE` rows to `ET_MESSAGE`. - Optionally enrich message navigation and adjust severities centrally.
- Activate the class and BAdI implementation, then test the MDG scenario.
Referenced tables
| Object | Purpose |
|---|---|
USMD_S_MESSAGE | Message structure used to return validation findings from `CHECK_ENTITY`. |
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 build a CHECK_ENTITY validation in SAP MDG?
- What is the implementation pattern for IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
- How do I add entity-level validations in MDG using
USMD_RULE_SERVICE?
Possible questions
- How do I implement mandatory field checks in CHECK_ENTITY?
- How do I do cross-entity validation in
USMD_RULE_SERVICE~CHECK_ENTITY? - How do I create navigation-ready error messages in MDG validations?
- How do I structure CHECK_ENTITY as an orchestrator in SAP MDG?
- Which parameters are used in CHECK_ENTITY?