Dynamic table/structure creation and use
Here's a tricky one - or so I believe!
I wish to have a dynamic table and associated structure. Easy so far, I create it using the 46C method of:
Create a dynamic table from the field catalog
CALL METHOD cl_alv_table_create=>create_dynamic_table
it_fieldcatalog = gt_fieldcat
ep_table = new_table.
Assign the table to a field symbol
ASSIGN new_table->* TO <gt_outtab>.
Create a line of the table and assign to a field symbol
CREATE DATA new_line LIKE LINE OF <gt_outtab>.
ASSIGN new_line->* TO <gs_outtab>.
Now, my problem comes when accessing the individual fields.
What I wish to avoid is the gratutious use of:
ASSIGN COMPONENT 'VBELN' OF STRUCTURE <gs_outtab> TO <column>.
<column> = gs_vbap-vbeln.
every time I wish to access a component of the structure. At 'compile' time though, of course I do not know the full structure (I do know most of the fields though).
Is there a way to specify a structure that is half static and half dynamic? Or should I create a structure that will include all of the potential fields?
Thanks in advance