10-25-2007 5:39 AM
Hi Folks,
a = 4
b = 2
c = a/b
c = 2.
d = remainder.
e = quotient.
Now I have to get the remainder of this too and store it in a variable.For the above caluculation remainder is 0 and quotient is 2.How to get these two values.
K.Kiran.
10-25-2007 5:42 AM
Hi,
DIV - integer division
MOD - remainder for integer division
<b>reward points if useful.</b>
regards,
Vinod Samuel.
10-25-2007 5:41 AM
Hi kiran,
There are lots of SAP keywords available.
Check below keywords.
Function func Return value
abs Absolute value of the argument arg
sign Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
ceil Smallest integer number that is not smaller than the value of the argument arg.
floor Largest integer number that is not larger than the value of the argument arg.
trunc Value of the integer part of the argument arg
frac Value of the decimal places of the argument arg
You may check which one suits you.
Regards,
Atish
10-25-2007 5:42 AM
Hi,
DIV - integer division
MOD - remainder for integer division
<b>reward points if useful.</b>
regards,
Vinod Samuel.
10-25-2007 5:47 AM
Hi,
Check this out -
data: l_a type i, l_b type i.
l_a = 20.
l_b = l_a div 6.
write:/ l_b. Output is 3
l_b = l_a mod 6.
write:/ l_b. Output is 2
Hope this helps.
ashish
10-25-2007 5:52 AM
HI
Check this eaxample
DATA: pack TYPE p DECIMALS 4,
n TYPE f VALUE '+5.2',
m TYPE f VALUE '+1.1'.
pack = n / m.
WRITE pack.
pack = n DIV m.
WRITE / pack.
pack = n MOD m.
WRITE / pack.
Thanks,
Praveen
10-25-2007 5:54 AM
<b>DATA: num1 type i,
num2 type i,
res type i,
res1 type i.
num1 = 4.
num2 = 2.
res = num1 mod num2. " To get remainder
res1 = num1 / num2. " To get quotient .
write:/ res, res1.
Regards
SANTOSH K.</b>