‎2009 Jul 08 10:44 AM
Hello All,
I have an internal table i am looping it say the internal table has values
a b c d
aa bb 1
ab bc 1
ac bd 2
ad bz 2
ae by 2
af bu 3
kk mm 4
kr m1 4
kd m2 4
now for every even values of c like 2 nad 4 i need to update d value in the table.
this is just a sample example the even values may be up to n .
i need the help,any sample code .
thanks and regards,
Badri.
‎2009 Jul 08 10:48 AM
Hi,
So, is your question how to find if a number is odd or even? If so, just divide the number by 2 and check if the result has a zero after the decimal point. If it has it is even.
Regards,
Nick
‎2009 Jul 08 11:31 AM
You can do it by this way.
Data var1 type i.
var1 = 1.
loop at itsb.
if var1 % 2 = 0.
do whatever you want.
endif.
var1 = var1 + 1.
endloop.
‎2009 Jul 08 3:31 PM
loop at itab
if sy-tabix % 2 eq 0.
your code to update itab field 'd'.
endif.
endloop.