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

  1. Open SE18 and inspect the BAdI definition USMD_RULE_SERVICE and interface IF_EX_USMD_RULE_SERVICE.
  2. Create or open the implementation in SE19 and assign the implementing class.
  3. Implement CHECK_ENTITY with guards for model, entity type, and application context.
  4. Loop over IT_DATA and check fields dynamically using ASSIGN COMPONENT.
  5. Build USMD_S_MESSAGE entries with MSGID, MSGNO, MSGTY, FIELDNAME, and MSGV1.
  6. Append messages to ET_MESSAGE, then enrich row navigation if needed.
  7. Call ADJUST_MESSAGES last to normalize severity based on control settings.
  8. Activate the class, BAdI implementation, and dependent message/customizing objects, then test the validation scenario.

Referenced tables

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

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYET_MESSAGEZCL_MDGBP_BP_VALIDATIONZCL_BP_COMPNY_DER_VALGET_MESSAGE_ROW_IDADJUST_MESSAGESfield navigationmessage normalization