Skip to Content
0
Former Member
Jun 20, 2016 at 11:57 AM

How to fetch attributes from a master data that has compounding attr?

310 Views

Hi,

I want to fetch the value of a nav. attribute dynamically in the transformation logic (end routine) and I would like to know how to read the master data that has compounding attr?

I am currently using the FM RSAU_READ_MASTER_DATA but, it is not working correctly.

lv_patt = '__'.

lv_text = 0CUSTOMER__0BPARTNER.

FIND ALL OCCURRENCES OF lv_patt IN lv_text

RESULTS result_tab.

*** Read the value from Nav. attr of Master data

LOOP AT result_tab ASSIGNING <match>.

lv_skipchars = <match>-offset + <match>-length.

lv_mdiobj = lv_text+0(<match>-offset).

lv_naviobj = lv_text+lv_skipchars.

ENDLOOP.

*** assign the value of master data to Lookup purpose

IF lv_mdiobj+0(1) = '0'.

MOVE lv_mdiobj TO lv_field.

ELSE.

CONCATENATE '/BIC/' lv_mdiobj INTO lv_field.

ENDIF.

ASSIGN COMPONENT lv_field OF STRUCTURE

<result_fields> TO <mdval>.

IF <mdval> IS ASSIGNED.

lv_mdval = <mdval>.

*** Read from the master data

CALL FUNCTION 'RSAU_READ_MASTER_DATA'

EXPORTING

i_iobjnm = lv_mdiobj

i_chavl = lv_mdval

i_attrnm = lv_naviobj

IMPORTING

e_attrval = lv_attrval

EXCEPTIONS

read_error = 1

no_such_attribute = 2

wrong_import_parameters = 3

chavl_not_found = 4

OTHERS = 5.

IF sy-subrc EQ 0.

<result_fields>-- = lv_attrval.

ELSE.

CLEAR: <result_fields>---

ENDIF.



Appreciate your help.


Thanks,


Bharath