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

Internal table update on even values

Former Member
0 Likes
483

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.

3 REPLIES 3
Read only

Former Member
0 Likes
442

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

Read only

Former Member
0 Likes
442

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.

Read only

Former Member
0 Likes
442

loop at itab

if sy-tabix % 2 eq 0.

your code to update itab field 'd'.

endif.

endloop.