Application Development and Automation 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: 
Read only

its components name

Former Member
0 Likes
608

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
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
588

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
Read only

Former Member
0 Likes
588

This message was moderated.

Read only

matt
Active Contributor
0 Likes
588

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
589

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