Sorry, that's the best I can come up with. Maybe look into BASE and if it can help appending the tables in an inline expression to loop over in a for expression.
TYPES: BEGIN OF gty_struct, name TYPE string, date TYPE d, END OF gty_struct, BEGIN OF gty_line, text TYPE string, number TYPE i, END OF gty_line, gty_tab TYPE STANDARD TABLE OF gty_line WITH DEFAULT KEY, gty_struct_tab TYPE STANDARD TABLE OF gty_struct WITH DEFAULT KEY, gty_ref_tab TYPE STANDARD TABLE OF REF TO gty_struct_tab WITH DEFAULT KEY. DATA(gt_tab_a) = VALUE gty_struct_tab( ( name = `Teststring1` date = sy-datum ) ( name = `Teststring2` date = sy-datum ) ( name = `Teststring3` date = sy-datum ) ( name = `Teststring4` date = sy-datum ) ). DATA(gt_tab_b) = VALUE gty_struct_tab( ( name = `Teststring5` date = sy-datum ) ( name = `Teststring6` date = sy-datum ) ( name = `Teststring7` date = sy-datum ) ( name = `Teststring8` date = sy-datum ) ). DATA(gt_combined) = VALUE gty_tab( LET tab = VALUE gty_ref_tab( ( REF #( gt_tab_a ) ) ( REF #( gt_tab_b ) ) ) IN FOR a IN tab FOR b IN a->* ( text = b-name number = line_index( a->*[ table_line = b ] ) ) ). cl_demo_output=>display( gt_combined ).
I see the option of several FORs there, furthermore, there is a BASE, a LET ...
@Horst, @Fabian, thank you, I had tried using the 2 FOR statements and had issues originally, but just tried again and now I've got the behavior I was looking for. However, I found BASE to be what I was looking for, as the 2 FOR statements caused duplicate entries the way I was trying to use them.
Add comment