Skip to Content
author's profile photo Former Member
Former Member

Round Up

Hi all,

I need to rund up, for examplo 19,464323 round up with 2 decimals = 19,47

Can you help me ?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 08:19 PM

    Hi,

    You can use the Function Module 'MURC_ROUND_FLOAT_TO_PACKED'.

    Or you can also use the following code to round up:

    DATA: num1 TYPE f, num2 TYPE p DECIMALS 3.

    num1 = '1.666666'.

    num2 = num1.

    WRITE num2.

    Reward points if helpfull,

    Regards,

    Kashyap Ivaturi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2008 at 08:21 PM
    no =  19,464323
    WRITE no DECIMALS 2 to v_no.
    
    

    v_no contains 19,47.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 08:33 PM

    hi,

    the best way for rounding a variable is the following example:

    >data: a(8) type p DECIMALS 5 VALUE '123.45678'.

    >data: b(8) type p DECIMALS 2.

    >START-OF-SELECTION.

    >write:/ a.

    >write:/ b.

    >move a to b.

    >write:/ b.

    bye.

    Marco

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 11:11 PM

    Hi !

    If i use for example

    a type f

    b type p decimals 2.

    a = 19,64332333

    move a to b or write a to b, the result is 19,64 i need roud up to 19,65

    thanks

    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.