SAP MDG · VALIDATION DERIVATION
How do I implement derivation for BP_CENTRL so BU_SORT1 is populated from NAME_ORG1 in SAP MDG?
Use DERIVE_ENTITY for BP_CENTRL defaulting, check that BU_SORT1 is initial, remove special characters from NAME_ORG1 with SF_SPECIALCHAR_DELETE, take the first 10 characters, and convert them to uppercase.
Use DERIVE_ENTITY for BP_CENTRL defaulting, check that BU_SORT1 is initial, remove special characters from NAME_ORG1 with SF_SPECIALCHAR_DELETE, take the first 10 characters, and convert them to uppercase.
In SAP MDG, BU_SORT1 for BP_CENTRL is derived as a defaulting/enrichment rule, not a hard validation. The documented pattern checks that the entity type is BP_CENTRL, reads NAME_ORG1 and BU_SORT1 dynamically, and when NAME_ORG1 is filled but BU_SORT1 is empty it cleans the name with SF_SPECIALCHAR_DELETE, takes the first 10 characters, and uppercases the result.
Process flow
- Open SE18 and inspect BAdI definition
USMD_RULE_SERVICE. - Open SE19 and create or maintain the BAdI implementation.
- Assign or create the implementing class that implements IF_EX_USMD_RULE_SERVICE.
- Implement DERIVE_ENTITY and gate the logic by entity type BP_CENTRL.
- Dynamically assign NAME_ORG1 and BU_SORT1 from CT_DATA.
- Call SF_SPECIALCHAR_DELETE, take the first 10 characters, and convert BU_SORT1 to uppercase.
- Activate the class and the BAdI implementation.
- Test with a BP_CENTRL record where NAME_ORG1 is filled and BU_SORT1 is initial.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_SUP_CC_DERV | Referenced in the derivation knowledge base for other MDG defaulting scenarios; not used by the BP_CENTRL sample itself. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1" Annotated pattern from ZCL_MDGBP_BP_DEFAULTS=>D_BP_CENTRL
2METHOD zif_te_derivation~d_bp_centrl.
3 FIELD-SYMBOLS: <fs_t_data> TYPE any table,
4 <fs_data> TYPE any,
5 <fs_name_org1> TYPE any,
6 <fs_bu_sort1> TYPE any.
7
8 ASSIGN ct_data TO <fs_t_data>.
9 CHECK <fs_t_data> IS ASSIGNED.
10 CHECK id_entitytype = zif_bp_constants=>entity_type-bp_centrl.
11
12 LOOP AT <fs_t_data> ASSIGNING <fs_data>.
13 ASSIGN COMPONENT 'NAME_ORG1' OF STRUCTURE <fs_data> TO <fs_name_org1>.
14 ASSIGN COMPONENT 'BU_SORT1' OF STRUCTURE <fs_data> TO <fs_bu_sort1>.
15
16 " Derive search term from supplier name if search term is empty
17 IF <fs_name_org1> IS ASSIGNED AND <fs_name_org1> IS NOT INITIAL
18 AND <fs_bu_sort1> IS ASSIGNED AND <fs_bu_sort1> IS INITIAL.
19
20 CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
21 EXPORTING
22 with_specialchar = <fs_name_org1>
23 IMPORTING
24 without_specialchar = DATA(lv_org_name).
25
26 IF sy-subrc = 0.
27 <fs_bu_sort1> = lv_org_name+0(10).
28 TRANSLATE <fs_bu_sort1> TO UPPER CASE.
29 ENDIF.
30 ENDIF.
31 ENDLOOP.
32ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I default BU_SORT1 in BP_CENTRL during MDG derivation?
- What is the ABAP pattern for deriving BP_CENTRL search term from supplier name?
- How do I implement IF_EX_USMD_RULE_SERVICE~DERIVE_ENTITY for BP_CENTRL?
Possible questions
- Which BAdI or derivation method should I use for BP_CENTRL defaulting?
- How do I safely assign dynamic fields in DERIVE_ENTITY?
- How do I strip special characters and uppercase BU_SORT1 in MDG BP derivation?
- What is the sample ABAP logic for NAME_ORG1 to BU_SORT1 derivation?
- How do I avoid overwriting user-entered BU_SORT1 values?