Accessing deep structures in ABAP
It is always a challenging part to work with complex data types in ABAP. And one of these types is handling deep structures. However it depends on how well we understand the structure design. We will see how to access deep structures programmatically with an example.
In our example we are using already existing table type RANGE_QMNUM_TAB. We are declaring a structure x_deep2 which contains another structure x_deep1 which in turn contains a table type. You can use following program and also can modify according to your requirement.
TYPES: BEGIN OF x_deep1,
v_qmnum TYPE qmel-qmnum,
RANGE_QMNUM_TAB TYPE RANGE_QMNUM_TAB,
END OF x_deep1.TYPES: BEGIN OF x_deep2,
v_qmnum1 TYPE qmel-qmnum,
v_test TYPE x_deep1.
TYPES: end of x_deep2.DATA: it_qmnum TYPE RANGE_QMNUM_TAB,
wa_qmnum TYPE RANGE_QMNUM,
it_deep2 TYPE TABLE OF x_deep2,
wa_deep2 TYPE x_deep2.wa_qmnum-low = ‘XXXXXXXX’.
append wa_qmnum to it_qmnum.
wa_deep2-v_test-RANGE_QMNUM_TAB[] = it_qmnum[].
APPEND wa_deep2 to it_deep2.
I hope now it is clear that it is not as difficult as it looks in structure wise. Though it shows how to pass values to deep structure, I guess it helps all to write for getting values as well from deep structures.




Leave a comment!