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

  1. Open SE18 and display BAdI definition `USMD_RULE_SERVICE`.
  2. Confirm interface `IF_EX_USMD_RULE_SERVICE` and whether the BAdI is filter-dependent.
  3. Open SE19 and create a BAdI implementation with a Z* name.
  4. Assign or create the implementing class and implement `IF_EX_USMD_RULE_SERVICE`.
  5. Code `CHECK_ENTITY` with context guard, model guard, and entity-type routing.
  6. Validate `IT_DATA` dynamically and append `USMD_S_MESSAGE` rows to `ET_MESSAGE`.
  7. Optionally enrich message navigation and adjust severities centrally.
  8. Activate the class and BAdI implementation, then test the MDG scenario.

Referenced tables

ObjectPurpose
USMD_S_MESSAGEMessage structure used to return validation findings from `CHECK_ENTITY`.
USMD_TS_MESSAGEMessage 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?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYET_MESSAGEIO_MODELID_ENTITYTYPEIT_DATACL_USMD_APP_CONTEXTUSMD_S_MESSAGEmandatory field checkcross-entity validationmessage navigationBAdI implementation