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

Chain Statement Under Loop

Former Member
0 Likes
828

Hi Expert,

         May i use chain statement under loop?

Eg:

         Loop itab into at w_itab,

          Move: w_itab to w_itab2,

                    w_itab to w_itab2.

          append w_itab2 to itab2.


Thanks

Neha 🙂

3 REPLIES 3
Read only

mayur_priyan
Active Participant
0 Likes
642

Yes, the statement block between LOOP and ENDLOOP can contain the keywords FIELD, MODULE, CHAIN and ENDCHAIN of the flow logic.

Read only

rajkumarnarasimman
Active Contributor
0 Likes
642

Hi Nehan,

Yes you can use the chain statements inside Loop statements. It wont affect the performance and all.

The statements which have same starting points are expressed as Chain statements which can be used at any where inside the program.

Also find the link below.

ABAP Keyword Documentation.

Regards

Rajkumar Narasimman

Read only

arkantos
Explorer
0 Likes
642

Hi,

I am not sure if you are asking about "chain" statement.

because your example looks like you are asking about "chained" statement.

If i understand you correctly, then yes, we can use chained statements inside a loop.

EG:

LOOP AT IT_STUD INTO WA_STUD.

   MOVE: WA_STUD TO WA_STUD1,

         WA_STUD TO WA_STUD2.

   APPEND: WA_STUD1 to IT_STUD1,

           WA_STUD2 TO IT_STUD2.

ENDLOOP.

To know more about chained statements, refer: ABAP Keyword Documentation

Thanks,

Velraj