SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG validation in IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_HIERARCHY?

Implement the BAdI `USMD_RULE_SERVICE` in SE18/SE19, bind an implementation class to `IF_EX_USMD_RULE_SERVICE`, and move the real edition-hierarchy checks into `CHECK_EDITION_HIERARCHY` only when your MDG scenario actually requires hierarchy-level validation. If the method is just a compatibility hook, it can remain empty; otherwise, build the check so it returns messages via `ET_MESSAGE` with proper `MSGID`, `MSGNO`, `MSGTY`, and `FIELDNAME`.

Implement the BAdI `USMD_RULE_SERVICE` in SE18/SE19, bind an implementation class to `IF_EX_USMD_RULE_SERVICE`, and move the real edition-hierarchy checks into `CHECK_EDITION_HIERARCHY` only when your MDG scenario actually requires hierarchy-level validation. If the method is just a compatibility hook, it can remain empty; otherwise, build the check so it returns messages via `ET_MESSAGE` with proper `MSGID`, `MSGNO`, `MSGTY`, and `FIELDNAME`.

Implementing `CHECK_EDITION_HIERARCHY` in SAP MDG follows the standard BAdI flow: confirm the definition in SE18, create the implementation in SE19, assign an implementing class, and then add the actual hierarchy validation logic in `IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_HIERARCHY`. The method is called for edition-based hierarchy checks, so if your business rule needs to block inconsistent hierarchy data, return the error or warning in `ET_MESSAGE` with complete message details.

Process flow

  1. Open SE18 and display `USMD_RULE_SERVICE` to confirm the interface and method intent.
  2. Open SE19 and create the BAdI implementation with a Z* name, package, and transport request.
  3. Assign or create the implementing class and ensure it implements `IF_EX_USMD_RULE_SERVICE`.
  4. Implement `IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_HIERARCHY` with your edition-hierarchy rule.
  5. Construct `usmd_s_message` entries with `MSGID`, `MSGNO`, `MSGTY`, and `FIELDNAME`, then append them to `ET_MESSAGE`.
  6. Activate the class and BAdI implementation.
  7. Test the MDG scenario that triggers edition hierarchy processing and verify the method is called and the message appears in the UI.

Referenced tables

ObjectPurpose
usmd_s_messageMessage structure used to return validation results through `ET_MESSAGE`.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP implementation example

Concrete CHECK_ENTITY implementation pattern from the same knowledge document set.

1METHOD if_ex_usmd_rule_service~check_entity. 2 DATA: lo_app_context TYPE REF TO if_usmd_app_context, 3 lt_message TYPE usmd_t_message, 4 ls_message TYPE usmd_s_message, 5 lv_crtype TYPE usmd_crequest_type, 6 lv_crstep TYPE usmd_crequest_appstep, 7 lv_crid TYPE usmd_crequest. 8 9 FIELD-SYMBOLS: <ls_data> TYPE any, 10 <lv_value> TYPE any. 11 12 lo_app_context = cl_usmd_app_context=>get_context( ). 13 CHECK lo_app_context IS BOUND. 14 CHECK io_model->d_usmd_model = 'BP'. 15 16 lo_app_context->get_attributes( 17 IMPORTING 18 ev_crequest_type = lv_crtype 19 ev_crequest_step = lv_crstep 20 ev_crequest_id = lv_crid ). 21 22 CHECK it_data IS NOT INITIAL. 23 24 LOOP AT it_data ASSIGNING <ls_data>. 25 ASSIGN COMPONENT 'SOME_MAND_FIELD' OF STRUCTURE <ls_data> TO <lv_value>. 26 IF <lv_value> IS ASSIGNED AND <lv_value> IS INITIAL. 27 CLEAR ls_message. 28 ls_message-msgid = 'ZMDG_SUPPL'. 29 ls_message-msgno = '001'. 30 ls_message-msgty = 'E'. 31 ls_message-fieldname = 'SOME_MAND_FIELD'. 32 APPEND ls_message TO et_message. 33 ENDIF. 34 ENDLOOP. 35 36 IF et_message IS NOT INITIAL. 37 zcl_mdgbp_bp_validation=>adjust_messages( 38 EXPORTING 39 cr_number = lv_crid 40 CHANGING 41 ct_message = et_message ). 42 ENDIF. 43ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I replace an empty CHECK_EDITION_HIERARCHY stub with real MDG validation logic?
  • How do I create a BAdI implementation for USMD_RULE_SERVICE edition hierarchy checks?
  • What is the step-by-step process to implement CHECK_EDITION_HIERARCHY in SAP MDG?

Possible questions

  • How do I implement SAP MDG validation in IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_HIERARCHY?
  • How do I replace an empty CHECK_EDITION_HIERARCHY stub with real MDG validation logic?
  • How do I create a BAdI implementation for USMD_RULE_SERVICE edition hierarchy checks?
  • What is the step-by-step process to implement CHECK_EDITION_HIERARCHY in SAP MDG?
  • Which transaction codes are used to implement USMD_RULE_SERVICE?
  • What message structure should I use in CHECK_EDITION_HIERARCHY?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_EDITION_HIERARCHYSE18SE19ET_MESSAGEusmd_s_messagevalidationBAdI implementation