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: 

round prblem

milascon_daniel
Participant
0 Kudos

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.

9 REPLIES 9

Former Member
0 Kudos

hi

use the data type of p

hope it will work

with regards

s.janagar

0 Kudos

hi

use the data type of p

hope it will work

with regards

s.janagar

no, this is not working, i've try

0 Kudos

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

0 Kudos

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

0 Kudos

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.

valter_oliveira
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi,

you can use FLOOR or CEIL...

Regards,

deepthi.

Former Member
0 Kudos

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.

Former Member
0 Kudos

just use ceil flor.

then you can get exat values which you want

Jithendra