SAP MDG · VALIDATION DERIVATION
How do I implement an SAP MDG USMD_RULE_SERVICE CHECK_ENTITY validation with message navigation and severity adjustment?
Implement CHECK_ENTITY as a collect-enrich-merge-normalize flow: validate the entity records, set FIELDNAME and MSGV1 for navigation, append messages to ET_MESSAGE, then run GET_MESSAGE_ROW_ID and ADJUST_MESSAGES for row mapping and severity harmonization.
Implement CHECK_ENTITY as a collect-enrich-merge-normalize flow: validate the entity records, set FIELDNAME and MSGV1 for navigation, append messages to ET_MESSAGE, then run GET_MESSAGE_ROW_ID and ADJUST_MESSAGES for row mapping and severity harmonization.
In SAP MDG, the recommended CHECK_ENTITY pattern is to keep the method orchestration-focused: validate the current entity records, build messages with FIELDNAME and key context in MSGV1, append them to ET_MESSAGE, and then post-process them with navigation enrichment and severity normalization. The retrieved implementation examples show both a direct validation style and an orchestrator style that delegates to rule methods such as `ZCL_MDGBP_CUST_VALIDATION=>VALIDATE_CUSTOMER`, `ZCL_MDGBP_CUST_VALIDATION=>VALIDATE_CUP5`, and `ZCL_BP_VALIDATION_RULE=>...` methods like `V_BP_CENTRL`, `V_AD_POSTAL`, `V_COM_CODE`, `V_BP_IDNUM`, and `V_FS_BP001`.
Process flow
- Open SE18 and review the BAdI definition and interface.
- Create the BAdI implementation in SE19.
- Assign or create the implementing Z* class and implement IF_EX_USMD_RULE_SERVICE.
- Add entity and CR/process guards in CHECK_ENTITY.
- Build messages with MSGID, MSGNO, MSGTY, FIELDNAME, and MSGV1.
- Append collected messages to ET_MESSAGE once per block.
- Call ZCL_MDG_SUPPL_UTILITY=>GET_MESSAGE_ROW_ID for navigation enrichment.
- Call ZCL_MDGBP_BP_VALIDATION=>ADJUST_MESSAGES to normalize severity.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_MSG_CTRL | Message-control table used by ADJUST_MESSAGES to rewrite message type and remove initial-type messages |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How should I structure CHECK_ENTITY in SAP MDG for entity validations?
- How do I populate ET_MESSAGE correctly in MDG CHECK_ENTITY?
- How do I add navigation-friendly validation messages in
USMD_RULE_SERVICE?
Possible questions
- What is the recommended pattern for CHECK_ENTITY in SAP MDG?
- How do I enrich validation messages with FIELDNAME and MSGV1?
- How do I use GET_MESSAGE_ROW_ID and ADJUST_MESSAGES in MDG validations?
- How should an orchestrator class delegate validation rules in CHECK_ENTITY?
- How do I implement direct entity validation versus delegated validation in MDG?