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

Loop over field symbol

0 Likes
676

Hi experts,

I am trying to loop over field symbol but unable to understand how to do it.

I am taking table name dynamically, so I do not know the structure of the table.

Below is my code.

    CREATE DATA LR_TABLE TYPE TABLE OF (TABLE_NAME).
    ASSIGN LR_TABLE->* TO <FT_REC>.

    SELECT (FIELD)
      INTO CORRESPONDING FIELDS OF TABLE <FT_REC>
      FROM (TABLE_NAME)
      UP TO 10 ROWS
      ORDER BY PRIMARY KEY.

I want to take each field from each row and export it into a structure. Is there any better way to do it ?

Hi experts,

I am trying to loop over field symbol but unable to understand how to do it.

I am taking table name dynamically, so I do not know the structure of the table.

Below is my code.

    CREATE DATA LR_TABLE TYPE TABLE OF (TABLE_NAME).
    ASSIGN LR_TABLE->* TO <FT_REC>.

    SELECT (FIELD)
      INTO CORRESPONDING FIELDS OF TABLE <FT_REC>
      FROM (TABLE_NAME)
      UP TO 10 ROWS
      ORDER BY PRIMARY KEY.

I want to take each field from each row and export it into a structure. Is there any better way to do it ?

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
627

Search forum or ABAP documentation:

ASSIGN COMPONENT 'COMPNAME' OF STRUCTURE <STRUCTURE> TO <FIELD>.