cancel
Showing results for 
Search instead for 
Did you mean: 

Derivation not working- SAP MDG for Supplier

Former Member
0 Kudos

Hi Experts,

In my current project we are using SAP MDG 8 and we are implementing supplier governance.

I am experiencing a strange issue regarding a simple derivation. I have a business rule which says that in the "Create Vendor" page whatever the user enters in the Name1 field , the first 10chars has to copied to the "Search Terms" field ( BP_CENTRL-BU_SORT1). So I am using the below code in my handler class derive method but still the field remains blank.

Any ideas?

CALL METHOD io_changed_data->read_data
EXPORTING
i_entity = 'BP_CENTRL'
IMPORTING
er_t_data_mod = lr_mod.

IF lr_mod IS BOUND.
UNASSIGN: <lt_mod> , <ls_mod>.
ASSIGN lr_mod->* TO <lt_mod>.
IF <lt_mod> IS ASSIGNED AND <lt_mod> IS NOT INITIAL.
READ TABLE <lt_mod> ASSIGNING <ls_mod> INDEX 1.
IF <ls_mod> IS ASSIGNED AND <ls_mod> IS NOT INITIAL.
ASSIGN COMPONENT 'NAME_ORG1' OF STRUCTURE <ls_mod> TO <lfs_name_org1>.
ASSIGN COMPONENT 'BU_SORT1' OF STRUCTURE <ls_mod> TO <lfs_bu_sort1>.
ENDIF.

IF <lfs_name_org1> IS ASSIGNED AND <lfs_name_org1> IS NOT INITIAL.
<lfs_bu_sort1> = <lfs_name_org1>+0(10).
TRANSLATE <lfs_bu_sort1> TO UPPER CASE.

REFRESH lt_attrib.
CLEAR comp_name.
comp_name = 'BU_SORT1'.
INSERT comp_name INTO TABLE lt_attrib.
TRY.
IF <lfs_bu_sort1> IS ASSIGNED AND
<lfs_bu_sort1> IS NOT INITIAL.

CALL METHOD io_write_data->write_data
EXPORTING
i_entity = 'BP_CENTRL'
it_attribute = lt_attrib
it_data = <lt_mod>.
ENDIF.
CATCH cx_usmd_write_error.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.

many thanks in advance.

Saikat

Accepted Solutions (0)

Answers (2)

Answers (2)

loga201
Contributor
0 Kudos

Check Rule based Badi's

former_member230136
Contributor
0 Kudos

Have you tried this solution in BADI: USMD_RULE_SERVICE_CROSS_ET ??