SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG entity validation in USMD_RULE_SERVICE CHECK_ENTITY with dynamic field checks and message row?
Implement the BAdI `USMD_RULE_SERVICE` in `SE18`/`SE19`, put validation logic in `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY`, read the MDG application context first, check the current entity records with dynamic field access, append `usmd_s_message` entries to `ET_MESSAGE`, and then map message rows for UI navigation. Use a thin orchestrator class, delegate complex rules to helper methods, and optionally normalize message severity after checks.
Implement the BAdI `USMD_RULE_SERVICE` in `SE18`/`SE19`, put validation logic in `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY`, read the MDG application context first, check the current entity records with dynamic field access, append `usmd_s_message` entries to `ET_MESSAGE`, and then map message rows for UI navigation. Use a thin orchestrator class, delegate complex rules to helper methods, and optionally normalize message severity after checks.
Implement SAP MDG entity validation in `USMD_RULE_SERVICE` by creating the BAdI in `SE18` and `SE19`, then coding `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` to read the application context, loop through `IT_DATA`, check fields dynamically with `ASSIGN COMPONENT`, and append `usmd_s_message` rows to `ET_MESSAGE`. For better UI behavior, set `FIELDNAME` and map the message to the affected row after validation. A thin orchestrator pattern is preferred when several rules or step-specific branches are involved.
Process flow
- Open `SE18` and display the BAdI definition `
USMD_RULE_SERVICE`. - Open `SE19` and create the BAdI implementation with a Z* name.
- Assign the implementing class and activate the class skeleton.
- Implement `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` for entity-level checks.
- Read `CL_USMD_APP_CONTEXT` first and gate by model, CR type, step, process, and entity type.
- Loop over `IT_DATA`, use dynamic `ASSIGN COMPONENT`, and build `usmd_s_message` entries.
- Append the messages to `ET_MESSAGE` and map row IDs for navigation if required.
- Activate the implementation and test the workflow step that should trigger it.
Referenced tables
| Object | Purpose |
|---|---|
usmd_s_message | Validation message structure returned in `ET_MESSAGE`. |
usmd1_cs_msgty | Message-type constants used for severity handling. |
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 for SAP MDG business partner or supplier data?
- How do I implement entity-level validation in IF_EX_USMD_RULE_SERVICE?
- How do I add mandatory-field checks and UI navigation in MDG CHECK_ENTITY?
Possible questions
- What is the SAP MDG BAdI for entity validation?
- How do I implement CHECK_ENTITY for dynamic entity validation?
- How do I map validation messages to the correct field row in MDG?
- How do I structure a multi-step MDG validation class?
- How do I implement the BAdI from SE18 and SE19?