Application Development 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: 

stopping a loop node to iterate only once

Former Member
0 Kudos

Hello,

I have a loop node in which i am interating thru an internal table. I dont have a table node before this loop, so any calculation i have to do is in the loop node. I want to ask is how to iterate the loop only once ?

Thanks,

12 REPLIES 12

sbhutani1
Contributor
0 Kudos

Hi shehryar,

If you want to execute this loop only one time then write this code

loop at itab.

// do your calculation here

if sy-tabix = 2.

exit.

endloop.

Ps reward points if helpful

Regards

Sumit Bhutani

Former Member
0 Kudos

isnt this manually.... i have a loop node !

Former Member
0 Kudos

hi use a flag and clear it

flag = 'x'.
if flag = 'x'.
loop 
clear flag.
endloop.
endif

plz reward if useful

0 Kudos

how can use this with the loop node,.

/'

0 Kudos

sy-tabix didnt work...

former_member181962
Active Contributor
0 Kudos

In the conditions tab.

YOu can specify the condition

sy-tabix = 1.

meaning that this node will be active for only that condition.

Regards,

ravi

Former Member
0 Kudos

if you are certain that u want one record (or you want to loop only once), then use READ statement instead of loop.

read table itab with key fi = a1

f2 = a2.

if sy-subrc eq 0.

< this means entry is found>.

endif.

Former Member
0 Kudos

Hi,

You can also use Loop with where condition.

The where condition on a primary key in the internal table can give you a single record.

Are you talking about a loop node in Smartforms?

Hope this helps,

Thanks,

Rashmi.

0 Kudos

Rashmi,

yes i am talkin abt the loop node in smart forms...

0 Kudos

Hi,

can you set the result of the calculation in the structure that take the data of the internal table ?

(when you make a loop in smartforms, you set the data in a structure)

So you will have just to make a condition to didn't loop if the field where the calculation is made is empty or not.

Rgd

Frédéric

0 Kudos

Hi,

Give the Line 1 to 1 in the data tab of the Loop Node or read the first line in the Program Lines Node and display it in Template Node.

Regards,

Arun.

Former Member
0 Kudos

Hi,

You can give 1 to 1 in ROW tab under the Internal Table in the DATA tab of the loop node.

Thanks and Regards,

Bharat Kumar Reddy.V