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

Need function module - urgent

Hi Friends,

Could any one tell me if any fm exists to round off the value.

Ex : 9.66 to 9 etc.

Vishnu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 04, 2007 at 10:43 PM

    Hi,

    Please check FM ROUND.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 10:45 PM

    Hi,

    You can use

    <b>ROUND</b>

    or

    CALL FUNCTION 'HR_IN_ROUND_AMT'
      EXPORTING
        amount        = p_amt
        rndoff        = '100'.
       RNDLMT        = 'N'
     IMPORTING
       RETAMT        =
       DLTAMT        =
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 11:07 PM

    Hi,

    Please check this sample code.

    data: v_input  type p decimals 2,
          v_output type p decimals 1,
    
    v_input = '55.66'.
    
    CALL FUNCTION 'ROUND'
      EXPORTING
        decimals = 1
        input = v_input
        sign = '-'
      IMPORTING
        output = v_output
      EXCEPTIONS
        input_invalid = 1
        overflow = 2
        type_invalid = 3
        others = 4.
    
    if sy-subrc = 0.
      write: / v_output.
    endif.
    

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 12:02 AM

    Hi,

    Try this

    Data: dec(10) type c decimals 2 value '9.66',
             int type i.
    
    int = dec.
    
    Write int.

    Regards,

    Satish

    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.