SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG BP entity validation in USMD_RULE_SERVICE CHECK_ENTITY using an orchestrator pattern?

Use IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY as an orchestrator: read the application context first, guard for model 'BP', branch by CR type/process/step, delegate checks to validation helpers, append their messages to ET_MESSAGE, then enrich row IDs and normalize severities.

Use IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY as an orchestrator: read the application context first, guard for model 'BP', branch by CR type/process/step, delegate checks to validation helpers, append their messages to ET_MESSAGE, then enrich row IDs and normalize severities.

In SAP MDG BP validation, the best practice is to keep IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY as an orchestrator instead of putting all checks inline. The documented pattern reads the application context first, verifies the BP model, routes validation by change-request type, process, and workflow step, then collects messages from specialized rule methods before enriching and normalizing them.

Process flow

  1. Open SE18 and display BAdI definition USMD_RULE_SERVICE.
  2. Create or maintain the implementation in SE19 and assign the implementing class.
  3. Implement IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY in the class.
  4. Read the application context with CL_USMD_APP_CONTEXT=>GET_CONTEXT( ).
  5. Guard for model BP and derive CR type, step, and process.
  6. Call the specialized validation methods and append their messages to ET_MESSAGE.
  7. Enrich messages with GET_MESSAGE_ROW_ID and adjust severity with ADJUST_MESSAGES.
  8. Activate the class and BAdI implementation, then test with the target BP scenario.

Referenced tables

ObjectPurpose
USMD_T_MESSAGEInternal message table used to collect and return validation messages from CHECK_ENTITY.

ILLUSTRATIVE ABAP SAMPLE

Orchestrator pattern for IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY

Source-supported implementation pattern for BP validation orchestration, message collection, navigation enrichment, and severity adjustment.

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 lv_crtype TYPE usmd_crequest_type, 5 lv_crstep TYPE usmd_crequest_appstep, 6 lv_process TYPE usmd_process, 7 lv_acc_grp TYPE ktokk. 8 9 lo_app_context = cl_usmd_app_context=>get_context( ). 10 CHECK lo_app_context IS BOUND. 11 CHECK io_model->d_usmd_model = 'BP'. 12 13 lo_app_context->get_attributes( 14 IMPORTING 15 ev_crequest_step = lv_crstep 16 ev_crequest_type = lv_crtype 17 ev_process = lv_process ). 18 19 " Rule block 1: central BP checks 20 zcl_bp_validation_rule=>zif_te_validation~v_bp_centrl( 21 EXPORTING 22 io_model = io_model 23 id_edition = id_edition 24 id_entitytype = id_entitytype 25 id_crequest = id_crequest 26 it_data = it_data 27 id_crequest_type = lv_crtype 28 id_crequest_step = lv_crstep 29 IMPORTING 30 et_message = lt_message ). 31 APPEND LINES OF lt_message TO et_message. 32 CLEAR lt_message. 33 34 " Rule block 2: scenario-conditional checks 35 IF lv_process = 'SUP1' AND lv_crstep = zif_bp_constants=>cr_step-step_00. 36 zcl_bp_validation_rule=>zif_te_validation~v_com_code( 37 EXPORTING 38 io_model = io_model 39 id_edition = id_edition 40 id_entitytype = id_entitytype 41 id_crequest = id_crequest 42 it_data = it_data 43 id_crequest_type = lv_crtype 44 id_crequest_step = lv_crstep 45 IMPORTING 46 et_message = lt_message ). 47 APPEND LINES OF lt_message TO et_message. 48 CLEAR lt_message. 49 ENDIF. 50 51 " Message navigation + normalization 52 IF et_message IS NOT INITIAL. 53 zcl_mdg_suppl_utility=>get_message_row_id( 54 EXPORTING 55 io_model = io_model 56 id_crequest = id_crequest 57 id_entitytype = id_entitytype 58 CHANGING 59 ct_message = et_message ). 60 61 me->adjust_messages( 62 EXPORTING 63 cr_number = id_crequest 64 CHANGING 65 ct_message = et_message ). 66 ENDIF. 67ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I build a BP validation orchestrator in IF_EX_USMD_RULE_SERVICE~CHECK_ENTITY?
  • How should I route SAP MDG BP entity checks by process and workflow step?
  • How do I append and normalize ET_MESSAGE in an MDG BP CHECK_ENTITY implementation?

Possible questions

  • What is the right way to structure CHECK_ENTITY for BP validations?
  • How do I call helper validation rules from CHECK_ENTITY?
  • How do I enrich ET_MESSAGE with row IDs and normalized severities?
  • When should I read the application context in MDG validation?
  • How do I filter BP validation by CR type, process, and step?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICECHECK_ENTITYBP validationorchestrator patternET_MESSAGECL_USMD_APP_CONTEXTGET_MESSAGE_ROW_IDADJUST_MESSAGES