Skip to Content
-1

internal table

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

for example I want the field of the number 5 column

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Nov 06, 2019 at 09:05 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 06, 2019 at 09:40 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.