How to remove trailing zeros from a decimal (type) value?

Hi Everyone,
I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?
The value is definitely of decimal type, and in this instance I know that I want to eliminate exactly six (6) zeros.
Any help here will be greatly appreciated.
Kind Regards,
David

Try the below:
This is sort of a display issue, you may do it at Application side, which would be efficient.
Declare @s Decimal(10,6)='50.0000000'
Select Cast(@s as decimal(10,0))

Similar Messages

  • How to remove trailing zeros from a fraction part.

    How to remove trailing zeros from fraction part, need standard API rather then some java code.

    user8726363 wrote:
    How to remove trailing zeros from fraction part, need standard API rather then some java code.I'm pretty sure we have all gathered that English is not your first language, but your question is not a good question in any language.
    Back up. Take a deep breath.
    Now - what's your problem ?
    Please illustrate with results, and the code (just the class/method; not your entire application) that is causing them.
    Winston

  • How to remove leading zero from Material Number

    Hello Everyone,
    I need to figure it out how to remove leading zero from material number. Cureently extractor is sending material number as 100663. But when comes into BI i am getting as "000000000000100663" and similariy in report it is appearing as "000000000000100663". Now my client wants me to exclude preceeding zero for a material in all the reports.
    Is there any setting in query desinger to handle this issure or in the backend.
    Need your inputs.
    Thanks,
    Lasya.

    Hi
    you can use the function Module
    CONVERSION_EXIT_ALPHA_OUTPUT in the start routine
    to test this go to SE37  --- give the CONVERSION_EXIT_ALPHA_OUTPUT -
    >display -
    > F8
    in the input give 000000456
    and execute
    the out put will be 456
    for getting Zeros you can use
    CONVERSION_EXIT_ALPHA_INPUT--- to remove leading zeros
    Santosh
    Edited by: Santhosh Nagaraj on Oct 29, 2009 10:52 PM
    Edited by: Santhosh Nagaraj on Oct 29, 2009 10:54 PM

  • How to remove leading zeros from variable

    hi,
       how to remove leading zeros from variable like it_vbap-matnr.
    value in it_vbap-matnr is 000000000000000358
    i want to remove leading zeros so that it become 358
    regards
    deepak

    You can use Function Module <b>'CONVERSION_EXIT_MATN1_OUTPUT'</b>
    This Function Module will eliminate leading Zeros.
    For each MATNR Value read form DB Table,u can eliminate Leading zeros and then modify ur Internal table.
    I think u will not get leading Zeros into utr Internal table when u read from VBAP.
    Bcoz MATNR in VBAP itself have Conversion routine.
    If u r getting leading zeros,U can use following Logic.
    tables:
      vbap.
    data:
       t_vbap like standard table of vbap.
    select matnr
    from vbap
    into corresponding fields of table t_vbap.
    loop at t_vbap into vbap.
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
          EXPORTING
            INPUT         =  vbap-matnr
          IMPORTING
            OUTPUT        =  vbap-matnr
      modify t_vbap from vbap transporting matnr.
    endloop.
    Hope this will work.....

  • How to delete trailing zeros from a quantity field to display in ALV?

    Hi there,
    i am retrieving the field LGMNG from LIPS table, which is of type QUAN(13). All LGMNG values there are stored as
    1,000
    20,000
    50,000 etc.
    But i want my values to be displayed as
    1
    20
    50 etc.
    i have tried the " shift v_variable right deleting trailing '0'" but it does not work.
    also, if the value of LIPS_LGMNG =  0,000, i need those columns in ALV empty(that is no zeros or comma displayed)
    can anyone please help?
    Thanks a lot,
    Mee

    hi,
    use this it will solve your problem, just write down this on your Fieldcatalog.
       WA_FIELDCATALOG-FIELDNAME = 'VALUE7'.
       WA_FIELDCATALOG-SELTEXT_L = 'Contribution EE(due)'.
      WA_FIELDCATALOG-DATATYPE = 'INT2'.           " it will remove trailing zero
      WA_FIELDCATALOG-DECIMALS_OUT = 0.
       APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
       CLEAR WA_FIELDCATALOG.

  • I want to remove Trailing zeros from a charecter value

    Hello ,
              i want to remove trailing zeros for a prticular value.Following is my code :
    DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
               V_CHAR(25) ,
               P10_4(10) TYPE P DECIMALS 4.
    CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
    EXPORTING
    FLOAT_IMP = V_FLOAT
    FORMAT_IMP = P10_4
    ROUND_IMP = ' '
    IMPORTING
    CHAR_EXP = V_CHAR.
    SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
    WRITE : V_CHAR ."NO-ZERO.
    <u><b>Output:</b></u>
    if we pass the value '1.3000000000000000E+01' it should be 13.0
    ex2: '1.3400000000000000E+01' it should be 13.4
    ex3:'4.8240000000000000E+03' it should be 4824
    is there any way to get the solution without functional module. If so Please tell me with code.

    hi
    u can do it in number of ways.
    Use TCODE SU3
    Select default tab and select radio button 123467.89 in decimal notation and save it.
    or u can try :
    if you want to do this through ABAP program.
    1. to delete trailing spaces.
    SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
    to delete leading zeroes,
    SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
    only for one abap program, u can use set country command
    for all programs :
    sap menu>system->go to user profil->own data>default --> and choose ur format.
    hope this helps u.
    Regards,
    Prasanth
    Reward all hepful replies

  • How to remove Leading zeros from MATNR "at Database Level"

    Hi,
    When we create a material in MM01 , we can either create material as Internal Material No. or External Material No. (By Explicitly entering a material No.)
    Our requirement is that: When we create an Internal Material , there should NOT be any Leading Zeros in MATNR.
    and for External Material No.  , Leading Zeros Should be there.  (In Database)
    1) Now , we can create the No. Range for material in such a way that it will allow only AlphaNumeric entries for Internal Material , and Only Numeric Entries for External Material No.
    This should slove the Purpose.
    But According to the Client's requirement , Material No can be Numeric OR Alphanumeric for Internal As well as External Material No.
    2) We can Add or Remove leading zeros from MATNR at application level.  i.e.  we can find some BADI / Enhancement where we will Use the Conversion FM (CONVERSION_EXIT_MATN1_OUTPUT or  CONVERSION_EXIT_ALPHA_OUTPUT) and remove Leading Zeros from MATNR. But these changes will NOT reflect at Database Level , Because in MATNR Domain , there is a conversion Routine  , That will Add Leading Zeros in MATNR While saving in the Database.
    3) While Displaying the Material In SE11 , we can also set the "Display Format" as With leading Zeros OR Without Leading Zeros.
    But we dont want to Just "Display" material with OR Without Leading Zeros.  we want to actually create materials in that way.
    What can we do , so that at Database Level our changes are Reflected.
    Thanks and Regards,
    Anand Gore
    Edited by: anandgore on May 18, 2011 3:47 PM

    That will Add Leading Zeros in MATNR While saving in the Database.
    That is because you have it configured that way.  You can configure the storage as you desire.  The default is the behavior you are describing.  You, or your functional analyst, need to review the documentation on the MM config settings for material master number storage.
    Never use CONVERSION_EXIT_ALPHA_OUTPUT for material conversion.  Also keep in mind that the MATN1 functions have their own BADI for extended formatting...

  • How to remove trailing zeros 20353675.0000000

    All numeric decimal columns all are showing trailing zeros, how to remove them while processing within the query transform.
    20353675.0000000
    Thanks a lot for the helpful info

    You can use the trunc function to remove the decimal places.
    Syntax: trunc( number, [ decimal_places ] )
              <number> is the number to truncate.
             <decimal_places> is the number of decimal places to truncate to. This value must be an integer. If this parameter is omitted, the trunc function will truncate the number to 0 decimal places.
    Eg:     trunc(125.815)  would return 125
              trunc(125.815,0)  would return 125
              trunc(125.815,1)  would return 125.8
             trunc(125.815,2)  would return 125.81
             trunc(125.815,-1)  would return 120

  • How to remove trailing zeros using EngineeringFormatInfo?

    HI,
    I found a measurement studio formatter for SI notation.  
    For details, see the NI document.
    Here, I want to know how to remove any trailing zeros. I could not find any information about this. 
    For example, 
    code : string result = string.Format(EngineeringFormatInfo.Default, {0:s5}, double value)
    if  value = 1.2345678E-3,  result is 1.23457E-3. It is ok. 
    if  value = 1.2E-3,  result is 1.20000E-3. But I want to get "1.23m". 
    In labview, I usually use "%#.5p" format string.

    diluculo wrote:
    HI,
    I found a measurement studio formatter for SI notation.  
    For details, see the NI document.
    Here, I want to know how to remove any trailing zeros. I could not find any information about this. 
    For example, 
    code : string result = string.Format(EngineeringFormatInfo.Default, {0:s5}, double value)
    if  value = 1.2345678E-3,  result is 1.23457E-3. It is ok. 
    if  value = 1.2E-3,  result is 1.20000E-3. But I want to get "1.23m". 
    In labview, I usually use "%#.5p" format string.
    I don't understand how you are getting 1.23457E-3 ?  And claiming that is okay.
    If you are using the format string that you claim you are using, then you should be getting 1.23457m.
    It sounds like you are using string result = string.Format(EngineeringFormatInfo.Default, {0:E5}, value)

  • How to delete trailing zeros after the decimal point in the ALV sum

    Hello Expert,
    In my alv output, I need to sum up one column, but in the sum result, I don't want to display zeros after the decimal point.
    for example,
    If the sum is 134.00, I only want to display 134 on the alv.
    Does any expert have idea about it?
    Thanks in advance,
    best regards, Johnny

    Hi ,
    Use following
    SHIFT variable RIGHT/LEFT DELETING TRAILING '0'.
    For more variations ,
    just write SHIFT and press f4 , it will show you the information you need.
    Hope this is helpful,
    Regards,
    Uma Dave

  • How to remove leading zeros from a string

    Hi,
    I have a situation here where i need to remove the leading  zeros from the incoming data.
    i.e if 0009 then it should be taken as 9
       if 0230  it should be taken as 230
    Regards,
    Ashish

    Hi ,
    Write UDF to parse data .
                    String dataVal="0230";
              int parseVal = Integer.parseInt(dataVal);
              System.out.println("parseVal is "+parseVal);
    result.addValue(parseVal); or return parseVal;
    Nanda

  • How to remove the stock from 916 -storage type

    Hi experts,
    In LS25 for 916 storage type it is showing 30 & -20 Quantity for two Quants
    How to remove the stock?
    Regards
    vr

    the usual way to remove quants from 916 is by cancellation of the picking, which is done with LT0G transaction.
    if the delivery is already goods issued, then you have to use LT01 to move the quants.
    The positive quant of 30 quantity can be moved to the place where it phyiscally is.
    the negative quant can only be eliminated by moving a quantity from a positive quant onto it. You should have a positive quant of this material in any bin of your warehouse.  so you move from this bin to 916.

  • How to remove leading zeros from the screen?

    Hello friends,
    I am working on dialog programming.
    I have a field with is NUMC 13. so when value is populated, It removes the leading zeros.
    How can I display the my value with leading zeros on the screen painter?

    Call SE51, layout, double-click on field, attributes, tab Program, check Leading zeros.
    Regards,
    Raymond

  • How to removed leading zeros from a date field.

    CONVERT(NVARCHAR, CONVERT(DATETIME, CONVERT(CHAR(8), STM.CreationDate)), 101)
    This is what i currently have, but prints 02/03/2014 i would like to print the date without the zeros when applicable.
    Thanks in advance.

    >>REPLACE(LTRIM(REPLACE(CONVERT(NVARCHAR, CONVERT(DATETIME, CONVERT(CHAR(8), STM.CreationDate)), 101),'0', ' ')), ' ', '0')
    Does this query really works? I doubt
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • Retain trailing zero's after decimal

    Hi,
    i have a requirement to retain trailing zero's after decimal....
    is it possible?
    version: 9.2.0.7
    example: select 150.200 from dual;
    we will get 150.2 as output.
    but i need 150.200 as the output...
    how would i do this?

    oraDBA2 wrote:
    Hi tony,
    sorry, that is not the constant value...that is a variable based on the value, what user enters with the decimals.......if i understood you correctly,
    it seems like you will need to use char or varchar2 datatypes in that table to start doing what you would like to do in the way you wan't it.
    and still you have option to apply to_number and to_char on that varchar2 column.
    SQL> create table b (charr varchar2(15) );
    Table created.
    SQL>
    SQL>
    SQL> insert into b (charr) values ('1000.000');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select* from b;
    CHARR
    1000.000
    http://stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10795/adfns_ty.htm#1006325

