Remove trailing zeroes in quantity field.

Hi all,
I am having quantity field in ALV grid display : VBAP-KWMENG. Iam getting quantity value as 1,000.My requirement is to get quantity value as 1.(without ',' and zeroes).
Suggest me a suitable solution.
Thanks all.

Other way is check for the below code ..
DATA:
  lv_decimal TYPE f DECIMALS 3,
  lv_string  TYPE string.
lv_decimal = '22.010'.
WRITE lv_decimal TO lv_string.
SHIFT lv_string RIGHT DELETING TRAILING '0'.
* also delete trailing '.', if possible
SHIFT lv_string RIGHT DELETING TRAILING'.'.
CONDENSE lv_string NO-GAPS.
* now no trailing zeros are in the decimal stored in LV_STRING

Similar Messages

  • How to remove extra zeros in quantity field.

    I am retrieving the field  which is of type QUAN(13) and decimals 3. The  values are stored as
    1,000
    20,000
    50,000
    2,340
    23.50
    Now i want to output as 1, 20, 50 , 2.34, 23.5
    I want to remove the additional zeros. Is there any FM for the same.
    satya

    hi
    Check this similar thread
    https://forums.sdn.sap.com/click.jspa?searchID=700505&messageID=401791
    <REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
    Message was edited by:
            Rahul Kavuri
    Edited by: Alvaro Tejada Galindo on Dec 30, 2009 11:21 AM

  • How can we remove the following zeros from quantity field ?

    Hi All.
    how can we remove the following zeros from quantity field while populating ALV by using FM REUSE_ALV_GRID_DISPLAY ?
    eg:getting output zqty = 2.000
    but i need           zqty = 2.
    help me to reslove this issue.
    Regards.
    jay

    Hi,
      While populating the field catlog do the following thing to   avoid zeros.
      wa_fieldcat-tabname = 'I_OUTPUT'.    " Curr
      wa_fieldcat-fieldname = 'FWAER'.
      wa_fieldcat-seltext_l = text-023.
      wa_fieldcat-no_zero = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR  wa_fieldcat.
    Thanks,
    Khushbu.

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

  • CONVERSION EXIT to remove thousand separator from quantity field

    HI
    NEED HELP
    do u know any  FM or CONVERSION EXIT which remove thousand separator from quantity field.
    Eg. 1,234,567.11 SHOULD be displayed as 1234567.11

    Hi Chetanpatil.
    Try this:
    If your quantity has thousand separator as comma:
    translate lv_quantity using ', '.
    condense lv_quantity.
    If your quantity has thousand separation as dot:
    translate lv_quantity using '. '.
    translate lv_quantity using ',.'.
    condense lv_quantity.
    You'll need to check for the user thousand separator configuration in table USR01 field DCPFM or by calling BAPI_USER_GET_DETAIL and act accordingly.
    Regards,
    Andres.

  • Deleting zeros in Quantity field in Sap Script

    Hi,
    I have a Quantity(FKIMG) field in Invoice (Sap Script), It is showing as 1.000 ,I want to show this as 1 ,By removing all zeros and point.
    how can i do this in Script?
    Thanks in advance,
    fractal

    Hi,
    Use <b>TRUNC</b>    "Interger part of x
    ex:
      TRUNC(FKIMG) to get integer part of the quantity.
    or
    declare an integer variable and pass quantity to this variable , use the same variable for print.
    Regards
    Appana

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

  • Formula in transformation file to remove trailing zeroes,BPC 7.5 NW

    Hi Experts,
    I have implemented automation of master data from BW info object to BPC dimension.
    I have few issues with the transformation file. employee percentage in BW is of type number and has lenght of 17.
    In BW 0EMPLPCT holds the value as 100,000 , 75,000  but when i send to BPC dimension the values are sent as 100,00000
    Emp percentage is maintained as below in the transformation  file.
    EMP_PC=0EMPLPCT
    However i wanted to remove the zeroes in BPC , i wanted to see the numbers as 100, 75, 50 and so on.
    Is there any way i can handle this in transofrmation file. Please let me know as this is really urgent. Thanks much.
    Regards,
    Sanjeev

    Hi,
    The properties in BPC are stored as string. So, you will have to convert it to string while loading. Secondly, it will be really difficult to use this percentage value in any script logic; since it is stored as string.

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

  • GREP expression to remove trailing zeros?

    Hi,
    I have to find and change multiple entries of trailing zeros. Please find sample below to understand type entries need to be change.
    1.00              -> 1
    0.01200         -> 0.12
    4.50              -> 4.5
    0.0040           -> 0.004
    Please help me how can i use grep to find and change in CS6
    Thanks in Advance.
    Sanjay

    Peter,
    Right! In 3 steps (text in black)
    1/ Exclusion if no decimal part:
    Find: ,?(?<![\.\d])(\d+)(?![\.\d])
    Replace: color X
    2/ Treatment:
    Find: (?<=[\.\d])\.?0+(?=\s)
    Search Format: color black
    Replace: nothing
    3/ Treatment:
    Search Format: color X
    Replace Format: color black
    Seems to work. To be validated! 

  • How to remove leading Zeroes in all fields in Payload

    Hi,
    How can I remove the leading Zeroes in every Filed I have in whole Payload Structure.there are around 10000 fields that have to be removed the leading Zeroes.any good idea please.
       <POSNR>000010</POSNR>
      <MATNR>000002465640</MATNR>
      <ARKTX>000012 KG D107</ARKTX>
      <MATKL>00030010000</MATKL>
      <WERKS>0000ORGC</WERKS>
      <LGORT>0000GC55</LGORT>
      <CHARG>000TEST</CHARG>
    like this mutliple segments and multiple Fields.so  I can take as whole payload with multiple fields should not have leading Zeroes.I can handle if they are 10 0r 20 fileds,but not like whole pay load/1000 fields right.
    thank you,
    Prem

    Hi
      You can have an additional XSLT mapping, to your existing one..
    use copy-of & apply-templates to copy the whole tree & make changes recursively.
    below is a sample code , the marked line is where you need to try your logic of trimming Zeros. (this code does upper case)
    add this below code in your interface mapping object, as XSLT mapping, which does the job (only try putting your logic)
    <xsl:stylesheet
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      version="2.0">
                <xsl:output  method="xml"
                            indent="yes"
                            omit-xml-declaration="yes"/>
                <xsl:template  match="*">
                      <xsl:copy>
                            <xsl:copy-of  select="@*"/>
                            <xsl:apply-templates/>
                      </xsl:copy>
                </xsl:template>
                <xsl:template  match="text()">
                      <xsl:value-of  select="upper-case(.)"/>
                </xsl:template>
          </xsl:stylesheet>
    hope this fixes your issue
    Regards
    Vishnu

  • Remove trailing zeros

    Hi,
    I want to write a program to remove any unnecessary zeros of a non whole number.
    ex. 1.00100 should be converted to 1.001.
    Pattern pattern = Pattern.compile("0+$");
    Console console = System.console();
    String word = console.readLine("%nEnter number - ");
    Matcher matcher = pattern.matcher(word);
      if (word.indexOf('.') > -1)
             System.out.println("Number after - " + matcher.replaceAll(""));
      else
              System.out.println("Number after - " + word);
       }It seems to work fine. But the pattern "0*$" also seem to work. I tested this program with both patterns for few numbers and it works.
    What is the best pattern which will provide most accurate results to accomplish my task.
    Do you see any problems of using any of the mentioned patterns or is there an another way to do it?
    Thanks,
    Chamal.

            String[] values =
                "1.00100", "100","000"
            for (String value : values)
                System.out.println(value.replaceFirst("(?<=\\.\\d{0,30}?)0*$", ""));

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

Maybe you are looking for