SAP MDG · VALIDATION DERIVATION

How do I implement a `USMD_RULE_SERVICE` derivation in SAP MDG using an orchestrator pattern that reads CR context, gets business partner grouping, and delegates to multiple derivs

Implement the `USMD_RULE_SERVICE` BAdI in SE19, read change request context first, derive `BU_GROUP`, then delegate `DERIVE_ENTITY` processing to focused helper methods such as central and budget derivation. Keep the method as an orchestrator, only fill initial fields, and merge returned messages back to `ET_MESSAGE`.

Implement the `USMD_RULE_SERVICE` BAdI in SE19, read change request context first, derive `BU_GROUP`, then delegate `DERIVE_ENTITY` processing to focused helper methods such as central and budget derivation. Keep the method as an orchestrator, only fill initial fields, and merge returned messages back to `ET_MESSAGE`.

Implement the `USMD_RULE_SERVICE` BAdI in SE19, assign an implementing class, and keep `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` thin. In the orchestrator pattern, the method first reads CR details and `BU_GROUP`, then calls specialized derivation logic such as central and budget derivation, collecting messages back into `ET_MESSAGE`.

Process flow

  1. Open transaction `SE18` and display BAdI `USMD_RULE_SERVICE`.
  2. Confirm interface `IF_EX_USMD_RULE_SERVICE` and whether any filters apply.
  3. Open transaction `SE19` and create the BAdI implementation.
  4. Assign or create the implementing class with Z* naming.
  5. Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY`.
  6. Read CR details first, then read `BU_GROUP` or other driver attributes.
  7. Call specialized derivation helper methods in a stable sequence.
  8. Append helper messages to `ET_MESSAGE` and clear the temporary message buffer between calls.

Referenced tables

ObjectPurpose
USMD_T_MESSAGEMessage table used to collect derivation or validation messages before appending them to `ET_MESSAGE`.

ILLUSTRATIVE ABAP SAMPLE

Orchestrator pattern for `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY`

This sample follows the retrieved pattern: read CR context, read `BU_GROUP`, call dedicated derivation methods, and merge messages back to `ET_MESSAGE`.

1METHOD if_ex_usmd_rule_service~derive_entity. 2 DATA: lt_message TYPE usmd_t_message, 3 lv_crequest_id TYPE usmd_crequest, 4 lv_crequest_type TYPE usmd_crequest_type, 5 lv_bu_group TYPE bu_group. 6 7 zcl_mdg_suppl_utility=>get_cr_details( 8 IMPORTING 9 ev_crequest_id = lv_crequest_id 10 ev_crequest_type = lv_crequest_type ). 11 12 zcl_mdg_suppl_utility=>get_single_attribute( 13 EXPORTING 14 im_crnumber = lv_crequest_id 15 im_field = 'BU_GROUP' 16 IMPORTING 17 ex_value = lv_bu_group ). 18 19 zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_centrl( 20 EXPORTING 21 io_model = io_model 22 id_edition = id_edition 23 id_entitytype = id_entitytype 24 id_crequest_type = lv_crequest_type 25 id_crequest_id = lv_crequest_id 26 IMPORTING 27 et_message = lt_message 28 CHANGING 29 ct_data = ct_data ). 30 APPEND LINES OF lt_message TO et_message. 31 CLEAR lt_message. 32 33 zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_budet( 34 EXPORTING 35 io_model = io_model 36 id_edition = id_edition 37 id_entitytype = id_entitytype 38 id_crequest_type = lv_crequest_type 39 id_crequest_id = lv_crequest_id 40 iv_bu_group = lv_bu_group 41 IMPORTING 42 et_message = lt_message 43 CHANGING 44 ct_data = ct_data ). 45 APPEND LINES OF lt_message TO et_message. 46 CLEAR lt_message. 47ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` in SAP MDG?
  • How do I delegate MDG derivation to helper methods from a BAdI implementation?
  • How do I build an orchestrator-style derivation for business partner defaults in SAP MDG?

Possible questions

  • How do I implement a `USMD_RULE_SERVICE` derivation in SAP MDG using an orchestrator pattern?
  • How do I create a BAdI implementation for `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY`?
  • How do I route derivation to helper methods based on CR type and business partner grouping?
  • How do I default BP fields in MDG only when target values are initial?
  • Which SAP transaction is used to implement `USMD_RULE_SERVICE`?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICEDERIVE_ENTITYSE18SE19business partnerCR typeBU_GROUPorchestrator patterndefaultingCT_DATAET_MESSAGE