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 question

Former Member
0 Likes
586

Folkes

Could some explain the LOOP ..ENDLOOP structure. why this is basically used?

if I have sum thing like this

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

WHERE VNAM = 'ZVAR1'.

< logic x>

ENDLOOP

I am assuming "logic x " will be executed only when VNAM = 'ZVAR1'. am I Correct?

Thanks

Raj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
560

hi,

Yes...you are very much correct....

to know more refer

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/loop.htm

Regards,

Santosh

5 REPLIES 5
Read only

Former Member
0 Likes
561

hi,

Yes...you are very much correct....

to know more refer

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/loop.htm

Regards,

Santosh

Read only

Former Member
0 Likes
560

Hi,

LOOP AT ..is used to process the records of the internal table...And the WHERE clause is used to filter the records..

So in your case..The internal table I_T_VAR_RANGE is processed and it will process the records where the column VNAM has got the value ZVAR1.

Thanks,

Naren

Read only

Former Member
0 Likes
560

Hi

You are correct it will logic x when it satisfies the where condition.

Regards

Haritha.

Read only

Former Member
0 Likes
560

hi

Loop is generally used to perform operations on all the records being fetched from the internal table.

in ur case logic x will be performed for all the records that satisfy the VNAM = 'ZVAR1'

condition.

regards,

madhu

Read only

0 Likes
560

Thanks for the replies guys..