Skip to Content
avatar image
Former Member

Rounding off currency value

Hi all,

Is there a function module to round off the currency value to nearest 0.05 , ie. if the currency value is 10.63, it should be rounded off to 10.65 and when it is 10.68, it should be rounded off to 10.70?

If yes, could you please let me know?

Any help in this regard is appreciated.

Regards,

Partha.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    May 19, 2006 at 09:33 AM

    Hi all,

    Thanks for all your replies.But my requirements are still not met.Let me quoate it again.If the currency value is 10.63 , it should be rounded off to 10.65 and when it is 10.67 , it should be rounded to 10.70.

    <u><b> 'ROUND' function module</b></u>

    The importing parameters as suplied by me:

    Decimal : '2'

    Input : '10.63'

    Sign : '+'.

    This returns 10.63 as output and not 10.65.The problem here is that i dont the two decimal to be rounded to one.

    Is there any other of giving importing parameters to ROUND function module to get it to rounded off to 0.05th decimal place.

    <u><b>Use of CEIL & FLOOR statements</b></u>

    These statements seem to be rounding the currency value to the nearest integer value.Rounds 10.63 to either 10 or to 11.

    More clarifications in this regard would be appreciated.

    Regards,

    Partha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 18, 2006 at 02:23 PM

    Hi Partha,

    You can use CEIL or FLOOR abap commands to achieve the same.

    Alternatively use the FM's

    1) ROUND_AMOUNT

    2) FI_ROUND_AMOUNT

    Cheers

    VJ

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 18, 2006 at 02:33 PM

    roundingoff-currency-fields

    Check the above thread and dont forget to award points if found helpful

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 21, 2006 at 02:37 PM

    hi,

    try this out.here is the sample program.

    pl look into my modified program,

    i am assuming your requirement is like

    if the last digit in your value is < 5. it should be rounded to 5.

    like 10.23 should come to 10.25

    & if the last character value is > 5 , it should be rounded to next value with 0.

    10.67 should be 10.70

    10.98 should be 11.00.

    with this assumption, i developed this small code. let me know, if i am wrong.

    regards

    srikanth

    DATA : V_CURR TYPE VBAK-NETWR,

    V_CHAR(10) TYPE C.

    V_CURR = '10.67'.

    WRITE V_CURR TO V_CHAR.

    CONDENSE V_CHAR NO-GAPS.

    DATA : V_STRLEN TYPE I.

    BREAK-POINT.

    V_STRLEN = STRLEN( V_CHAR ).

    IF V_STRLEN <> 0 .

    V_STRLEN = V_STRLEN - 1.

    IF V_CHAR+V_STRLEN < '5'.

    V_CHAR+V_STRLEN = '5'.

    V_CURR = V_CHAR.

    ELSE.

    IF V_CHAR+V_STRLEN = '6'.

    V_CURR = V_CURR + '0.04'.

    ELSEIF V_CHAR+V_STRLEN = '7'.

    V_CURR = V_CURR + '0.03'.

    ELSEIF V_CHAR+V_STRLEN = '8'.

    V_CURR = V_CURR + '0.02'.

    ELSEIF V_CHAR+V_STRLEN = '9'.

    V_CURR = V_CURR + '0.01'.

    ENDIF.

    ENDIF.

    ENDIF.

    write :/ v_curr,

    v_char.

    added modified code.

    Message was edited by: Srikanth Kidambi

    Add comment
    10|10000 characters needed characters exceeded

  • May 18, 2006 at 02:08 PM

    Did you try the function module ROUND ?

    Regards,

    Suresh Datti

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 22, 2006 at 08:25 AM

    Hi Gunjan,

    The function module HR_IN_ROUND_AMT looks to be perfect.Thank you.

    Thanks all for your replies and timely help.

    Regards,

    Partha

    Add comment
    10|10000 characters needed characters exceeded