Rounding of a value to 2 decimal points.

Hi all,
I need to round off a value to 2 decimals.
For example:
A value 13.6789 should be rounded of to 13.67 and not 13.68

Hi,
Thats Truncation not rounding, for data types P and F we cannot have sub field access,
so we cannot use offset, it leads to error results
and if we use
data : var type p decimals 2     they will be rounded hence  
So, pass it to   a character variable
and use write satement edition
example
data : var(7) type p decimals 4  value '13.6789 ' .
write /  var.
data : var1(8) type c.
move var to var1.
write /(5)  var1.
regards
prasanth

Similar Messages

  • Any function module to round of a value to two decimal places?

    Hi gurus,
    Any function module to round of a value to two decimal places?

    Hi,
    you can use FM 'ROUND'.
    Thanks.

  • Rounding off during APP (f110) of decimal point

    Hi
    Can any one help me? When I run the T.Code f110 for automatic payment programme is generate cheque propaly, here my client want to rounding off for the decimal point in cheque amount as if coin adjastment.

    Hello Arup,
    I guess OB90 is helpful to you so pls check the same.
    Thanks & Regards,
    Lakshmi S

  • Rounding up a value to the nearest point

    Hello, I have got alot further with my project now, but, I
    want to be able to round up a result from a recordset to within two
    decimal places. ie, the result displayed is 21.3456789, I would
    like to get it 21.34 with a £ sign at the beginneing of it.
    Here is my code.
    Thanks in advance
    Paul

    swanside1 wrote:
    > HGI and thanks for that. I put the code in, but for some
    reason, I cant get it
    > to work.
    As has been said countless times in this forum, a basic
    understanding of
    code is essential to working with Dreamweaver. Without it,
    you're left
    going round in circles.
    > $addcost is the recordset that calculates the main cost.
    >
    > <?php
    > $addcost = $amount;
    > echo '&pound;'.number_format($amount, 2);
    > ?></p>
    Your mistake here is the result of a common misunderstanding
    of the
    meaning of what the = sign is used for. Most people naturally
    think back
    to their school days, and think it means "is equal to". In
    most
    programming languages, like PHP, it means "is set to". So,
    $addcost = $amount;
    does not mean "$addcost and $amount" are the same, but
    "$addcost is set
    to $amount". To set $amount to the same value as $addcost,
    you need to
    do this:
    $amount = $addcost;
    However, even that won't solve your problem. You say that
    $addcost is
    the recordset. In other words, it contains lot of values.
    What I gave you was a simple example of how number_format()
    works. In my
    example, $amount was set to 10.757999706268. Passing that
    value to
    number_format() in the way I showed changed its value to
    10.76.
    So, let's say the recordset field that you want to format
    that way is
    called $row_addcost['total'], you use number_format() like
    this:
    echo '&pound;'.number_format($row_addcost['total'], 2);
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • May I know how to round a double number to 2 decimal points?

    if I have a double number 135.25689951591, how can I round this number to make it output as 135.26?

    double number = 135.25689951591;
    java.text.DecimalFormat df = new java.text.DecimalFormat("#.00");
    System.out.println(df.format(number));Alll this will do is display the value 135.26, number will still hold 135.25689951591

  • Any std funtion(s) for Zero-padded, 2 decimal value, without the deci point

    Hi,
    We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    I have done "multiply" with 100 and "formatNumber" as '000000'
    SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    Regards,
    N@v!n

    >
    N@v!n Kumar wrote:
    > Hi,
    >
    > We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    > I have done "multiply" with 100 and "formatNumber" as '000000'
    >
    > SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    >
    > It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    >
    > Regards,
    > N@v!n
    public void convert_number(String[] FieldValue,ResultList result,Container container){
    FieldValue = FieldValue * 100;
    result.addValue(FieldValue);

  • Convert the money datatype to a 2 decimal point format.

    Whats the best way to convert the money datatype to a 2 decimal point format in ms sql 2005 for use in my applications.
    this?
    CAST(tr.depositReceivedAmount AS decimal(10 , 2))

    I respectfully disagree with the notion that you should change the SQL column from a 'money' data-type to something else.
    In most database servers, 'money' is a data type that is designed to provide very consistent behavior with regard to arithmetic accuracy.  In Microsoft Access, the representation is a scaled-integer.  In MS SQL Server, it is obviously similar.  Ditto Oracle and all the others.
    You want the money data-type in the database to have this accuracy, because "hell hath no fury like an accountant in search of one lousy penny."   The database column storage-formats are designed to satisfy accountants, and that is a Good Thing.
    Meanwhile, you also want to take care as to exactly how you deal with the values.  There are several points where rounding could take place.  You do not have at your disposal the strongest possible handling of floating data-types in ColdFusion.  You are also somewhat at the mercy of whatever interface software may lie between you and whatever SQL server you may use.  "It's okay to round values once, but not multiple times."
    I suggest rounding the value right before display, and stipulating that the user's input must be two decimal places.
    Then, you might have to do some things at the SQL server's end.  For instance, when you update a value in the table, you may need to use server-side logic to explicitly truncate the value to two decimal-points, so that an update of "$34.56" explicitly updates the column to "$34.5600."  (This sort of thing has to happen within the SQL server context.)  You know that the user's input has exactly two significant digits, but maybe (maybe not...!) the SQL server might not know this.  You want to ensure that the server's internally-stored value represents exactly two significant digits, when the value originates from a user-input.
    Don't err on the side of "your convenience" or "what looks good on-screen."  (If you do, get ready to get phone-calls from the accountants, always at inopportune hours of the night.)

  • Rounding a float value

    totalamount = totalamount + Float.parseFloat(amount1);
    From the above code I am getting totalamount which is of float datatype. The value has more than two decimals like 123.23232 I need to round it to 123.23. How could this be done ? Any help is appreciated.

    You can do the following to round to two figures after the decimal point, rounding to the nearest neighbor, if they are equidistant, round up:
    totalamount = totalamount + Float.parseFloat(amount1);
    BigDecimal bigDecimal =new BigDecimal(totalamount ).setScale(2,bigDecimal.ROUND_HALF_UP);
    I hope this helps,
    Val.

  • Working With Prices/Decimal Points

    I've recently figured out how to perform calculations on values by assigning them to variables in a click function however I'm working with prices in my app and it seems difficult to get prices/decimal points to claculate properly. At the moment my app looks like this:-
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:Script>
    <![CDATA[
    private function getTotal():void{
    var addon1Int:int = parseInt(addon1.text);
    var addon1Float:Number = parseFloat(addon1.text);
    var addon1Number:Number = new Number(addon1.text);
    var addon2Int:int = parseInt(addon2.text);
    var addon2Float:Number = parseFloat(addon2.text);
    var addon2Number:Number = new Number(addon2.text);
    var addon3Int:int = parseInt(addon3.text);
    var addon3Float:Number = parseFloat(addon3.text);
    var addon3Number:Number = new Number(addon3.text);
    var addon4Int:int = parseInt(addon4.text);
    var addon4Float:Number = parseFloat(addon4.text);
    var addon4Number:Number = new Number(addon4.text);
    var addon5Int:int = parseInt(addon5.text);
    var addon5Float:Number = parseFloat(addon5.text);
    var addon5Number:Number = new Number(addon5.text);
    var quantityNumber:Number = new Number(quantity.value);
    total.data = (addon1Number + addon2Number + addon3Number + addon4Number + addon5Number) * (quantityNumber);
    ]]>
    </mx:Script>
    <mx:Text id="addon1" text="5.99"/>
    <mx:Text id="addon2" text="6.99"/>
    <mx:Text id="addon3" text="8.99"/>
    <mx:Text id="addon4" text="4.99"/>
    <mx:Text id="addon5" text="3.99"/>
    <mx:NumericStepper id="quantity"/>
    <mx:Button label="Button" click="getTotal();"/>
    <mx:Text id="total"/>
    </mx:Application>
    It works ok if the numbers in the text areas are whole numbers like 8 or 4 but if I use numbers like 02.99, 05.09 the result comes out a bit srange. For example the result of the numbers that I have in there now if I set the value to 2 in the numeric stepper is 61.900000000000006 when I know from using a real calculator it should be 61.9. Is there any way perhaps of rounding this code to the nearest decimal point so it appears as 61.90?
    Are there any good tutorials that any of you know of when working with prices/decimal points in flex?

    I've managed to find the solution for this - the currency formatter. If anyone's interested or has similar problems her's the code that solves it for me:-
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.formatters.NumberBaseRoundType;
    private function getTotal():void{
    var addon1Int:int = parseInt(addon1.text);
    var addon1Float:Number = parseFloat(addon1.text);
    var addon1Number:Number = new Number(addon1.text);
    var addon2Int:int = parseInt(addon2.text);
    var addon2Float:Number = parseFloat(addon2.text);
    var addon2Number:Number = new Number(addon2.text);
    var addon3Int:int = parseInt(addon3.text);
    var addon3Float:Number = parseFloat(addon3.text);
    var addon3Number:Number = new Number(addon3.text);
    var addon4Int:int = parseInt(addon4.text);
    var addon4Float:Number = parseFloat(addon4.text);
    var addon4Number:Number = new Number(addon4.text);
    var addon5Int:int = parseInt(addon5.text);
    var addon5Float:Number = parseFloat(addon5.text);
    var addon5Number:Number = new Number(addon5.text);
    var quantityNumber:Number = new Number(quantity.value);
    var total:Number = (addon1Number + addon2Number + addon3Number + addon4Number + addon5Number) * (quantityNumber);
    totalAmount.text=currencyFormatter.format(total);
    ]]>
    </mx:Script>
    <mx:CurrencyFormatter id="currencyFormatter" precision="2" rounding="none" decimalSeparatorTo="." thousandsSeparatorTo="," useThousandsSeparator="true" useNegativeSign="true" currencySymbol="£" alignSymbol="left"/>
    <mx:TextInput id="addon1" text="5.99"/>
    <mx:TextInput id="addon2" text="06.99"/>
    <mx:TextInput id="addon3" text="08.99"/>
    <mx:TextInput id="addon4" text="04.99"/>
    <mx:TextInput id="addon5" text="03.99"/>
    <mx:NumericStepper id="quantity"/>
    <mx:Button label="Button" click="getTotal();"/>
    <mx:Text id="totalAmount"/>
    </mx:Application>

  • Comma and Decimal point

    Hi Gurus,
    I am encountering a problem regarding printout of our SOA
    Instead of the standard format of the total value (comma then decimal point (ex. 2,559.62)) output is (decimal point then comma(ex. 2.559,62)). This always happens to a particular customer only. What should I do?
    Regards,
    Jay

    Hi,
    The decimal notation of numbers in Visual Composer is based on the Locale as set in the Portal
    (User Administration -> select user (or group) -> Language)
    if language is not set, it's based on IE language, and afterwards on the OS language.
    therefore, setting a number field formatting to "LOCALE_NUM" or checking the "Local Format" checkbox in the field's formatting tab, will cause the runtime to format the number according to the above.
    Your customer is probably currently on a non US locale.
    Best Regards,

  • 2 Decimal Points for Indonesian Rupiah Currency

    Dear All,
    I would like to assign 2 decimal points to Indonesian Rupiah Curreny - IDR by accessing OY04.
    However, there is no input value for 2 decimal points.
    For accounting purpose, we would like to record business transactions up to 2 decimal points.
    Kindly advise.
    Appreciate it!

    Hi wishy washy,
    even I had various real painfull experiences with clients who changed the decimals..... Still having nightmares about this....
    Please be hypercarefull with that what you are doing. Has IDR really 2 decimals? As far as I can see IDR has in Standard (In my SAP-testsystem) no decimals.
    What happens if you change the decimals? Please note, SAP stores values always without decimals.
    Example: 100,00 Euros are stored as 10000 in bseg-wrbtr.
    Euro has 2 decimals.
    If you change the decimals to 0 the amount changes to 10000 Euros.
    Example: 100 IDR are stored as 100 in bseg wrbtr.
    IDR has no decimals
    If you change the decimals to 2 the amount changes to 1,00 IDR.
    Please consider: automatic taxcalculation, Data carriers, reporting, open item clearing, budgeting, depreciation, and hundreds of other issues.
    The several warnings of OY04 have a reason... and I don't want you to have my nightmares.
    Best regards
       Horst

  • Regarding decimal point

    Hi All,
    I have one problem.
    In VA01 sales order creation shows price values with 2 decimal points like 2342.90,
    But in case of Invoice (VF01) it shows 3 decimal points like 2342.900
    I want show both are same.Is there any settings for that...If any knows pls tel me.
    Thanks in Advance.
    Thanks & Regards,
    Subramanyam.S

    HI Subramanyam,
    You Can maintain the number of decimal places for the required currency.
    This can be done in spro--> general settings --> currencies --> set decimal places for currencies. {T.Code: OY04}
    Then the condition value comes automatically in the specified number of decimals.
    Reward if it helps
    regards
    Srini

  • Rounding off to a variable value to 4 decimal values in sap script ouput

    Hi All,
    I have a value getting displayed in sap script output as 235.6789 i want to Round off this variable value to 4 decimal values!
    What is the formatting option need to be used & how!
    Thanks in advance.
    Thanks,
    Deep.

    Hi,
    1.In layout just call that variable, where you need like:
    &variable(.4)&.
    Just see these:
    &symbol(Z)&  Omit Leading Zeros 
    &symbol(S)&  Omit Leading Sign 
    &symbol(<)&  Display Leading Sign to the Left 
    &symbol(>)&  Display Leading Sign to the Right 
    &symbol(C)&  Compress Spaces 
    &symbol(.N)&  Display upto N decimal places 
    &symbol(T)&  Omit thousands separator 
    &symbol(R)&  Right justified 
    &symbol(I)&  Suppress output of the initial value
    Regards,
    If helpful reward with points(Don't forget).

  • Rounding off to nearest decimal point

    i have these values
    35.2
    35.3
    35.4
    35.5
    35.7
    35.8
    35.9
    36.0
    i am looking for indexes closet 35.74 in my array. (which is index 4.)
    i used the "round to nearest" function and it gave me 36.
    which is index 7.
    what other ways to get the right index?
    Solved!
    Go to Solution.

    You will always have some difficulties with rounding to a specific number of digits after the decimal point because of the way numbers are represented in binary. When expressed in binary 0.1 is an infinitely repeating expression. Regardless of the display the internal representation of the number always uses the maximum resolution for the data type (8 bytes for DBL).
    So you need to be very careful to define exactly what you  want. If you have an array of values (regardless of the way they are displayed) Then you can find the closest to a Test Value by subtracting Test Value from the array and finding the minimum of the absolute values of the differences.
    Note that in the image below the same values are in Array and Array 2 with the display on Array 2 set for 20 siginficant digits. 
    Lynn

  • No Value after decimal points

    Hi Gurus,
    Our client does not the condition values in decimal points in pricing.
    They want it to be scaled up always to next round figure.
    Eg. 12.25 should be converted to 13.00
    Please suggest.
    Thanks,
    Raheel

    Dear Raheel
    For the net value field, you need to give Routine 16 in the Alt. Cal. Type in the pricing procedure and also add Routine 17 to Netvalue in your Pricing Procedure. Additionally, in table T001R such rounding data should be maintained. For this goto SPRO - SAP NetWeaver - General Settings - Currencies - Define rounding rules for currencies here maintain: Company Code + Currency = 100
    thanks
    G. Lakshmipathi

Maybe you are looking for