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

stopping a loop node to iterate only once

Former Member
0 Likes
2,741

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,

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
Read only

sbhutani1
Contributor
0 Likes
1,622

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

Read only

Former Member
0 Likes
1,622

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

Read only

Former Member
0 Likes
1,622

hi use a flag and clear it

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

plz reward if useful

Read only

0 Likes
1,622

how can use this with the loop node,.

/'

Read only

0 Likes
1,622

sy-tabix didnt work...

Read only

Former Member
0 Likes
1,622

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

Read only

Former Member
0 Likes
1,622

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.

Read only

Former Member
0 Likes
1,622

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.

Read only

0 Likes
1,622

Rashmi,

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

Read only

0 Likes
1,622

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

Read only

0 Likes
1,622

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.

Read only

Former Member
0 Likes
1,622

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