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

reg: Internal Table ?

Former Member
0 Likes
459

Hello.

>

> Does somebody know how can I get the names of the columns of an internal table at run time ? ?

>

> I mean:

>

> For example, if I create an internal table called ITAB1

>

> DATA: ITAB1 LIKE BKPF OCCURS 0,

>

> BEGIN OF ITAB2 OCCURS 0,

> FIELDNAME(40) TYPE C,

> END OF ITAB2.

>

>

> So, I want to full fill the internal table ITAB2

with all the names of the columns of the internal table ITAB1.

>

> But, I don't know how !! !

>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
438

The function module GET_COMPONENT_LIST will give all the details of the columns of the table.

Regards,

Ravi

Note : Please mark all the helpful answers

3 REPLIES 3
Read only

Former Member
0 Likes
439

The function module GET_COMPONENT_LIST will give all the details of the columns of the table.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

former_member186741
Active Contributor
0 Likes
438

data : ref_descr type ref to cl_abap_structdescr.

ref_descr ?= cl_abap_typedescr=>describe_by_DATA( your_structure ).

data : it_details type abap_compdescr_tab,

wa_details type abap_compdescr.

it_details[] = ref_descr->components[].

loop at it_details into wa_details.

WRITE:/ WA_DETAILS-NAME.

ENDLOOP.

Read only

Former Member
0 Likes
438

HEllo Selva,

U can use the FM GET_COMPONENT_LIST for this purpose.

If useful reward.

Vasanth