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

internal table

Former Member
0 Likes
1,065

how do I refer to the table with a given column number?

for example I want the field of the number 5 column

1 ACCEPTED SOLUTION
Read only

FredericGirod
Active Contributor
882

ASSIGN COMPONENT ... OF STRUCTURE ... TO FIELD-SYMBOL ...

4 REPLIES 4
Read only

FredericGirod
Active Contributor
883

ASSIGN COMPONENT ... OF STRUCTURE ... TO FIELD-SYMBOL ...

Read only

cdprasanna
Active Participant
882

hi luca treva,

DATA : idetails TYPE abap_compdescr_tab,
       xdetails TYPE abap_compdescr,
       lt_root TYPE TABLE OF ehhssd_inc_root,
       ref_table_des TYPE REF TO cl_abap_structdescr.

FIELD-SYMBOLS : <lfs_any> TYPE any.

ref_table_des ?= cl_abap_typedescr=>describe_by_name( 'YOUR INTERNAL TABLE STRUCURE NAME' ).  "note it should be global

idetails[] = ref_table_des->components[].

READ TABLE idetails INTO xdetails INDEX 5.
IF sy-subrc EQ 0.
  LOOP AT your_table INTO work_area.
    ASSIGN COMPONENT xdetails-name OF STRUCTURE work_area TO <lfs_any>.
  ENDLOOP.
ENDIF. 

Cheers,

Prasanna CD

Read only

882

Or simply:

LOOP AT your_table INTO work_area.
  ASSIGN COMPONENT 5 OF STRUCTURE work_area TO FIELD-SYMBOL(<lfs_any>).
ENDLOOP.

ASSIGN dynamic_dobj - COMPONENT comp OF STRUCTURE struc