Skip to Content
avatar image
Former Member

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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Sep 19, 2008 at 01:27 PM

    hi

    use the data type of p

    hope it will work

    with regards

    s.janagar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 01:33 PM

    Hi,

    you can use FLOOR or CEIL...

    Regards,

    deepthi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 01:41 PM

    just use ceil flor.

    then you can get exat values which you want

    Jithendra

    Add comment
    10|10000 characters needed characters exceeded