Truncating decimal places in smartfroms

Hi
My requiremnent is that I have a quantity value printed in a smartform. The value comes as 100.000 but i only want 100 to come.
How can this be done in a smartform

hi KISHNAN
(.0) is not working inside the table loop for displaying the item weight's
is it dependant on font?
any solutions?
regards
kishore

Similar Messages

  • B1 Query returning truncated decimal places when the CASE statement is used

    Hi All,
    Perhaps this is a friday thing.
    In B1 the price setting is for 5 decimal places. I have a query the run a business process looking at the data in the Special Prices Tables. When I run the Query in SQL, the output show the correct number of decimal places. However, when the Query is then  saved and run in B1, the output is truncated to 2 decimal places. Any ideas as to how I can prevent this for happening?
    T0: Points to teh OSPP Table
    T1: Points to the OSP1 Table
    The portion of the query causing the issue is as follows:
    case
       when (T1.price is not null) then
             T1.price
       else
           T0.price
    end

    Hi Earl
    Seems you are right, I have tested with a few different formats and each time get a 2 decimal result. In SQL help I found the following which may explain why:
    Result Types
    Returns the highest precedence type from the set of types in result_expressions and the optional else_result_expression. For more information, see Data Type Precedence (Transact-SQL).
    Even tried it in SQL with a stored procedure storing to a temp table and it shows the full decimals, but executing the SP in SAP Business One results in 2 decimals again.
    This is indeed a strange occurrence and I a not sure how you are going to solve it! You can use NVARCHAR for example except that it right aligns the values returned, but at least it doesn't drop the decimals.
    Kind regards
    Peter Juby

  • Double value truncated to two decimal places without rounding the value.

    I want to truncate double value to two decimal places without doing the rounding of the value.
    Is there any method which can directly do the truncation.

    There's many ways to achieve this such as using
    BigDecimal's setScale method or type-casting. This is
    the way I like to do it:double d = -5.239;
    d = d > 0 ? Math.floor(d * 100) / 100.0 : Math.ceil(d
    * 100) / 100.0;
    Your division by 100 may cause an rounding error, because there are numbers which no finite binary representation. That's splitting hairs! I know ;-)

  • Trunc percentage two decimal places

    I have a report that has the option of dispalying pdf or excel. I have the pdf version working fine but i am having a little trouble on the excel version. I have a grand total and department total. Basically I need help formating two decimal places. Both dept_total and grand_total are numbers that both display. I have another column that displays what percent of the total is from each dept.It currently returns a number such as 10.23383547957459973 which i need to display as 10.23 How can i incorporate the trunc function into this code?
    ...to_char((dept_total/grand_total) *100)
    The query looks similar to this.
    select
    to_char(a._grand_total)
    ,to_char(a.dept_total)
    ,to_char((dept_total/grand_total) *100)
    from(
    select sum(xxxx) grand_total,
    sum(xxxx) dept_total
    from table)a

    Hi,
    Since you're calling TO_CHAR anyway, you can add a 2nd argument, specifying two decimal places:
    select
         a._grand_total
    ,     a.dept_total
    ,     to_char ((dept_total/grand_total) *100,       '999999999.99')     AS pct
    from     (
             select  sum (xxxx) grand_total,
                      sum (xxxx) dept_total     -- Why have two copies of the same value?
             from    table
         )a If you're not using a 2nd argument, why use TO_CHAR at all in this query?
    This will round the value, not truncate it. That is, if the value is 10.23<b>5</b>83547957459973, it would display '10.2<b>4</b>', not '10.2<b>3</b>'. If you always want to round toward 0 (rather than to the nearest multiple of .01), then use TRUNC.

  • How to concetenate decimal place

    hi
    i have declared a variable as
    var_ad_addtn(16)  TYPE p  DECIMALS 10.
    now the value is coming as two decimal place i want to truncate the decimal place and only show as integer but i cannot declare like integare and the field value passed to this variable is type curr and upto two decimal place
    what i am doing is var_ad_addtn+(.0). but this is not working please let me know the syntex and statement for truncating and not display the decimal place value from a value
    eg 1232834.90 i want to show as 1232834 only
    regards
    arora

    Hi Nishant,
    Then try the following fucntion modules:
    HR_NZ_ROUNDING_DECIMALS
    ROUND
    CALL FUNCTION 'ROUND'
        EXPORTING
          DECIMALS      = 0
          INPUT         = var1
          SIGN          = '-'
        IMPORTING
          OUTPUT        = var1
        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.
    Regards,
    Chandra Sekhar

  • Essbase - spurious decimal places??!!

    Hi,
    having double checked my source data I have the following issue, I import balances into Essbase, using Hyperion Planning's flat file interfaces, so I can easily see the source data only has 0 d.p. for GBP, 2 d.p. for STATs (non-currency) - my problem is that in Essbase there are spurious decimal places well beyond the levels indicated immediately after import (i.e. I am certain this is not related to user input and also certain that this is not an excel issue as data is generated via sql routines that directly create flat-file content).
    I need to fix this issue as we have a large structure which will yield aggregate errors if I cannot remove these spurious decimal places.
    I prefer to fix this via configuration if possible, not via business rules that truncate / round user input.
    With thanks for your input,
    Robert.

    You can round the values using @round command in calc script or BR
    Check this
    http://docs.oracle.com/cd/E12032_01/doc/epm.921/html_techref/funcs/round.htm

  • Limiting decimal places

    is there a way to limit the number of decimal places that appear in an output?

    Yes, truncate it manually or by some input method limiter.
    If you are reading a spreadsheet file and outputting that to the console, then you can simply check the value of the string, and determine how many numbers come after the "." charactor. That will give you an index in the string.
    Using that index you can then simply create a new string including the whole number, decimal, and only those points that you want.
    You can also do the reverse and expand the decimals from, let's say 1 decimal (like 10.2) to a 2-digit decimal (like 10.20) by simply adding the needed places in the string after the last charactor.

  • CONVERTING DATA TO 2 DECIMAL PLACES

    All,
    I needed to convert a BSO database to only have 2 decimal places. I did this by exporting the data and restricting the export calc to 2 decimal places.
    HOWEVER - there still appears to be rollups that have more than 2 decimal places.
    * Is there an easier way to convert data to 2 decimal places?
    * Is there a "bug" were essbase produces more than 2 decimal places even when all 0 level members have none?
    Thanks

    Old posts never die until they're beaten into the ground...
    On the off chance that someone, anyone still cares, Glenn was absolutely correct when he stated that Essbase stores data as floating point values.
    And when that happens, only values that are divisible by two or 10 are stored without some kind of fractional value.
    See the DBAG: http://download.oracle.com/docs/cd/E17236_01/epm.1112/esb_dbag/dcaintro.html
    Most computers represent numbers in binary, and therefore can only approximately represent real numbers. Because binary computers cannot hold an infinite number of bits after a decimal point, numeric fractions such as one-third (0.3333...) cannot be expressed as a decimal with a terminating point. Fractions with a denominator of the power of two (for example, 0.50) or ten (0.10) are the only real numbers that can be represented exactly. See IEEE Standard 754 for Floating-Point Representation (IEEE, 1985).There is nothing you can do other than handle the round/truncate in the reporting layer.
    You can always take it up with IEEE. :) As we used to say in school when taunting Electrical Engineers, "You can't spell 'geek' without --Cameron-- 'ee'." :) Or hope for an analog computer.
    Regards,
    Cameron Lackpour

  • Double to 2 decimal places

    I am putting a double variable out to a web page and also calculations on that double(a price). I am getting 4 decimal places on the original price and several decimal places on the calculations. Can anyone tell me how to round down to 2 decimal places?
    Thank you.
    Karen

    I generally use a formatter along the lines of the following. You could also use a wrapper class (Double is final, and you can't extend primitives) for Double which would incorperate this formatting. However you only need to use it when you are presenting it (or if you are persisting it to a lower precision data source, where truncation could result in larger inaccuracies creeping in).
    This also changes the ROUND_HALF_EVEN behaviour of DecimalFormat to ROUND_HALF_UP.
    Alternatively you could use BigDecimal (.setScale() to set decimal places) but there is an overhead which may be restrictive.
    class Formatter {
      public static final int DEFAULT_PRECISION = 2;
      public static final String DEFAULT_PATTERN = "#.00";
      public static final String ZEROS = "0000000000000000";
      public static String convertDoubleToString(Double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(Double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(Double d, String pattern) {
        return new DecimalFormat(pattern).format(d.doubleValue());
      public static String convertDoubleToString(double d, String pattern) {
        return new DecimalFormat(pattern).format(d);
      private static final double round(Double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d.doubleValue() * factor)) / factor;
      private static final double round(double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d * factor)) / factor;
    }

  • 2 Decimal Places (that's all)

    My output from my calculations is:
    2.74594
    1.343434343434
    14.4758395065893849
    How can I limit my digits after the decimal point to only 2 places?
    Above answers would be:
    2.74
    1.34
    14.47
    Would appreciate any help.

    Well your code does exactly what you say it will ;-)
    It truncates the number to just 2 places.
    But if you want to get the "standard" behaviour of ROUND_HALF_UP then you should use Math.round(), as can be seen in the following.for (int i = 0; i < 100; i++) {
      double d = 2.74594 * i;
      double d2 = d;
      double d3 = d;
      //this code truncates to 2 decimal places
      d2 = d > 0 ? Math.floor(d * 100) / 100.0 : Math.ceil(d * 100) / 100.0;
      d3 = Math.round(d * 100) / 100.0;
      System.out.println("d = " + d + "\td2 = " + d2 + "\td3 = " + d3);
    }I usually leave doubles at their default precision until I need to presist or present them(to a db for instance), and then I use a class along the following lines...class Formatter {
      public static final int DEFAULT_PRECISION = 2;
      public static final String DEFAULT_PATTERN = "#.00";
      public static final String ZEROS = "0000000000000000";
      public static String convertDoubleToString(Double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(Double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(Double d, String pattern) {
        return new DecimalFormat(pattern).format(d.doubleValue());
      public static String convertDoubleToString(double d, String pattern) {
        return new DecimalFormat(pattern).format(d);
      private static final double round(Double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d.doubleValue() * factor)) / factor;
      private static final double round(double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d * factor)) / factor;
    }

  • Round Down (or not at all) and display as percent to 2 Decimal Places

    Hello,
    I have a report in SSRS with a number of computations done in the tablix.  I need to format an expression such that the value will be displayed as a percentage with 2 decimal places that is truncated(not rounded).
    For example,
    0.66666 should be displayed as 66.66% (not 66.67%)
    0.5 should be displayed as 50.00%
     I have done much Googling and have tried everything I can think of but no luck.
    I would appreciate any help anyone can provide.
    Thanks!
    Scott Olander

    Hi Alisa,
    Thanks for your response; it was very helpful.  Unfortunately I'm still having some difficulty...
    When applied to a hardcoded numeric value, your solution seems to work perfectly:
    =Left(0.66666 *100, 5) &  "%" ---> 66.66%
    I had to modify it slightly when applying it to one of my calculations as whole percentages were not displaying .00 to the right of the decimal point.  This is what I modified it to:
    Left(Format((Fields!CorrectAudits.Value/(Fields!InCorrectAudits.Value + Fields!CorrectAudits.Value) * 100),
    "N"), 5) &
    This works perfectly when applied to this particular calculation, but for some reason when I apply it to the following calculation I get funky results:
    Original calculation:
    = SUM(Fields!CorrectAudits.Value)/SUM(Fields!IncorrectAudits.Value + Fields!CorrectAudits.Value)
    Modified calculation:
    =Left((SUM(Fields!CorrectAudits.Value)/SUM(Fields!InCorrectAudits.Value+Fields!CorrectAudits.Value)*100), 5) & "%"
    Results:
    0.66666 ----> 66.66 %   (This is as desired)
    0.25      -----> 25%        (Should be 25.00%)
    0.07692      ------> 7.692 %  (This should be 7.69%)
    Adding the Format "N" piece to this calculation fixes the issues with 0.25 and 0.07962 but causes 0.6666 to round to 66.67% (not the desired result).
    Do you have any ideas?  Am I doing something wrong and just not seeing it?
    Thanks again for your help.
    Scott
    Scott Olander

  • Truncating Decimal Values

    Hi! Folks,
    I would like to ask for you kind assistance in figuring out my assignment, how to truncate a decimal value depending on the number of decimal places the user has specified.
    Your immediate assistance will be much appreciated.
    Cheers!

    // utility class
    public class Fraction{
       public static double digits(double d, int places){
          return (long)(d*Math.pow(10,places)+0.5)/Math.pow(10,places);
       public static double digits(double d, long places){
          return (long)(d*Math.pow(10,places)+0.5)/Math.pow(10,places);
       public static float digits(float d, int places){
          return (int)(d*Math.pow(10,places)+0.5)/(float)Math.pow(10,places);
       public static float digits(float d, long places){
          return (int)(d*Math.pow(10,places)+0.5)/(float)Math.pow(10,places);
    // testing class
    public class Dec {
        public static void main(String s[]) {
            int decimalPlaces = 3;     
            double d = 2343.12894132134;
            d = Fraction.digits(d, decimalPlaces);
            System.out.println(d);
    }

  • Error while updating decimal places in general settings

    Hii All
             I have got an error while updating Decimal places in General Settings
    Cannot update while another user is connected to the company i have checked, there is no other user logged in, i could add other settings but the problem is only with Decimal Places
    Note : there are no postings yet, a fresh database for a new client
             what could be the possible reason
                                                                 thanks
                                                                         RIYAZ

    Hiii All
          As a forum rule, i have initially gone through with the existing threads and then i was force to post a thread,
              would be helpfull if there is any other way..
                                                Thanks
                                                         RIYAZ

  • Decimal places in report painter

    Hi experts.  I have a financial report written in report painter.  I want to show two decimal places on a single row.  The rest of the report is in whole dollars, but this one row is a percentage, so I want to show decimal places.  I know that you can format an entire column, but I can't figure out how to format a single row.  Can anyone help?
    Thanks
    Janet

    YES U CAN
    SAME AS ABOVE PROCEDURE
    BUT SELECT ROW INSTEAD OF COLUMN
    Edited by: Anil Kumar Potnuru on Feb 10, 2009 9:02 PM

  • Can not change the number of decimal places in the normalization of result

    dear all
        i want to see the proportion of some data, for example, the income of May is 300, and the total income is 1000, i need to display it like 33.33% . so i set the
    Calculate single values as normalization of result, and then it display 33.333%, i like to display only two number of decimal places, so i set the number of decimal places as 0.00, but i doesn't work, it still display three decimal numbers.
        maybe you say i can use the percentage function like %CT %GT %RT, but i need to allow external access to my query, so the i can not use those functions.
        can somebody helps me ? your advice is appreciated.

    hi,thanks for your advice, but that doesn't suit for my problem.
    before i set the normalization of result, i can change the decimal values. After that i cann't.
    In your thread, someone proposes use the T-code OY04. but this wouldn't help. As i change to other key figure, such as user quantity, when i set normalization of result, it still display 3 decimal values.
    i think the point maybe lie in the normalization of result. please advise... thanks...

Maybe you are looking for