‎2009 Jul 21 9:27 PM
Hi everybody,
from table i want 2 records, one record with 2 conditions, and other record with 1 condition out of 2.
If i use loop and with checking 1 condition, moved data to variable and continue the loop to get other record with other 1 condition which is same out of 2 the data moved by 1st condition may get change. I want to set that constant while loop start for 2nd condition.
Can anybody tell how to set constant in loop?
loop at itb.
check ( condition 1 or condition 2)
get record 1. (want this values to set constant)
if condition 1
get record 2
else continue loop till condition 1.
endloop.
Thanks in advance.
‎2009 Jul 21 9:36 PM
Hi,
I couldn't understand very well, but I guess you should look for AT NEW or AT END.
Frisoni
‎2009 Jul 21 9:36 PM
Hi,
I couldn't understand very well, but I guess you should look for AT NEW or AT END.
Frisoni
‎2009 Jul 21 9:47 PM
suppose
itab-a = 2 itab-b = 0 and it has 6 fileds only 2 for conditions.
so, i need 2 recods such that
loop at itab.
check itab-a = 2 or itab-b = 0.
move itab-c to var1,
itab-d to var2.
if itab-a =2. -
here if itab-b =0, it will go for next record that time it may change var1 & var2 values
move itab-c to var3. i do not want to get it changed. whatever value of var1 and var2 is got already it
else continue. should be there for all next loop without changing it.
endif.
endif.
I think now it may be clear....
‎2009 Jul 21 9:52 PM
So do you mean to say first your will check for OR condition and then move your field into var1 & 2 and then check AND condition and if this satisties move to VAR3 & 4?
Thanks
Kiran
‎2009 Jul 21 9:58 PM
hi kiran,
var1 & var2 can get by any of 2 get satisfied.
for var3 & var4 loop will continue to get other record but during next loop var1 var2 may change as it satisfies or condition.
so i do not want to change them for next loop
‎2009 Jul 21 10:02 PM
what do u mean by "loop will continue to get other record but during next loop"
Your explanation is not clear at all. Can you explain with data in itab and what will be your scenario and what o/p are you looking for.
Thanks
Kiran
‎2009 Jul 21 10:09 PM
plz tell me if i move some data to variable & throught the program i want to keep that data constant without changing its value.
how to do that?
‎2009 Jul 21 10:53 PM
1. You should have that declared as a global variable.
2. Once you move some value, dont move any other value into it.
Thanks
Kiran
‎2009 Jul 21 11:12 PM
I hope I understood u correct
loop at itab.
read table itab into wa_itab index '1'.
if sy-subrc eq 0.
check itab-a = wa_itab-2 or itab-b = wa_itab-0.
move itab-c to var1,
itab-d to var2.
endif.
if itab-a =2.
‎2009 Jul 21 11:31 PM
outside of loop:
clear: &var1, &var2.
the check condition Inside the loop:
IF condition is met.
IF &var1 IS NOT INITIAL.
assign value to &var1.
ENDIF.
ENDIF.
‎2009 Jul 21 9:38 PM