Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

its components name

Former Member
0 Kudos

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> .

1 ACCEPTED SOLUTION

0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

This message was moderated.

matt
Active Contributor
0 Kudos

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

0 Kudos

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