SAP MDG · VALIDATION DERIVATION

How do I implement SAP MDG DERIVE_ENTITY logic for a BAdI based on change request type?

Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` in BAdI `USMD_RULE_SERVICE`, read the change request type first, and call the derivation helper only for the approved CR types. In the sample pattern, company-code derivation is executed only for `ZSUPL1P1`, `ZSUPL2P1`, `ZSUPL4P1`, `ZSUPL4P2`, `ZSUPINT1`, `ZSUPINT2`, and `ZSUPL5P1`, and the logic populates `CT_DATA` without overwriting non-initial values.

Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` in BAdI `USMD_RULE_SERVICE`, read the change request type first, and call the derivation helper only for the approved CR types. In the sample pattern, company-code derivation is executed only for `ZSUPL1P1`, `ZSUPL2P1`, `ZSUPL4P1`, `ZSUPL4P2`, `ZSUPINT1`, `ZSUPINT2`, and `ZSUPL5P1`, and the logic populates `CT_DATA` without overwriting non-initial values.

Use BAdI `USMD_RULE_SERVICE` and implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` as a CR-type router. The source pattern first calls `ZCL_MDG_SUPPL_UTILITY=>GET_CR_DETAILS` to determine the current change request type, then executes company derivation only for the approved supplier CR types and leaves all other CR types untouched.

Process flow

  1. Open `SE18` and display BAdI definition `USMD_RULE_SERVICE`.
  2. Verify the interface name is `IF_EX_USMD_RULE_SERVICE` and confirm whether filters are required.
  3. Open `SE19` and create the BAdI implementation with a Z* name.
  4. Assign or create the implementing class and activate it.
  5. Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` in the class.
  6. Read the change request type first using `ZCL_MDG_SUPPL_UTILITY=>GET_CR_DETAILS`.
  7. Route only the allowed CR types to `ZCL_MDGBP_BP_DEFAULTS=>ZIF_TE_DERIVATION~D_BP_COMPNY`.
  8. Pass `IO_MODEL`, `ID_EDITION`, `ID_ENTITYTYPE`, `ID_CREQUEST_TYPE`, `ET_MESSAGE`, and `CT_DATA` to the helper.

Referenced tables

ObjectPurpose
ZMDG_SUP_CC_DERVReferenced in the derivation knowledge as a custom table pattern for company-code-related defaulting and fallback logic.

ILLUSTRATIVE ABAP SAMPLE

CR-type-gated MDG DERIVE_ENTITY router

Source-supported implementation pattern for routing derivation by change request type and delegating company-code defaulting to the helper method.

1METHOD if_ex_usmd_rule_service~derive_entity. 2 zcl_mdg_suppl_utility=>get_cr_details( 3 IMPORTING 4 ev_crequest_id = DATA(lv_crequest_id) 5 ev_crequest_type = DATA(lv_crequest_type) ). 6 7 CASE lv_crequest_type. 8 WHEN zif_bp_constants=>creq_type-zsupl1p1 OR 9 zif_bp_constants=>creq_type-zsupl2p1 OR 10 zif_bp_constants=>creq_type-zsupl4p1 OR 11 zif_bp_constants=>creq_type-zsupl4p2 OR 12 zif_bp_constants=>creq_type-zsupint1 OR 13 zif_bp_constants=>creq_type-zsupint2 OR 14 zif_bp_constants=>creq_type-zsupl5p1. 15 16 zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_compny( 17 EXPORTING 18 io_model = io_model 19 id_edition = id_edition 20 id_entitytype = id_entitytype 21 id_crequest_type = lv_crequest_type 22 IMPORTING 23 et_message = et_message 24 CHANGING 25 ct_data = ct_data ). 26 27 WHEN OTHERS. 28 " No derivation for other CR types. 29 ENDCASE. 30ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I set up USMD_RULE_SERVICE DERIVE_ENTITY in SAP MDG?
  • How do I route MDG derivation by change request type in ABAP?
  • How do I default MDG fields only for selected change request types?

Possible questions

  • How do I implement SAP MDG derivation in BAdI USMD_RULE_SERVICE?
  • How do I route DERIVE_ENTITY by change request type?
  • How do I default fields only when initial in MDG?
  • How do I create the BAdI implementation in SE18 and SE19?
  • How do I debug why DERIVE_ENTITY is not called?

Keywords

SAP MDGUSMD_RULE_SERVICEIF_EX_USMD_RULE_SERVICEDERIVE_ENTITYSE18SE19change request typeCT_DATAET_MESSAGEdynamic field assignment