Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FOR loop in ABAP Code ?


I am working on a ABAP requirement, where I need to use a dynamic variable attached to a compilable code.

For ex:

In Jave we use

for( i=0; i >n; i++){

int i=0;

stmti+stmti = result;


Here i is an dynamic variable and it will be keep on changing ATTACHED TO stmti as stmt1.stmt2....etc. whenever there is a

change in i.

In ABAP, I have below code to attach:- Here I need to change from 1 to 100 like below. currently I see it as re-work, if i put the code each time changing manually. so I want make it in a loop and so dynamic and hence less code. How to achieve this. Please

help. Any ABAP string functions to be used?

if i=1

DATA ls_nd_tmp1 TYPE wd_this->Element_nd_tmp1.

DATA it_nd1 TYPE TABLE OF wd_this->Element_nd_tmp1.

DATA wa_nd1 TYPE wd_this->Element_nd_tmp1.

if i=2

DATA ls_nd_tmp2 TYPE wd_this->Element_nd_tmp2.

DATA it_nd2 TYPE TABLE OF wd_this->Element_nd_tmp2.

DATA wa_nd2 TYPE wd_this->Element_nd_tmp2.



Edited by: Praveen kumar Kadi on Sep 23, 2010 9:59 AM

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question