SAP MDG · VALIDATION DERIVATION
How do I implement a SAP MDG CHECK_ENTITY validation in USMD_RULE_SERVICE?
Implement the BAdI `USMD_RULE_SERVICE` in `SE19`, bind an ABAP class to `IF_EX_USMD_RULE_SERVICE`, and code `CHECK_ENTITY` to validate `it_data` and append `usmd_s_message` rows to `et_message` with `MSGID`, `MSGNO`, `MSGTY`, and `FIELDNAME`. The supplied example shows a simple entity gate for `BP_CENTRL` and a controlled warning message for pipeline verification.
Implement the BAdI `USMD_RULE_SERVICE` in `SE19`, bind an ABAP class to `IF_EX_USMD_RULE_SERVICE`, and code `CHECK_ENTITY` to validate `it_data` and append `usmd_s_message` rows to `et_message` with `MSGID`, `MSGNO`, `MSGTY`, and `FIELDNAME`. The supplied example shows a simple entity gate for `BP_CENTRL` and a controlled warning message for pipeline verification.
Implement `USMD_RULE_SERVICE` in `SE19`, assign an ABAP class that implements `IF_EX_USMD_RULE_SERVICE`, and code `CHECK_ENTITY` as a validation method that gates by `id_entitytype`, checks the generic `it_data`, and returns messages in `et_message` instead of raising hard errors. The source example uses entity `BP_CENTRL` and appends a warning message with `MSGID`, `MSGNO`, `MSGTY`, `FIELDNAME`, and `MSGV1` for controlled verification.
Process flow
- Open `SE18` and display BAdI definition `
USMD_RULE_SERVICE`. - Open `SE19` and create the BAdI implementation.
- Assign or create the implementing class with Z* naming.
- Implement `IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY` in the class.
- Gate logic by `id_entitytype` such as `BP_CENTRL` if only one entity should be checked.
- Loop or inspect `it_data` and evaluate the business condition.
- Fill `usmd_s_message` fields and append the row to `et_message`.
- Activate the class and BAdI implementation, then test the MDG scenario and debug the method call.
Referenced tables
| Object | Purpose |
|---|---|
usmd_s_message | Message structure used to return validation messages from `CHECK_ENTITY`. |
usmd_ts_message | Internal table type for validation messages returned in `et_message`. |
ILLUSTRATIVE ABAP SAMPLE
CHECK_ENTITY test skeleton pattern from the source
This is the exact message-append pattern shown in the retrieved sample. Replace the warning text and message values with your real validation logic for productive use.
1METHOD if_ex_usmd_rule_service~check_entity.
2 DATA ls_message TYPE usmd_s_message.
3
4 " Keep test-only message for controlled pipeline 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-fieldname = 'BP_CENTRL'.
10 ls_message-msgv1 = 'Test skeleton warning'.
11 APPEND ls_message TO et_message.
12 ENDIF.
13ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I create a BAdI validation for CHECK_ENTITY in SAP MDG?
- What is the ABAP pattern for IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
- How do I return validation messages from CHECK_ENTITY in MDG?
Possible questions
- How do I create a BAdI validation for CHECK_ENTITY in SAP MDG?
- What is the ABAP pattern for IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
- How do I return validation messages from CHECK_ENTITY in MDG?
- Which transaction codes are used to implement
USMD_RULE_SERVICE? - How do I add FIELDNAME and message text to ET_MESSAGE in CHECK_ENTITY?