SAP MDG · VALIDATION DERIVATION
How do I implement USMD_RULE_SERVICE DERIVE_ENTITY logic in SAP MDG for dynamic field defaulting?
Implement the BAdI `USMD_RULE_SERVICE` in SE18/SE19, bind an implementing class for `IF_EX_USMD_RULE_SERVICE`, and keep `DERIVE_ENTITY` focused on deterministic defaulting: loop `CT_DATA`, `ASSIGN COMPONENT` for the target field, and fill it only when initial.
Implement the BAdI `USMD_RULE_SERVICE` in SE18/SE19, bind an implementing class for `IF_EX_USMD_RULE_SERVICE`, and keep `DERIVE_ENTITY` focused on deterministic defaulting: loop `CT_DATA`, `ASSIGN COMPONENT` for the target field, and fill it only when initial.
Implement `USMD_RULE_SERVICE` via SE18/SE19, assign an implementing class that implements `IF_EX_USMD_RULE_SERVICE`, and put defaulting logic in `DERIVE_ENTITY` rather than hard validation. The source pattern shows a simple, safe approach: loop over `CT_DATA`, use `ASSIGN COMPONENT` for the target field, and populate it only when the field is still initial.
Process flow
- Open SE18 and display BAdI definition `
USMD_RULE_SERVICE`. - Confirm interface `IF_EX_USMD_RULE_SERVICE`, use type, and filter dependency.
- Open SE19 and create the BAdI implementation.
- Assign the implementing class and package/transport.
- Implement `IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY` with safe dynamic component access.
- Activate the class, implementation, and dependent objects.
- Test in the relevant MDG change request flow and verify that only initial values are defaulted.
Referenced tables
| Object | Purpose |
|---|---|
CT_DATA | Input/output table for the current entity rows being derived. |
ILLUSTRATIVE ABAP SAMPLE
Minimal DERIVE_ENTITY defaulting pattern
Source-supported pattern for safe derivation: loop CT_DATA, assign the component dynamically, and set it only if initial.
1METHOD if_ex_usmd_rule_service~derive_entity.
2 FIELD-SYMBOLS: <ls_data> TYPE any,
3 <lv_test> TYPE any.
4
5 LOOP AT ct_data ASSIGNING <ls_data>.
6 ASSIGN COMPONENT 'ZZ_TEST_DERIVE' OF STRUCTURE <ls_data> TO <lv_test>.
7 IF <lv_test> IS ASSIGNED AND <lv_test> IS INITIAL.
8 <lv_test> = 'X'.
9 ENDIF.
10 ENDLOOP.
11ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I create a BAdI implementation for IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY in MDG?
- How do I default a custom field in MDG derivation using DERIVE_ENTITY?
- How do I use SE18 and SE19 to implement a derivation BAdI in SAP MDG?
Possible questions
- How do I implement
USMD_RULE_SERVICEDERIVE_ENTITY logic in SAP MDG for dynamic field defaulting? - How do I create a BAdI implementation for IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY in MDG?
- How do I default a custom field in MDG derivation using DERIVE_ENTITY?
- How do I use SE18 and SE19 to implement a derivation BAdI in SAP MDG?
- What is the standard pattern for looping CT_DATA and defaulting only initial values in DERIVE_ENTITY?