Maybe you are looking for

  • Firewire 800 to thunderbolt adapter for MBA

    Anyone know about an adapter for a firewire 800 to thunderbolt, that is available now?

  • Problem on installing oracle 9i on red hat linux

    anybody having experience on installing oracle on redhat? I've tried to install oracle 9i on redhat 8.0. but when I run the install command "./runInstaller" under Disk1, I got a error msg: "line 58: ./runInstaller: cannot execute binary file". (my x

  • Stuck Dell PowerEdge 2550 not REALLY supported?

    Hi all, I've been trying to get Solaris 8 installed on a Dell PowerEdge 2550 I just got in, and I'm not having any luck. This is unfortunate, as its my one sole server for a small biz I'm trying to get going. Sigh. Anyway, the problem is that after b

  • Aperture to Photoshop Issue When ReOpening Edited TIF via Keyboard

    I have a perplexing Aperture problem. I'm using Aperture 2.1.4 as I haven't upgraded to vs3 yet. Here's my situation: 1) Aperture keyboard shortcut to open edit / open an image version as TIF in Photoshop is: Cmd + Shft + O 2) I edit my photo in PS,

  • After interruption of downloading a Movie, Space wrong calculated

    I wanted to download a Movie on my iPad. I bought and hoped that it'll be finished next day. But there was an ERROR Message: "There's no more Space left" - but when I bought the film there was enough.... I had the half movie downloaded - I cancelled