SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG BAdI USMD_RULE_SERVICE method CHECK_CREQUEST_FINAL for change-request validation?

Implement IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_FINAL in your USMD_RULE_SERVICE BAdI when you need a final change-request-level check at the end of the CR lifecycle. In the retrieved example, the method is intentionally empty, so the implementation pattern is to create the BAdI in SE18/SE19, bind your Z class, and add CR-level logic only if you need final-phase validation beyond entity checks.

Implement IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_FINAL in your USMD_RULE_SERVICE BAdI when you need a final change-request-level check at the end of the CR lifecycle. In the retrieved example, the method is intentionally empty, so the implementation pattern is to create the BAdI in SE18/SE19, bind your Z class, and add CR-level logic only if you need final-phase validation beyond entity checks.

In SAP MDG, CHECK_CREQUEST_FINAL is the final change-request hook of IF_EX_USMD_RULE_SERVICE. The retrieved source shows this method as intentionally empty, which means the framework hook is retained but no business logic is implemented yet. To use it, create or update the USMD_RULE_SERVICE BAdI implementation in SE18/SE19, assign your Z class, and add final-phase validation that appends messages to ET_MESSAGE.

Process flow

  1. Open SE18 and display BAdI definition USMD_RULE_SERVICE.
  2. Confirm the interface IF_EX_USMD_RULE_SERVICE and whether the BAdI is filter-dependent.
  3. Open SE19 and create or change the BAdI implementation.
  4. Assign the Z* implementing class.
  5. Redefine IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_FINAL in the class.
  6. Implement final change-request validation and append messages to ET_MESSAGE.
  7. Activate the class and the BAdI implementation.
  8. Run the MDG process and debug the method call at the final CR stage.

Referenced tables

ObjectPurpose
usmd_s_messageMessage structure used to return validation results in 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 add validation logic in CHECK_CREQUEST_FINAL for SAP MDG?
  • What is the correct way to implement IF_EX_USMD_RULE_SERVICE~CHECK_CREQUEST_FINAL?
  • How do I set up a change-request final check in USMD_RULE_SERVICE?

Possible questions

  • How do I implement SAP MDG BAdI USMD_RULE_SERVICE method CHECK_CREQUEST_FINAL?
  • What is the difference between CHECK_CREQUEST and CHECK_CREQUEST_FINAL?
  • How do I create a BAdI implementation in SE18/SE19 for USMD_RULE_SERVICE?
  • How do I return validation messages from ET_MESSAGE in MDG?
  • How do I read change-request context in a USMD_RULE_SERVICE method?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_CREQUEST_FINALSE18SE19CL_USMD_APP_CONTEXTET_MESSAGEusmd_s_messagechange request validation