Mesh basically a complex structure that allows retrieving dependent records from more than table.
TYPES : BEGIN OF ty_tab1,
col1(2),
col2(2),
END OF ty_tab1,
BEGIN OF ty_tab2,
col11(2),
col22(2),
col33(2),
END OF ty_tab2.
TYPES : tt_tab1 TYPE SORTED TABLE OF ty_tab1 WITH UNIQUE KEY col1,
tt_tab2 TYPE SORTED TABLE OF ty_tab2 WITH UNIQUE KEY col11.
* Define MESH type with association with association name as to_tab2
TYPES : BEGIN OF MESH my_tab,
tab1 TYPE tt_tab1 ASSOCIATION to_tab2 TO tab2 ON col11 = col1,
tab2 TYPE tt_tab2,
END OF MESH my_tab.
DATA : ms_tab TYPE my_tab,
ls_tab2 TYPE ty_tab2.
ms_tab–tab1 = VALUE tt_tab1( ( col1 = ’11’ col2 = ’12’ )
( col1 = ’21’ col2 = ’22’ )
( col1 = ’31’ col2 = ’32’ )
( col1 = ’41’ col2 = ’42’ )
( col1 = ’51’ col2 = ’52’ )
).
ms_tab–tab2 = VALUE tt_tab2( ( col11 = ’11’ col22 = ’12’ col33 = ’13’ )
( col11 = ’21’ col22 = ’22’ col33 = ’23’ )
( col11 = ’31’ col22 = ’32’ col33 = ’33’ )
( col11 = ’41’ col22 = ’42’ col33 = ’43’ )
( col11 = ’51’ col22 = ’52’ col33 = ’53’ )
).
” Below line gets the line from table tab1 with value of col1 = 31 and reads the dependent “record from the table tab2 with association to_tab2.
ls_tab2 = ms_tab–tab1\to_tab2[ ms_tab–tab1[ col1 = ’31’ ] ].
WRITE :/ ls_tab2–col11, ls_tab2–col22, ls_tab2–col33.
Output-
One comment