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 at with dinamic table

Former Member
0 Likes
570

Good morning to everybody

Is it possible using the dinamic table with "loop at" ? I tried this code belove but I got a mistake.

DATA: tablename(10).

*

MOVE 'LT_ITAB' TO tablename.

*

LOOP AT (tablename).

.....

endloop.

4 REPLIES 4
Read only

Former Member
0 Likes
532

Need use ASSIGN and then create loop at FIELD-SYMBOL.

Read only

Former Member
0 Likes
532

Hi

U need to use a field-symbols to do it:

FIELD-SYMBOLS: <MY_ITAB> TYPE TABLE,
               <MY_WA>   TYPE ANY.

DATA: MY_ITAB(30).

MY_ITAB = 'LT_ITAB[]'.

ASSIGN (MY_ITAB) TO <MY_ITAB>.

LOOP AT <MY_ITAB> ASSIGNING <MY_WA>.
ENDLOOP.

Max

Read only

0 Likes
532

THANKS a lot.

Read only

Former Member
0 Likes
532

hi,

it seems that u r passing a character value to the variable and then trying to loop. This won't work. You need to declare a field symbol with type table and then assign your table structure to this field symbol.

FIELD-SYMBOLS: <li_table> TYPE table.

ASSIGN LT_ITAB->* TO <li_table>. "Create internal table

ASSIGN LOCAL COPY OF INITIAL LINE OF <li_table> TO <ls_table>. "Create work area

loop at <li_table> into <ls_table>.

endloop.

regards,

nilesh.