03-10-2009 3:24 PM
Hi,
how can I find out the component name of <l_line> if
the <l_line> is defined and assigned as below shown.
A table is being assigned to <l_line> but while runtime
the name of its components are unknown. How can they
be founf out.
Regards
sas
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <outtab>.
CREATE DATA new_line LIKE LINE OF <outtab>.
ASSIGN new_line->* TO <l_line> .
03-11-2009 9:59 AM
Hi,
You can use
DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
DATA: lt_comp TYPE cl_abap_structdescr=>component_table.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( ls_line).
lt_comp = lr_rtti_struc->get_components( ).
Regards,
Sesh
03-10-2009 3:33 PM
03-11-2009 9:42 AM
gt_fcat contains the list of fields to be used in the internal table, doesn't it? To get access to the fields use
ASSIGN COMPONENT fieldname OF STRUCTURE <ls_line> TO <field>.
Or, you can do it numerically.
ASSIGN COMPONENT 1 OF STRUCTURE <ls_line> TO <field>.
You might also find useful, the "Internal use only" command DESCRIBE FIELD dobj INTO td. But as it is an internal use only command, it should only be used as last resort.
matt
03-11-2009 9:59 AM
Hi,
You can use
DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
DATA: lt_comp TYPE cl_abap_structdescr=>component_table.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( ls_line).
lt_comp = lr_rtti_struc->get_components( ).
Regards,
Sesh