SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG BAdI USMD_RULE_SERVICE method CHECK_CREQUEST_HIERARCHY for change request hierarchy validation?

Create the BAdI implementation in SE19, assign an ABAP class that implements IF_EX_USMD_RULE_SERVICE, and place your hierarchy validation in the relevant rule-service method. In the provided source, CHECK_CREQUEST_HIERARCHY is intentionally empty and kept only as a compatibility hook.

Create the BAdI implementation in SE19, assign an ABAP class that implements IF_EX_USMD_RULE_SERVICE, and place your hierarchy validation in the relevant rule-service method. In the provided source, CHECK_CREQUEST_HIERARCHY is intentionally empty and kept only as a compatibility hook.

Create the BAdI implementation in SE19 after checking USMD_RULE_SERVICE in SE18, then assign an implementing class that uses IF_EX_USMD_RULE_SERVICE. The provided class keeps IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_HIERARCHY empty as a retained framework hook, so you can add CR-hierarchy validation there when your business rule requires it.

Process flow

  1. Open SE18 and display BAdI definition USMD_RULE_SERVICE.
  2. Check interface IF_EX_USMD_RULE_SERVICE, multiple-use/single-use, and filter dependency.
  3. Open SE19 and create the BAdI implementation.
  4. Assign implementation name, short description, package, and transport request.
  5. Maintain filters if the implementation is filter-dependent.
  6. Create or assign the implementing class and implement IF_EX_USMD_RULE_SERVICE.
  7. Place hierarchy validation in CHECK_CREQUEST_HIERARCHY or entity validation in CHECK_ENTITY as appropriate.
  8. Activate the class first, then activate the BAdI implementation and dependent objects like message classes.

Referenced tables

ObjectPurpose
USMD_S_MESSAGEMessage structure used to return validation messages from the rule-service BAdI.
USMD1_CS_MSGTYSeverity constants for validation messages, including error, warning, and info.

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 add validation logic in IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_HIERARCHY?
  • What is the implementation approach for CHECK_CREQUEST_HIERARCHY in SAP MDG?
  • How do I activate a BAdI implementation for USMD_RULE_SERVICE hierarchy checks?

Possible questions

  • How do I implement SAP MDG BAdI USMD_RULE_SERVICE method CHECK_CREQUEST_HIERARCHY for change request hierarchy validation?
  • What is the step-by-step SE18/SE19 process for a USMD_RULE_SERVICE implementation?
  • How do I write ABAP validation logic in an MDG rule-service BAdI and keep the hierarchy hook active?
  • How do I implement CHECK_CREQUEST or CHECK_CREQUEST_HIERARCHY in SAP MDG?
  • How do I create a BAdI implementation and class for IF_EX_USMD_RULE_SERVICE?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_CREQUEST_HIERARCHYSE18SE19BAdI implementationABAP validationchange requesthierarchy check