Skip to Content

round prblem

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 01:27 PM

    hi

    use the data type of p

    hope it will work

    with regards

    s.janagar

    Add a comment
    10|10000 characters needed characters exceeded

    • 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.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 01: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 01:33 PM

    Hi,

    you can use FLOOR or CEIL...

    Regards,

    deepthi.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 01: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 01:41 PM

    just use ceil flor.

    then you can get exat values which you want

    Jithendra

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.