SAP MDG · VALIDATION DERIVATION

How do I implement a simple CHECK_ENTITY validation stub in SAP MDG using USMD_RULE_SERVICE?

Use `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` to return a controlled message in `ET_MESSAGE` for the target entity type. The source sample shows a minimal stub that raises a warning for `BP_CENTRL` by filling `MSGID`, `MSGNO`, `MSGTY`, and `MSGV1`, then appending `usmd_s_message` to `ET_MESSAGE`.

Use `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` to return a controlled message in `ET_MESSAGE` for the target entity type. The source sample shows a minimal stub that raises a warning for `BP_CENTRL` by filling `MSGID`, `MSGNO`, `MSGTY`, and `MSGV1`, then appending `usmd_s_message` to `ET_MESSAGE`.

This is a lightweight MDG `CHECK_ENTITY` stub pattern for branch verification. It shows how to raise one controlled warning only when the entity type is `BP_CENTRL`, so you can confirm that the BAdI is called and that `ET_MESSAGE` reaches the UI or workflow as expected. The implementation fills `USMD_S_MESSAGE` with `MSGID`, `MSGNO`, `MSGTY`, and `MSGV1`, then appends it to `ET_MESSAGE`.

Process flow

  1. Open SE18 and review the BAdI definition `USMD_RULE_SERVICE` and interface `IF_EX_USMD_RULE_SERVICE`.
  2. Create or open the implementation in SE19.
  3. Assign the implementing Z class and activate it.
  4. Implement `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY`.
  5. Guard the logic with `ID_ENTITYTYPE = 'BP_CENTRL'` or your target entity.
  6. Fill `USMD_S_MESSAGE` with `MSGID`, `MSGNO`, `MSGTY`, and message variables.
  7. Append the message to `ET_MESSAGE`.
  8. Activate the class and BAdI implementation and test the change request flow.

Referenced tables

ObjectPurpose
usmd_s_messageStructure used to construct and return validation messages in `ET_MESSAGE`.

ILLUSTRATIVE ABAP SAMPLE

Minimal CHECK_ENTITY test stub pattern

Source-supported lightweight stub that returns one controlled warning for entity `BP_CENTRL`.

1METHOD if_ex_usmd_rule_service~check_entity. 2 DATA ls_message TYPE usmd_s_message. 3 4 " Test-only pattern: controlled warning for branch verification. 5 IF id_entitytype = 'BP_CENTRL'. 6 ls_message-msgid = 'ZMDG_SUPPL'. 7 ls_message-msgno = '999'. 8 ls_message-msgty = 'W'. 9 ls_message-msgv1 = 'CHECK_ENTITY test stub'. 10 APPEND ls_message TO et_message. 11 ENDIF. 12ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I trigger a controlled warning from IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
  • How can I test the MDG validation flow with a BP_CENTRL entity check?
  • What is a minimal CHECK_ENTITY implementation for branch verification in MDG?

Possible questions

  • How do I create a BAdI implementation for USMD_RULE_SERVICE in SE18/SE19?
  • How do I add a warning message in CHECK_ENTITY for one entity type?
  • How do I validate BP_CENTRL records in MDG with ET_MESSAGE?
  • How do I debug whether CHECK_ENTITY is called for a specific entity?
  • How do I adapt the stub pattern into a productive validation class?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYET_MESSAGEusmd_s_messageBP_CENTRLSE18SE19BAdI implementationvalidation stub