SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG entity-level validation in BAdI USMD_RULE_SERVICE using CHECK_ENTITY?

Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and implement CHECK_ENTITY to validate one entity type at a time. Gate by id_entitytype, read the entity rows from it_data, and return business errors in et_message instead of raising MESSAGE type E.

Use BAdI USMD_RULE_SERVICE with interface IF_EX_USMD_RULE_SERVICE and implement CHECK_ENTITY to validate one entity type at a time. Gate by id_entitytype, read the entity rows from it_data, and return business errors in et_message instead of raising MESSAGE type E.

Use BAdI USMD_RULE_SERVICE for MDG entity validation and put the logic in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY. The canonical pattern is: clear et_message, optionally gate by id_entitytype and CR context, loop over it_data, read fields dynamically with ASSIGN COMPONENT, apply the rule, and append usmd_s_message entries when a record fails.

Process flow

  1. Open SE18 and display BAdI USMD_RULE_SERVICE to confirm interface IF_EX_USMD_RULE_SERVICE and whether filters are required.
  2. Open SE19 and create the BAdI implementation for USMD_RULE_SERVICE.
  3. Assign or create the implementing class and ensure it implements IF_EX_USMD_RULE_SERVICE.
  4. Maintain the filter for the correct MDG data model, such as MM, BP, or 0G.
  5. Implement CHECK_ENTITY: clear et_message, gate by id_entitytype, read CR context if needed, loop over it_data, and validate fields dynamically.
  6. On validation failure, fill usmd_s_message and append it to et_message.
  7. Activate the class and BAdI implementation, then test the rule in the relevant MDG change-request scenario.
SE18

BAdI definition USMD_RULE_SERVICE

Review the BAdI definition, interface IF_EX_USMD_RULE_SERVICE, and filter behavior before implementation.

SE19

New BAdI Implementation -> Enhancement Spot / BAdI USMD_RULE_SERVICE

Create and activate the BAdI implementation and assign the implementing class.

Referenced tables

ObjectPurpose
usmd_s_message / usmd_ts_messageMessage structure and message table used to return validation errors to the MDG framework.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How do I validate a single MDG entity in CHECK_ENTITY?
  • Which BAdI method is used for MDG entity validations?
  • How do I return validation errors from USMD_RULE_SERVICE?

Possible questions

  • How do I set up USMD_RULE_SERVICE in SE19?
  • How do I read CR step in CHECK_ENTITY?
  • How do I build ET_MESSAGE in MDG validation?
  • How do I do a four-eye principle check in CHECK_ENTITY?
  • How do I gate validation by entity type in MDG?

Keywords

USMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYMDG validationET_MESSAGECL_USMD_APP_CONTEXTusmd_s_messageid_entitytypeSE18SE19