SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG derivation logic in USMD_RULE_SERVICE~DERIVE_ENTITY for a business partner change request?
Implement the BAdI `USMD_RULE_SERVICE` in SE19, assign a Z* class that implements `IF_EX_USMD_RULE_SERVICE`, and place your defaulting logic in `DERIVE_ENTITY`. For the BP pattern in your source, read the change-request type with `zcl_mdg_suppl_utility=>get_cr_details( )`, branch on `lv_crequest_type`, and delegate to the relevant derivation method such as `zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_venval( )` when the scenario is approved.
Implement the BAdI `USMD_RULE_SERVICE` in SE19, assign a Z* class that implements `IF_EX_USMD_RULE_SERVICE`, and place your defaulting logic in `DERIVE_ENTITY`. For the BP pattern in your source, read the change-request type with `zcl_mdg_suppl_utility=>get_cr_details( )`, branch on `lv_crequest_type`, and delegate to the relevant derivation method such as `zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_venval( )` when the scenario is approved.
Implement the MDG rule-service BAdI `USMD_RULE_SERVICE` in SE19, assign a Z* class that implements `IF_EX_USMD_RULE_SERVICE`, and put derivation/defaulting logic in `DERIVE_ENTITY`. In the BP source pattern, the method first reads the change request details, then prepares a `CASE lv_crequest_type` branch so only approved change-request types trigger the BP vendor-value derivation.
Process flow
- Open SE18 and display BAdI `
USMD_RULE_SERVICE`. - Confirm the interface `IF_EX_USMD_RULE_SERVICE` and whether a filter is required.
- Create the implementation in SE19 with a Z* name, package, and transport.
- Assign or create the implementing class and implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY`.
- Read the change request context using `zcl_mdg_suppl_utility=>get_cr_details( )`.
- Branch on `lv_crequest_type` and call the relevant derivation helper.
- Activate the class and BAdI implementation.
- Debug the method with a breakpoint and verify `ct_data` changes only for the intended scenario.
Referenced tables
| Object | Purpose |
|---|---|
usmd_s_message | Row structure used for returning MDG messages from rule-service methods. |
usmd_t_message | Message table type used to collect and append derivation or validation messages. |
ILLUSTRATIVE ABAP SAMPLE
Source-supported placeholder derivation pattern for `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY`
This is the exact branch structure shown in the source, ready to be extended with the approved BP derivation call.
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 " Placeholder implementation in current class.
8 " Planned pattern:
9 " CASE lv_crequest_type.
10 " WHEN ...
11 " zcl_mdgbp_bp_defaults=>zif_te_derivation~d_bp_venval( ... ).
12 " ENDCASE.
13ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I add derivation/defaulting logic in the MDG
USMD_RULE_SERVICEBAdI? - How do I branch MDG derivation by change request type in DERIVE_ENTITY?
- What is the implementation pattern for IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY in SAP MDG?
Possible questions
- How do I create the BAdI implementation in SE19 for
USMD_RULE_SERVICE? - How do I activate a derivation class for SAP MDG BP processing?
- How do I default values only when target fields are initial in MDG derivation?
- How do I adapt the existing BP derivation pattern for another change request type?
- How do I debug
USMD_RULE_SERVICE~DERIVE_ENTITY during an MDG change request?