Rounding of decimals

HI Experts,
I have issue in roundign of decimals. I need to round the values to 3 decimal places. But the sum of the values shud be 1.
Ex - 0.434456184, 0.483094697,0.082449119 are the three values. Their sum is 1. But if i reduce them to 3 decimal places i get only total as 0.999. If i use ROUND Funciton module i get the total as 1.001.
These values i am updating in Kp26 transaction which will allow me only 3 decimal places. Can you please help me reduce them to 3 decimal places and also not affecting the sum?

Hai.
Check this.
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_40b/helpdata/es/34/8e732f6df74873e10000009b38f9b8/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/write_op.htm
http://abapprogramming.blogspot.com/2007/06/lesson-21-statements.html
Regards.
Sowjanya.B.

Similar Messages

  • Rounding of Decimals(Essbase)

    Hi.....
    I'am having a problem in Essbase....
    i want to Round of decimals from 12 digits to 5 digits and my requirement are.
    1. Cube is an ASO Cube so, i cant write any Calc Script.
    2. Report Extraction is done in Excel.
    3. I had written a Fromula beside Scenario dimension like Round([ACTUAL+BUDGET+FORECAST], 5), insted of (A+B+F) we have to give the digits but it will change only that decimal value, i want to change all the data which is there in Scenario.
    can any one suggest solution for this, its really urgent
    Regards,
    Vijay.

    Create a new dimension (I'll call it view). with two members Input (or raw or whatever you wnat to call it) call the second member rounded-5(again whatever you want to call it) then have a formula on rounded-5 that is round([Input].currentmember,5)
    Note, I don't have mdx in fornt of me so the sysntax is just psudo code.
    This methodology would also give you the ability to do other things like have a 1000's member or millions member. Or many other variations

  • Reading data from force gauge rounding off decimals

    Hello everyone.  I am new to Labview and this is my first posting on the forum.  I am currently writing a program to record pull tests on crimps using a force gauge.  Everything is going fairly well for it being my first project except when the data I am reading from the force gauge is rounding off the decimals.  I am sure it is where I am using the absolute value and conversion functions but I am unsure the correct way I should be doing this.  Thanks in advance for any advice.  Also, I tried searching on this but did not come up with anything so I apologize if this is a redundant topic. 

    The reason you are losing your decimals is because of the data type you are using.
    If you notice, your indicator is blue, indicating it is "I8" (an 8-bit integer).
    Since it is an integer, by definitiion it has no decimal precision.
    After you read in the data string, try converting it to SGL (single precision float, 32-bit) or DBL (double precision float, 64-bit)
    Cory K

  • Rounding Packed decimals...

    Hi All,
    I've two fields (type P) with values 3000.00 & 2999.97
    While comparing these two fields I want to round the second field..... any ideas please.....

    Hi,
    do like this
    data: v1(10) type p decimals 2 value '101.59',
          v2 type i.
    v2 = v1.
    write v2.
    <b>Reward points for helpful answers</b>
    Satish

  • Rounding of decimals in totals

    I have noticed a difference in the behavior of BPS layouts vs. BEx queries (or using the LISTCUBE transaction to display InfoProvider contents directly).
    In the layout, I have chosen to display 0 decimal places for a key figure.  In a BEx query upon the same data, using the same basic design as the BPS layout, I do the same thing (i.e. no decimal places, round to the nearest whole dollar).
    BEx appears to total these amounts correctly.  That is, it totals up the raw values (which have their full decimal places internally) and then rounds up.  The BPS layout, on the other hand, appears to only be totaling up the already-rounded individual values.  This leads to slight differences between the totals as shown in the BPS layout vs. the BEx query.  However, these differences are enough to make many of our users nervous about BPS.
    Am I missing something basic in BPS configuration?  Is there some setting that influences this behavior to be more like BEx (the behavior I view as more correct).
    Thanks,
    John

    This thread is precisely the issue we are having with some of our layouts. We have allot of activity rate items and rounding is becoming an issue on some of the higher end calculations. 
    We can see the 'hierarchy' icon on the first step of the layout generation. But clicking that does not give us an option for 'calc data locally' ?? Presuambly we're looking in the wrong place OR there is a setting deeper that enables this cure.
    <u><i> Clicking the Hierarchy icon yields a dialogue box with theses items</i></u>
    o Non-Hierarchical Data Model
    o Hierarchical Data Model
    <b>Hierarchy type</b>
      o BW Hierarchy with Postable nodes
      o BPS Characteristic Hierarchies
    <b>Totalling Logic</b>
      o Top Down
      o Bottom up
    x Check Entry
    As always help is appreciated and rewarded
    _ Brent

  • Rounding Big Decimals

    I am using BigDecimal to minimize the error in rounding and the such, but I am getting a problem. I am using numbers that get no more complicated than .025 and yet I am getting BigDecimals that look like 2.9779999999999998. I need this number to actually be 2.978 instead of what it is, so I was wondering if there was a way to do this.

    There is a class called DecimalFormat which can set the number of decimal digits for you. For example, the following code sets the number of decimal digits to 5:
    DecimalFormat form =           (DecimalFormat)DecimalFormat.getInstance();
    form.setMaximumFractionDigits(5);
    Then you can use the format() method to format your number.
    Hope this helps!

  • Rounding condtion type decimals

    HI ALL,
    I have a requirement where for eg: Condition type PR00  is with 50.45 it should round off to 50.00
    or if it is 50.95 also inthat case also it should round off to 50.00
    i tried doing rounding rule in conditon type, it is only rounding the decimals
    i dont want any decimals
    Please let me knw if any one has the answer
    Syed

    Hello,
    In transaction V/06 there is a field under header 'Control data1' which can effect how the system rounds off condition values during pricing:
       ->> Rounding rule
           The rule that determines how the system rounds off condition
           values during pricing. The last digit will be rounded.
    Example
    o  In the standard rounding rule '_', values are rounded off according
       to business standards:
       10.454 -> 10.45 DEM
       10.455 -> 10.46 DEM
    o  In rounding rule 'A', values are always rounded up:
       10.459 -> 10.46 DEM
       10.451 -> 10.46 DEM
    o  In rounding rule 'B', values are always rounded down:
       1045.9 -> 1045 LIT
       1045.1 -> 1045 LIT
    Please try using the rounding rule 'B' for your scenario.
    I hope you find this information very helpful and hopefully it will solve your problem.
    Regards,
    Martina McElwain
    SD - Forum Moderator

  • Unit of measure EA allows transactions in decimals ? Is EA indivisible?

    Unit of measure EA allows transactions in decimals ? Is EA indivisible?
    There are two scenarios. While creating a Bill of material - based on the configuration (see below) if you enter a quantity with decimals for a part number for which the Basic UOM is EA the system displays a message "Unit of measure EA does not support decimal places" THIS IS GOOD AS EXPECTED
    While transacting using MB1B, MB1C, MB1A, MFBF, MIGO or other transactions the system DOES NOT check and it is currently allowing us to post with decimals (1.25, 1.312) for part number for which the unit of measure is EA.
    Was not EA supposed to be an indivisible unit of measure? why is the warning message getting activated while creating or changing a BOM and why not while transacting stock?
    We have configured EA in the CUNI transaction as follows:
    Int. meas. unit      EA                                                  
    Commercial           EA              each                               
    Technical            EA              each                               
    Decimal places                                                          
    float. point exp.                                                                               
    ISO code             EA            
                                          Primary code                       
    Numerator            1                                                  
    Denominator          1                                                  
    Exponent             0                                                  
    Additive constant    0.000000       X Commercial meas.unit               
    Decimal pl. rounding                 Value-based commt                  
    Unit of meas.family

    you cannot restrict this behaviour with CUNI customizing, you can only check and stop this in a user exit.
    SAP inventory managment allows and stores 3 decimals for any unit of measure. You can only define how it will show the value to the users and how it will round the decimals if it calculates the conversion. But if you enter manually with decimals, then SAP will not round this.
    please read OSS Note 931971 - Decimal places in stocks and stock postings
    and
    Note 77525 - Quantity unit conversion in inventory management

  • How to use Round off function in TAX Formula

    Dear All,
             I have to do Round off in the Tax Formula. Hence I was suggested by the SAP Forum Team to use Round off function in the Tax Formulae.
             But sir I don't know how to use Round off function in the Tax Formulae.
            For Eg. BaseAmt = Total
                        TaxAmt = BaseAmt * Rate
               Now within this Eg. How will i use the Round off function and where i will use it.
               Please guide me with example.
      Regards
    Hitesh Parsawala

    Hi Hitesh,
    you can do like this
    Cess_ST_TaxAmt=Round(Cess_ST_BaseAmt*Cess_ST_Rate,0)
    where you can introduce rounding function by choosing from dropdown available in Operation and by click on Insert.
    It will post following in formulla window
    Round (Number, Decimals as Number)
    where in parameter you have to give 1.Number-which is to be round and 2.Decimals as Number-as per your requirement like by 2 decimal or 0 decimal
    If required give me call,
    BR
    Samir Gandhi

  • Rounding up a variable

    Hi All,
    Is there any function module or any way to round up a variable.
    For ex: 0.8 should become 1
         and 0.3 should become 0.
    Thanks.

    HI,
    Check ROUND FM ....
    DATA : V_VAL TYPE P DECIMALS 2 VALUE '5.6',
           V_VAL2 TYPE P DECIMALS 0.
    CALL FUNCTION 'ROUND'
      EXPORTING
       DECIMALS            = 0
        INPUT               = V_VAL
    *   SIGN                = ' '
    IMPORTING
       OUTPUT              = V_VAL2
    * 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 : V_VAL2.

  • Rounding up doubles

    Just wondering if anyone knows how to round up a double so that for instance 100.232323 can be up to 100.
    This is due to trying to convert a price in pence to a meaningful price.
    Also is there anyway to represent a figure in pounds and pence???
    Regards.

    If you are working with money you shouldn't do floating point arithmetic. You should either use one of the following:
    1. java.math.BigDecimal. See example: double monthlyInterest = 5.5d / 1200d;
    double monthlyPayment = 700.25d;
    BigDecimal interestAmount = new BigDecimal(monthlyInterest).setScale(5,BigDecimal.ROUND_HALF_UP);
    BigDecimal principalAmount = new BigDecimal(monthlyPayment).setScale(2,BigDecimal.ROUND_HALF_UP);
    BigDecimal appliedPayment = payment.subtract(interestAmount).setScale(2,BigDecimal.ROUND_HALF_UP);
    //to get their double values just do (for example)
    double i = interestAmount.doubleValue();
    double p = principalAmount.doubleValue();
    double payment = appliedPayment.doubleValue();2. Multiply all numbers by a power of 10 (for example 100) and then truncate or round the decimals, then do your arithmetic, then divide by the same number. To truncate, just cast your double value to an int.int newValue = (int) someDoubleValue;To round, you can use any of the java.lang.Math methods.Math.ceil(someDoubleValue);
    Math.floor(someDoubleValue);
    Math.round(someDoubleValue);You can do your own research. :)
    The reason why you should not do floating point arithmetic is because it is not accurate.

  • Rounding a quantity field to one decimal place. PLEASE URGENT

    I have a quantity field with three decimal places. I have to print this field with only one decimal place. This is in a smartform.
    suppose: qty = 45.678
    I want it to be printed as 45.7
    Thanks in advance.

    Hi Riki,
    I think you can use Function Module ROUND to round off the value...
    REPORT ZTEST_SHAIL4 .
    data: out type p decimals 1,
    inp type f.
    inp = '45.678'.
    CALL FUNCTION 'ROUND'
    EXPORTING
    DECIMALS =
    input = inp
    SIGN = ' '
    IMPORTING
    OUTPUT = out
    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.
    Now use the variable 'out' to display the rounded off value...
    Regards,
    SP.

  • Taxes rounding *

    Hi all,
                                           Sale price   10000.00
                                  P& F 3%            300.00
                            Assessable value       10300.00
       BE Duty 14% on sale pri              1442.00 (R/off to next rupee)
       ECS 2% on BED                            29.00 (28.84 Rounded off)
       SHE 1% on BED                            15.00 (14.42 Rounded off)
                                       Subtotal       11,786.00
    In the above scenario - the BED, Education Cess & Higher Education cess are rounded off to the next rupee. I has to configure the same scenario in the system.
    while doing tax formula setup - there are some options @ the operation dropdown list
    1. Round(Number, Decimals as Number)
    2. Round(Number, Type)
    How the above two are useful & where that has to be inserted in the formula.
    BED formula:
    if (AssessableValue > 0)
    { BED_N_BaseAmt =  AssessableValue*Qty+PNF_TaxAmt }
    else
    { BED_N_BaseAmt = Price*Qty + PNF_TaxAmt }
    BED_N_TaxAmt=BED_N_BaseAmt*BED_N_Rate
    Education Cess formula:
    CES_N_BaseAmt=BED_N_TaxAmt
    CES_N_TaxAmt=CES_N_BaseAmt*CES_N_Rate
    Higher Education cess formula:
    SHE_N_BaseAmt=BED_N_TaxAmt
    SHE_N_TaxAmt=SHE_N_BaseAmt*SHE_N_Rate
    Thanks & Regards
    Ganesh Varma. G

    Hi
    Thanks for u'r reply
    As per u'r scnario:
    For me total = 719,810
    BED@14% = 100,773(but actual =100773.40)
    Ecess@2%= 2,015 (but actual=2015.46)
    Hcess@1%= 1008 (but actual=1007.734)
    I want Both BED & Ecess to be rounded up to next rupee
    As per my scenario - i want it in the below way (check the star marks)
    BED@14% = 100,774 (but actual =100773.40)
    Ecess@2%= 2,016 (but actual=2015.46)
    ex: even if it is 10.01(it should round off to 11.00)

  • Rounding a decimal to 1 up

    Hi All ,
    I need help in rounding a decimal to intezer up by one value ,
    i.e 1.001 to rounded to 2 .
    Thanks and regards
    vinay

    Hi,
    plz try ROUND function module.
    data input type p decimals 3 value '1.001'.
    data output type i.
    CALL FUNCTION 'ROUND'
      EXPORTING
       DECIMALS            = 0
        input               = input
       SIGN                = '+'
    IMPORTING
       OUTPUT              = 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: output.
    thanx .
    Edited by: Dhanashri Pawar on Sep 22, 2008 9:21 AM

  • Round FM always INPUT_INVALID

    Hi!
    I need to do conversion from/to JPY currency for updating prices. Since the currency does not allow decimal places, I though of rounding off the amount first with 0 decimal places if JPY is the currency.
    I am testing FM ROUND in SE37 and I always get INPUT_INVALID Message: Please use a number field for the input value.
    I should place a number in the input field, right? I expect that when I put
    Decimals 0
    Input         24.6
    Sign
    I will have output
    25.
    But then I always get the input:invalid error no matter what I enter in the decimals and input field.
    Can someone help? Thanks!

    Hi ,
    It works inside the code, even though getting error in SE 37 .It is because function module picks import and export parameter based on the variable you are passing to it .
    DATA :  lv_in   TYPE F VALUE '410.73' ,
             LV_P    TYPE P DECIMALS 2 ,
             LV_OUT  TYPE p DECIMALS 0 .
    move LV_IN TO LV_P .
    CALL FUNCTION 'ROUND'
       EXPORTING
         DECIMALS            = 2
         input               = LV_P
         SIGN                = '+'
      IMPORTING
        OUTPUT              = LV_OUT
    * EXCEPTIONS
    *   INPUT_INVALID       = 1
    *   OVERFLOW            = 2
    *   TYPE_INVALID        = 3
    *   OTHERS              = 4
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.
    Try this sample code its working fine .
    Regards ,
    Juneed Manha

Maybe you are looking for

  • How to prevent caching of Http Authentication

    Hello all, I'm having trouble with a custom wrapper for the URL object that I wrote which is to be run from a multi-threaded program. Basically what I have is an application server that interacts w/ native code through message queueing. As the applic

  • Cannot open a file anymore

    Good morning I have a strange problem, first time it has ever occured to me. I have a big file that cannot be opened anymore. The shortcut to the file doesn't open the file either. The documents inside the file can be opened from the spotlight select

  • How to Skip validation

    Hi , I am using Jdeveloper 11.1.1.3 .I am having an af:table in my page, and i have a command link which calls a method in a backing bean. While clicking on the command link i want to skip the validations that happens in the table rows, without using

  • Moving emails - synchronisation issue (N8)

    Recently (last week or so) when I try and move an email from my ovi mail inbox to a personal mail folder using my N8 it can take several attempts to before anything happens and the message appears to move (manually synchronising to check this after e

  • My music is all in weird letters...

    i just got a new hard drive and followed the steps to get my music from my ipod onto my computer which worked just fine. Now that they're all on my itunes again, some of the songs never converted back to their names. Most of them did but how do i get