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

Complex logic in loop..

Former Member
0 Likes
523

Hello,

I want to write a very complex logic to achieve certain reuirement.

I have an internal table i_tab with following values. Now when I loop at i_tab, whenever value is equal to or greater then '001', perform A. Just before when next value will be 001 perform C.

001 -> perform A

002 -> perform A

003 -> perform A. perform C(because the next value is going to be 001)

001 -> perform A

002 -> perform A perform C

001 -> perform A

002 -> perform A

003 -> perform A

004 -> perform A peform C

001

:

:

So how can I find the next value of i_tab when I am looping because based on next value in i_tab , I have to perform a function during its previous value.

Regards,

Rajesh,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
482

dummy_i_tab[] = I_tab[].

loop at i_tab.

read dummy_itab with table index = current index of i_tab + 1.

if dummy_itab = 001

perform A. perform C

else.

perform A.

endif.

endloop.

thanks.

james.

2 REPLIES 2
Read only

Former Member
0 Likes
482

Hi,

Use ON CHANGE OF event and inside this event, check the value, if it is 001, include the stmt. PERFORM C.

This should work.

Regards,

Subramanian

Read only

Former Member
0 Likes
483

dummy_i_tab[] = I_tab[].

loop at i_tab.

read dummy_itab with table index = current index of i_tab + 1.

if dummy_itab = 001

perform A. perform C

else.

perform A.

endif.

endloop.

thanks.

james.