Skip to Content
0
Former Member
Apr 19, 2012 at 12:11 PM

Reading data from dynamic internal table.

1345 Views

Hello all,

I have created a dynamic internal table, the structure of which will be something like this during runtime (this structure varies according to user input):

VKORG VTWEG SPART FROMDATE TODATE

0001 0001 01 04/04/2011 04/04/2012

I came across a piece of code where you get the components name of the dynamic table structure <dyn_table> :

DATA: r_struct TYPE REF TO cl_abap_structdescr,
table_fields TYPE abap_component_tab.

FIELD-SYMBOLS: <field> TYPE ANY,

<value> TYPE ANY.

r_struct ?= cl_abap_typedescr=>describe_by_data( <dyn_wa> ).

table_fields = r_struct->get_components( ).

LOOP AT <dyn_table> INTO <dyn_wa>.
LOOP AT table_fields ASSIGNING <field>.
ASSIGN COMPONENT <field> OF STRUCTURE <dyn_wa> TO <value>.

ENDLOOP.

ENDLOOP.

I'm getting a dump with this code.

My requirement is to get the values of VKORG, VTWEG and SPART and validate these using AUTHORITY-CHECK OBJECT, but unable to understand how to proceed. Please help. Thanks!