09-19-2008 2:25 PM
Hi,
how can i obtain exactly values for arithmetical operations? SAP round values... but i don't want to round values.
Here is an example:
8.89 * 0.25 = 2.245 -> SAP rounds to 2.25
is there a way (FM, or something) that for this operation the result to be 2.24 ??
Thank you.
09-19-2008 2:27 PM
09-19-2008 2:29 PM
hi
use the data type of p
hope it will work
with regards
s.janagar
no, this is not working, i've try
09-19-2008 2:34 PM
hi,
i have given u the hint in the sense , u know to declare
try this
parameters: v1 type p decimals 3.
parameters: v2 type p decimals 3.
data: v3 type p decimals 8.
v3 = v1 * v2 .
write:/ v3.
it will work for sure
09-19-2008 2:37 PM
report Z_PO_EMAIL line-count 6.
data: pv type p decimals 3 value '124.157'.
data: pn type p decimals 0.
pn = pv.
write:/ pv.
write:/ pn . "rounded value
09-19-2008 2:46 PM
hi,
i have given u the hint in the sense , u know to declare
try this
parameters: v1 type p decimals 3.
parameters: v2 type p decimals 3.
data: v3 type p decimals 8.
v3 = v1 * v2 .
write:/ v3.
it will work for sure
yes janagar sundaramoorthy , this work but i want the result only with 2 decimals
if i declare v3 with two decimals in this way will not work.
09-19-2008 2:29 PM
What kind of variables did you define for that operation?
8.89 * 0.25 = 2.245 -> SAP rounds to 2.25
If result is the var that is getting 2.25, try defining liek this:
DATA: result type p decimals 3.
Regards,
Valter Oliveira.
09-19-2008 2:33 PM
09-19-2008 2:34 PM
hi,
use these operators.
CEIL
Smallest integer value that is not less than x
FLOOR
Largest integer value that is not greater than x
data : wa_val type p decimals 2,
wa_ans type i.
wa_val = '32.22'.
wa_ans = abs( wa_val ).
write : / wa_ans.
wa_val = ceil ( wa_val ).
write:/ wa_val.
09-19-2008 2:41 PM
just use ceil flor.
then you can get exat values which you want
Jithendra