Application Development 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: 

Wht is function of MOD?

Former Member
0 Kudos

Hi Experts,

Pls. let me know that, Wht is the function of MOD, I got the info from SAP Help, as below, but, I did not understand. pls. let me clarify,

*I hv statemnt like, SUM = SUM MOD 43

*thanq

DATA: SECONDS TYPE I,

TIME_FROM TYPE T VALUE '200000',

TIME_TO TYPE T VALUE '020000'.

SECONDS = ( TIME_TO - TIME_FROM ) MOD 86400.

SECONDS has the value 21600 (6 hours). The "MOD 86400" operation in this example ensures that the result is not negative, even if the time period spans midnight.

Edited by: Srinivas on Mar 25, 2008 3:45 PM

1 ACCEPTED SOLUTION

Former Member

Hi Srinivas,

MOD is nothing but ,it gives the value of the reminder. That's it.

Check the code below for better understanding.

When 101 MOD 10 is the stmt it gives the result as 1, because when 101 is divided by 10 it gives reminder as 1.

data: a type i value 101,

b type i.

b = a mod 10.

write : b.

Thanks & Regards,

AMK.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 25, 2008 5:10 PM

3 REPLIES 3

Former Member
0 Kudos

hi , check this example... the mod function gives the remainder after division...

data: i type i value 5,

j type i,

out type i .

j = i / 2.

out = i mod 2.

write:/ j , out.

regards,

venkat.

Former Member

Hi Srinivas,

MOD is nothing but ,it gives the value of the reminder. That's it.

Check the code below for better understanding.

When 101 MOD 10 is the stmt it gives the result as 1, because when 101 is divided by 10 it gives reminder as 1.

data: a type i value 101,

b type i.

b = a mod 10.

write : b.

Thanks & Regards,

AMK.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 25, 2008 5:10 PM

Former Member
0 Kudos

Hi ,

In general "MOD" is called as modulo division which gives the reminder value. If we user '/' we get only the quotient.

Consider a value 9999.

If we want the quotient of 9999 when divided by 100 then we use '/'. i.e. 9999 / 100 = 99.99

If we want the reminder then we go for modulo division using 'mod'. i.e. 9999 mod 100 = 99.

Reward points if helpful.

thank you.