Rounding-off Currency fields.

Hi,
Can someone tell me how to round-off value of currency field.
If fraction <= 0.49 it should be rounded-off to 0.00
If fraction >= 0.50 it should be rounded-off to 1.00

Hi, you have the Function Module ROUND too,
here a litle example ( the paremeter sign = 'X' set how the number will be rounded )
DATA l_input TYPE p DECIMALS 5.
break-point.
l_input = '0.499'.
CALL FUNCTION 'ROUND'
  EXPORTING
    decimals      = 0
    input         = l_input
    sign          = 'X'
  IMPORTING
    output        = l_input
  EXCEPTIONS
    input_invalid = 1
    overflow      = 2
    type_invalid  = 3
    OTHERS        = 4.
l_input = '0.500'.
CALL FUNCTION 'ROUND'
  EXPORTING
    decimals      = 0
    input         = l_input
    sign          = 'X'
  IMPORTING
    output        = l_input
  EXCEPTIONS
    input_invalid = 1
    overflow      = 2
    type_invalid  = 3
    OTHERS        = 4.
Saludos
Daniel

Similar Messages

  • Rounding off Currency field

    Hi,
    I have to round off a currency field. Can some one provide the syntax for this.
    I have tried: WRITE lv1 ROUND 2.
    But I dont want to display it in output, I have to put round off value into another field.
    Regards,
    Pankaj.

    Hi,
    Check the below code
    PARAMETER : p_cur TYPE wrbtr.
    DATA : w_currency(10) TYPE c.
    WRITE p_cur ROUND 2 TO w_currency.
    w_currency = w_currency * 100.
    WRITE / w_currency.
    W_currency will have the round off value....

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

    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

  • Rounding a currency field

    Hi experts,
    data: field1 type [currency field of size 15, decimals 2].
    field1 = 25.87.
    I want the value of field1 to be always rounded to 25.
    Please suggest a way.
    Pts will be rewaurded.

    Hi,
    Use ceil( ) function.
    Ex. a = ceil ( 398.98).
    wreite:/ a.
    or
    Call 'ROUND' Method as below
    DATA: WA_INPUT TYPE P DECIMALS 8,
    WA_OUTPUT TYPE P DECIMALS 2.
    WA_INPUT = '123.6581'.
    CALL FUNCTION 'ROUND'
    EXPORTING
    INPUT = WA_INPUT
    IMPORTING
    OUTPUT = WA_OUTPUT
    EXCEPTIONS
    INPUT_INVALID = 1
    OVERFLOW = 2
    TYPE_INVALID = 3
    OTHERS = 4.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE: WA_OUTPUT.
    Hope it helps you.

  • Rounding off currency

    Dear Gurus,
    Can some one tell me how the rounding for works.
    Financial Accounting ->AR/AP->Business Transaction->Outgoing Payments->Define Account for Rounding off difference.
    My client require the following scenario.
    a. Client wanted to book all the invoies with decimals at liability booking(FB60).
    Eg : 110.36 and 110.56
    b. While making payment(F-53 or F-58) he waanted to round off the decimals(as he do not want to cut the cheque for decimals
    Eg : 110 and 111
    Please help me to configure to get the out put
    Thanks
    Raju.

    Hi
    Have tolerances set up for the user as well as customer/vendor. This will automatically knock off the differences and you can pay in round amount
    S Jayaram

  • Rounding off net weight value.

    Hi experts,
    I want to round off the quantity value to the next integer value.
    I am using the FM 'J_1I6_ROUND_TO_NEAREST_AMT' as follows...
    call function 'J_1I6_ROUND_TO_NEAREST_AMT'
    exporting
       i_amount = gross_weight
       i_amount1 = net_weight
    importing
       e_amount = gross_weight
       e_amount1 = net_weight.
    i want to round off the gross weight and net weight values.
    In Global definitions, these are given as of type VEKP-BRGEW. The field BRGEW is of datatype QUAN (length - 15 and decimal -3 )
    But when i tried executing i am getting dump .... saying
    "The function module interface allows you to specify only
    fields of a particular type under "I_AMOUNT".
    The field "GROSS_WEIGHT" specified here is a different field type"
    Please help me solve this and please let me know how to round off these fields.
    Regards
    Ammu

    Hi,
    the both fm parameters you fill have a currency data element of length 13, while you pass a quantity data element of length 15.
    You can't use this fm for your fields.
    Regards,
    Klaus

  • Rounding off to 0.05 decimal

    Post Author: masto123
    CA Forum: General
    Hi there,
    I am tring to round off a field which is displayed in AUD currency as $23.43 to $23.45. I have tried the round function
    round(,0.05) but I get an error. Is there any other way.
    pls help.
    regards
    m

    Post Author: yangster
    CA Forum: General
    If its a numeric value either a simple field or a summed field you should simply be able to format the number field and apply custom formatting to change it to 2 decimal places.  If its a text field you can use totext(field, 2).but the problem with your formula is that the format is round(field, #places)# of places needs to be a whole number not a fractionround(field, 2)

  • ROUND OFF IN CURRENCY FIELD

    Hi,
    In my report I am displaying the currency field NETWR in ALV Report.
    Now, the requirement is as such-
    For eg- If the value of NETWR field is 57,441.50 then I want to round it off to display only 57(assuming that all values in thousands) i.e 57,441.50 would be considered as 57,000 only.
    I think there is some functional module to solve this problem.
    Can somebody help me regarding the same,points will be rewarded.

    Hi friend
    Try this.
    Check this sample:
    DATA: WA_INPUT TYPE P DECIMALS 8,
    WA_OUTPUT TYPE P DECIMALS 2.
    WA_INPUT = '5678.65800341'.
    CALL FUNCTION 'ROUND'
    EXPORTING
    INPUT = WA_INPUT
    IMPORTING
    OUTPUT = WA_OUTPUT
    EXCEPTIONS
    INPUT_INVALID = 1
    OVERFLOW = 2
    TYPE_INVALID = 3
    OTHERS = 4.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE: WA_OUTPUT.
    OR this,
    DATA: I TYPE I,
    P TYPE P DECIMALS 2 Value '3.5'.
    I = P.
    Reward if helpfull.

  • Small Differences Rounding Off in case of Payments in Foreign Currency

    Hi all
    I have a scenario wherein I want to round off the Foreign Exchange amount to the nearest Rupee. I.e when I am making a payment in Foreign currency, the amount in local currency appears upto 2 decimal places. However, I  want the same to be rounded off to the nearest rupee.
    E.g I am making a payment of USD 111 @42.1277 which comes to 4676.17 in the local currency INR. Now I want the system to round off the amount to 4676 at the time of the payment transaction itself. Is this possible through the RDF key in Forex Automatic Postings? If yes, then I already have an account assigned there but the system does not round off the amount.
    Help would be highly appreciated.
    Cheers
    Hrishi

    i'm not aware of that functionality.
    But you can always add some logic into your fast formulas, so that the data is alreay rounded for cash payments, before you launch Prepayments.

  • Foreign Currency rounding off while conversion

    Hi All,
    I am experiencing a scenario while foreign currency conversion.
    I have searched for a solultion but i am unlucky to find one regarding this problem.
    The scenario:
    Example:
    Foreign Curr      |    Value    |       Rate     |     SAP converted Local Curr(Yen)   |    Act Con Value(Y)
    Euro                 |    1210Eur|       127.99Y|     154868Y                                   |   154867(-veRound Off)
    Is there any setting where you can round off the converted amount to its negative whole amount?
    I have searched all the setting in Foreign Currency transactions(OB52,OB59) but couldnt find.
    Hope i can get a solution.
    Regards
    Andrew

    Hi
    Reason and Prerequisites
    u2022Your tax country is Slovakia
    u2022You billed an order with several items in foreign currency,
    u2022where the exchange rate factor between foreign currency and local
    u2022currency is very large or very small.
    u2022The accounting document created during the billing has a tax line item that contains incorrect amounts in local currency
    Solution
    The solution is using the same solution as note 832477 and 32477 with the difference that the country is Slovakia. For other countries you should put the variable L_LAND1 to the string that represent the country.
    Limitations:
    The solution will NOT lead to a recalculation of taxes in local
    currency. However, it will serve to minimise any rounding differences
    which may arise from converting the individual tax lines which are
    transferred from SD to FI. In most practical cases, this should fulfill
    the legal requirements, even though rounding differences may occur for
    individual documents in special cases.
    Regards
    uday

  • Web dynpro + adobe form decimal field round off

    hello all,
    I am now developing an application which is based on the SAP WebDynpro and Adobe form, but the application has an error, if one can help me to resolve the error, I will be very thankful.
    The error is as follows, for a decimal filed on the Adobe form which is binded to a deicmal attribute of Webdynpro, if I get the value of the decimal field using the programming code as "context.nodexx.getAttribute("xx")", the decimal value is rounded off (e.g., 2.4 is changed to 2.0, 2.7 is changed to 3.0).
    for example:In Web Dynpro,  A node name is  "TestNode" which has a  type of decimalattribute named "TestAttr" ,  in  adobe form  a decimal field  bind to the TestAttr . when i input 2.3  in  adobe form,  i  click the button with code:
    this.wdComponentAPI.getMessageManager.reportSuccess(this.wdContext.nodeTestNode.getTestAttr()+"");
    the rusult is  :     2.0
    if  i  input  the  value  2.5   the result  will be  3.0
    Thanks All !

    Hi,
    there is a special display pattern to check for null values:
    null{pattern}
    Example:
    null{'please enter a value'}
    But I don't know if WDJ is really sending a null value. You can combine this with alternatives using '|' to separate alternatives.
    Regards,
    Juergen

  • Currency Conversion Round-off problem

    Hello
    My customer is in import business.
    When a journal entry is made in Dollar it is converting into Indian Rupee (local currentcy), which is correct
    but it is not rounding off. Also user cannot change it mannualy to adjust the roundo-off figure
    Is there any solution to this
    Regards
    Indrajit

    Hello Indrajit,
    What is your rounding setting for currency?
    Thanks,
    Gordon

  • Round off at the field catalog with no decimals

    Hi,
    I'm using an ALV grid to display the data. The field catalog is defined as follows.
    fieldcatalog  TYPE slis_t_fieldcat_alv
    Is it possible to round off at the field catalog itself. For example, i have qty as 100.696 in the itab, i want to make it 101.
    What can be used to do this at the fieldcatalog stage?
    Thanks
    Keshi

    Keshini,
      Why con't you round of the value while moving into itab.
    Ex :
             LOOP at Itab.
               round ( itab-field ).
             move itab-field  to i_final-field.
             endloop.
    Ex :
      DATA pack TYPE p VALUE '123.456'
                            DECIMALS 3.
    WRITE pack DECIMALS 2.     123,46
    WRITE: / pack ROUND -2,        12.345,600      
               / pack ROUND -1,          1.234,560
             / pack ROUND 1,             12,346
             / pack ROUND 2.               1,235
    ROUND <r>    -
    Type P fields are multiplied by 10**(-r) and then rounded.
    Pls. Reward if useful

  • Rounding of a field in Internal table

    Hi ,
    I have a quantity field(menge)  in an internal table( i_tab) . In a loop at the internal table(i_tab) , I want to round off the quantity to x decimal places . 'x' will be different for each record , depending on some logic.
    Through what syntax do I achieve this ?
    Regards,
    Sujata

    HI,
    Using the write statment, you can write the addition  DECIMALS d
    <b>Effect</b>
    d specifies the number of decimal places for a number field (type I , P or F ) in d . If this value is smaller than the number of decimal places in the number, the number is rounded. If the value is greater, the number is padded with zeros.
    Since accuracy with floating point arithmetic is up to about 15 decimal places (see ABAP/4 number types ), up to 17 digits are output with floating point numbers (type F ). (In some circumstances, 17 digits are needed to differentiate between two neighboring floating point numbers.) If the output length is not sufficient, as many decimal places as possible are output. Negative DECIMALS specifications are treated as DECIMALS 0 .
    <b>Example</b>
    Effect of different DECIMALS specifications:
    DATA: X TYPE P DECIMALS 3 VALUE '1.267',
          Y TYPE F            VALUE '125.456E2'.
    WRITE: /X DECIMALS 0,  "output: 1
           /X DECIMALS 2,  "output: 1.27
           /X DECIMALS 5,  "output: 1.26700
           /Y DECIMALS 1,  "output: 1.3E+04
           /Y DECIMALS 5,  "output: 1.25456E+04
           /Y DECIMALS 20. "output: 1.25456000000000E+04
    <b>and also you can use ROUND</b>
    <b>Effect</b>
    Scaled output of a field of type P .
    The decimal point is first moved r places to the left ( r > 0) or to the right ( r < 0); this is the same as dividing with the appropriate exponent 10** r . The value determined in this way is output with the valid number of digits before and after the decimal point. If the decimal point is moved to the left, the number is rounded.
    For further information about the interaction between the formatting options CURRENCY and DECIMALS , see the notes below.
    &ABAP-EXAMPLE& Effect of different ROUND specifications:
    DATA: X TYPE P DECIMALS 2 VALUE '12493.97'.
    WRITE: /X ROUND -2,   "output: 1,249,397.00
           /X ROUND  0,   "output:    12,493,97
           /X ROUND  2,   "output:       124.94
           /X ROUND  5,   "output:         0.12
    So, in your Loop, use the WRITE TO statment to move the internal table data with the perfect decimal places for each single field in the loop
    Regards
    Sudheer

  • Withholding Tax - Rounding Off

    Hi,
    I have problems on my withholding tax setup, it automatically round off even if my settings in the currency is NO ROUNDING.
    My SAP is 8.8 patch 13. I have no problems on Vat, only on withholding tax amount.
    Kindly advise.
    Thanks,
    Harlene

    There is country specific settings in "Setup -> Financials -> Tax -> Withholding Tax", rounding type for Autralia and New Zealand.
    Refer to the help file for the rounding details.
    Country-Specific Fields: Australia & New Zealand
    Rounding Type Choose the relevant rounding type from the drop-down menu:
    Truncated AU u2013 this option is relevant for a penalty withholding tax. The tax amount calculated is truncated, and appears without decimals, for example, a tax amount of 72.25 is truncated to 72.
    Example
    If the withholding tax is posted when payment occurs, the calculation is done as follows:
    You create a payment for an invoice whose total value is 11.6 (=net value 10 + 16% vat), and the withholding tax is 18%.
    The total of 11.6 is truncated to 11.
    The WT is calculated as: 11*18% = 1.98
    The WT amount is truncated to 1.
    Result: The posted value of withholding tax is 1, and the bank account is credited for 10.6
    End of the example.
    Commercial Values u2013 this option is relevant for voluntary withholding tax. In this case the rounding calculation is done as follows:
    1 to 49 cents is rounded down to the nearest dollar, for example, 34.27 becomes 34.
    50 to 99 cents is rounded up to the nearest dollar, for example, 50.68 becomes 51.
    Example
    The following explains the calculations when creating the payment for the invoice mentioned above, but according to commercial rounding:
    The invoice total is 11.6.
    Withholding tax = 11.6*18% = 2.088. This amount is rounded to 2.
    A value of 2 is posted for withholding tax while the bank account is credited for 9.6.
    End of the example.
    BR.
    Joyce

Maybe you are looking for

  • Print PDF document with printer's name and date/time of print

    Hi, I'm pretty new to this... I have a PDF document and when I print it, I want the printer's name and the date/time of print to be showed on the printer's output. I have several printers (some local and some on network) and don't necessarly use the

  • IPod stuck in "do not disconnect" and NOT recognized by iTunes

    I updated to 7.1.1.... and my iPod is not stuck in "do Not disconnect" and not recognized by iTunes. I have tried the Toshiba "Safely Remove Hardware" -- and selecting the iPOD -- but, notice comes back "cannot disconnect now because a program is acc

  • How to capture the logged in user in SBO

    Hi All How can i capture which user is logged in sbo in that particular instance. Is there any possibility? Tha

  • Issue with Installing Oracle 10g R2 on a Windows 2008 Domain Controller

    I'm assigned a evaluation task for my company. The task invoke to install oracle in my Domain Controller Server. I got "ORA-12560: TNS:protocol adapter error" when I installed ORACLE 10g R2 for Win2K8 on my Windows 2008 (a Domain Controller Server).

  • Preparing User Accounts on windows 2008 R2

    Hi , To create account for hyperion  installation purpose oracle documents says below: Assign local policies if required by your product. For Windows, the user ID typically requires "Act as part of the OS, Bypass Traverse Checking, Log on as a batch