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

  1. Open SE18 and review the BAdI definition and interface.
  2. Create the BAdI implementation in SE19.
  3. Assign or create the implementing Z* class and implement IF_EX_USMD_RULE_SERVICE.
  4. Add entity and CR/process guards in CHECK_ENTITY.
  5. Build messages with MSGID, MSGNO, MSGTY, FIELDNAME, and MSGV1.
  6. Append collected messages to ET_MESSAGE once per block.
  7. Call ZCL_MDG_SUPPL_UTILITY=>GET_MESSAGE_ROW_ID for navigation enrichment.
  8. Call ZCL_MDGBP_BP_VALIDATION=>ADJUST_MESSAGES to normalize severity.

Referenced tables

ObjectPurpose
ZMDG_MSG_CTRLMessage-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?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYET_MESSAGEFIELDNAMEMSGV1GET_MESSAGE_ROW_IDADJUST_MESSAGESZCL_MDGBP_BP_VALIDATIONZCL_BP_COMPNY_DER_VAL