How to append leading zeros

Dear Friends,
In a transparent table xyz I have one field 'Bill No.' which is of character type & length 10. when I insert data in this table the value for this field gets stored as '0000000001'.
I am facing a problem when the user is giving  value of  Bill No. as '1'. It doesn't pick the data because the corresponding value in my table is '0000000001'.
Once I have used the function CONVERSION_EXIT_ALPHA_OUTPUT' to remove the leading zeros but here I have to append the leading zeros.
How to overcome this pls advise.
Regards,
Alok.

Hi,
Use the following FM:
CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right
Example:
input  = 123
output = 0000000000000...000000000000123
Hope this helps.
Reward if helpful.
Regards,
Sipra

Similar Messages

  • To append leading zeros to a character field

    Hi,
      can some body tell me how to append leading zeroes to a character field

    hi try this code.
    data: STRL   TYPE I VALUE 0.
      STRL = STRLEN( input ).
      data: in(10) type c.
      in = input.
      strl = 10 - strl.
      Do strl TIMES.
        CALL FUNCTION 'STRING_CONCATENATE'
          EXPORTING
            STRING1 = '0'
            STRING2 = in
          IMPORTING
            STRING  = in.
      ENDDO.
      output = in.
    regards,
    sohi.

  • Appending leading zeros to material number

    Hi,
    I want to form a object key for material number. so i need to append leading zeros to material number. but i am getting "TYPE CONFLICT" shot dump in FM 'BAPI_OBJCL_GETDETAIL'.
    The following code is giving the dump.
    data: wa_object(18) type c.
    wa_object = '100301010'. "Material No
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = wa_object
        IMPORTING
       OUTPUT        =  wa_object.
    CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
      EXPORTING
        OBJECTKEY              =  wa_object
        OBJECTTABLE            = 'MARA'
        CLASSNUM               = 'FINISHED_MATERIAL'
        CLASSTYPE              = '001'
        KEYDATE                = SY-DATUM
        UNVALUATED_CHARS       = ' '
        LANGUAGE               = SY-LANGU
      TABLES
        ALLOCVALUESNUM         = IT_ALLOCVALUESNUM
        ALLOCVALUESCHAR        = IT_ALLOCVALUESCHAR
        ALLOCVALUESCURR        = IT_ALLOCVALUESCURR
        RETURN                 = IT_RETURN
    but if I hard code to 18 characters, the following code is working fine:
    CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
      EXPORTING
        OBJECTKEY              =  '0000000000100301010'
        OBJECTTABLE            = 'MARA'
        CLASSNUM               = 'FINISHED_MATERIAL'
        CLASSTYPE              = '001'
        KEYDATE                = SY-DATUM
        UNVALUATED_CHARS       = ' '
        LANGUAGE               = SY-LANGU
      TABLES
        ALLOCVALUESNUM         = IT_ALLOCVALUESNUM
        ALLOCVALUESCHAR        = IT_ALLOCVALUESCHAR
        ALLOCVALUESCURR        = IT_ALLOCVALUESCURR
        RETURN                 = IT_RETURN
    Please tell me how to rectify the short dump which uses Conversion_exit_alpha_input.
    Thanks .
    Sankar

    Hi Shankar,
    When ever u pass parameters to any function module the type of parameters must match with the ones defined in function module. Here u defined ur object key like this
    data: wa_object(18) type c.(18 digits). But the in function module it referenced with BAPI1003_KEY-OBJECT (50 digits). So u have to define the variable with BAPI1003_KEY-OBJECT.
    Check this solution. It will work for u.
    data: wa_object(18) type c,
               wa_object1 TYPE BAPI1003_KEY-OBJECT.
    wa_object = '100301010'. "Material No
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    INPUT = wa_object
    IMPORTING
    OUTPUT = wa_object.
    wa_object1 = wa_object.
    CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
    EXPORTING
    OBJECTKEY = wa_object1
    OBJECTTABLE = 'MARA'
    CLASSNUM = 'FINISHED_MATERIAL'
    CLASSTYPE = '001'
    KEYDATE = SY-DATUM
    UNVALUATED_CHARS = ' '
    LANGUAGE = SY-LANGU
    TABLES
    ALLOCVALUESNUM = IT_ALLOCVALUESNUM
    ALLOCVALUESCHAR = IT_ALLOCVALUESCHAR
    ALLOCVALUESCURR = IT_ALLOCVALUESCURR
    RETURN = IT_RETURN
    Thanks,
    Vinod.

  • BAdi to append leading zeros

    Hi experts,
    Please can anyone help me understand how to implement this BADI FIEB_CHANGE_BS_DATA step by step  to append leading zeros,its kind of urgent.
    Regards

    hi try this code.
    data: STRL   TYPE I VALUE 0.
      STRL = STRLEN( input ).
      data: in(10) type c.
      in = input.
      strl = 10 - strl.
      Do strl TIMES.
        CALL FUNCTION 'STRING_CONCATENATE'
          EXPORTING
            STRING1 = '0'
            STRING2 = in
          IMPORTING
            STRING  = in.
      ENDDO.
      output = in.
    regards,
    sohi.

  • 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 remove leading zeros for an item number within quickviewer

    how to remove leading zeros for an item number within quickviewer. Pls help

    ask your abap guy to do  it. not portal guys business.

  • How to delimit leading zero in vendor number in OO ABAP ALV without using conversion routine

    Hi,
    How to delimit leading zero in OO ABAP ALV without using conversion routine, because I have many fields like vendor, customer, material number etc..
    How to address this leading zero.
    I appreciate your quick response.
    Regards,
    Nalini S.

    Hi Nalini,
    Delimiting leading zeros in fields has to be done via conversion routines, as suggested by Vadamalai you need to pass on the conversion routine name in you field catalog variable.
    Now as to which object oriented approach are you using to have your table contents display in ALV as it matters  -
    Using FACTORY method of CL_SALV_TABLE class, or
    Using SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class.
    Using FACTORY method of CL_SALV_TABLE will do your own work, no need to apply any conversion routines or set long/medium/short text for columns as we do in field catalogs!
    Cheers,
    Varun

  • How to suppress leading zeros

    Hi,
            How to suppress leading zeros in a character string.
    Thank you.

    hi,
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
                EXPORTING
                  input  = str1
                IMPORTING
                  output = str1.
    Example:
    input = 00000000000123
    output = 123
    rgds
    Anver

  • Reg:ALV, how to supress leading zeros

    Hi,
    Presently I am doing a report with ALV,
    Here I am getiing the ouput properly,that is i am able to display  emlpoyee number correctly but with leading zero's.
    I want to suppress this leading zero's as per the requirement.
    How to solve the problem.
    Thanks in Advance
    Irfan Hussain

    Hi,
    This is my field catalog decleration.
    Can just help me out with it.
    Still the problem is persisiting.
    DATA:RT_FCAT   TYPE SLIS_T_FIELDCAT_ALV,
         LS_FCAT   TYPE SLIS_FIELDCAT_ALV,
         POS TYPE I VALUE 1.
    CLEAR LS_FCAT.
    POS = POS + 1.
    LS_FCAT-COL_POS       =  POS.
    LS_FCAT-FIELDNAME     = 'PERNR'.
    LS_FCAT-TABNAME       = 'PA0001'.
    LS_FCAT-REF_FIELDNAME = 'IT_PA0001-PERNR'.
    LS_FCAT-REF_TABNAME   = 'IT_PA0001'.
    LS_FCAT-SELTEXT_M = 'Emp. Number'.
    APPEND LS_FCAT TO RT_FCAT.
    Regards,
    Irfan Hussain

  • Append Leading Zero's

    Hi ,
    the follwing SQL generates Zero's prefixed to the rownum. While inserting the data into table all the zero's go away
    why ?
    How can i insert data with Zero's ?
    <SQL>
    select
    (Case length(rownum)
    when 1 then '0000'||rownum
    when 2 then '000'||rownum
    when 3 then '00'||rownum
    when 4 then '0'||rownum
    else
    to_char(rownum)
    END )
    from
    SELECT o.class_code d
    FROM sun_oracle_schedule_backup@ougbs_ougbs.world o
    Union
    SELECT to_number(m.schedule_id,'99999') d
    FROM sun_MYSQL_schedule_backup@ougbs_ougbs.world M
    Union
    SELECT o.class_code d
    FROM sun_internal_schedule_backup@ougbs_ougbs.world o
    <SQL>
    Out put of the above query
    00001
    00002
    00003
    00004
    00005
    00006
    00007
    When used with INSERT statement the table has the values as
    1
    2
    3
    4
    5
    6
    7
    Where did the Zero's GO?????
    the table column data type is Number......
    Thanks
    --- Raj

    Is the ciolumn that you are inserting into ..declared as a number or is it a varchar2?
    sql> create table t(
      2    id number
      3  );
    Table created.
    sql> insert into t values (0001);
    1 row created.
    sql> insert into t values(0002);
    1 row created.
    sql> commit;
    Commit complete.
    sql> select * from t;
            ID
             1
             2If you declare it as a varchar2...
    sql> create table t(
      2    id varchar2(10));
    Table created.
    sql> insert into t values ('0001');
    1 row created.
    sql> insert into t values ('0002');
    1 row created.
    sql> commit;
    Commit complete.
    sql> select * from t;
    ID
    0001
    0002But why do you want to store the values appended with leading zero's in your table..???

  • How to retain leading zeros in module pool screen

    Hi experts,
    I have a ztable field of type NUMC4 being displayed on a module pool screen, the value in the field is '0001', but on the screen it displays value as '1' (without leading zeros), When I save the record, Even in the databse it stores as '1'.
    But I have checked in debugging the field always contains '0001' in the program execution and I have also used 'CONVERSION_EXIT_ALPHA_INPUT' in the PBO but no use.
    Pls suggest.
    Thanks,
    Deepak

    Check the screen attributes for the field. There is an option to show leading zeroes.
    edit.
    And how did you see it was stored a 1 and not 0001? Using SE16N? Mind you: with SE16N conversion-exits are executed automatically thus showing 0001 as 1.
    To make sure: double click on the record in SE16N and look if it's still 1 and not 0001.

  • How to add leading zeros to a packed variable

    Hi all,
    I have a to add leading zeros for a packed field.
    eg.
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    but I have to display the field as '0000000000012.063'.
    How can we achieve this?
    Regards.

    Execute the code .
    REPORT zex13 .
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    data:val(18) type c,
         in(13) type n ,
         dec(6) type c.
    data :  a type i ,
            b type i.
            a = TRUNC( brgew ).
            write:/ a .
    in = a.
    write:/ in.
            dec = frac( brgew ).
            write:/ dec.
            concatenate in  dec+2(4) into val separated by '.'.
            write:/ val.
    see if this works for u .
    regards,
    vijay

  • How to display leading zeros in a report

    Hi folks,
    I am doing a HR report and the users are very much used to seeing a two digit numeric value as the pay scale since their legacy days.
    In BW, I have the Pay Scale defined as a character (2) and it shows the values on the report as follows:
    Pay Scale
    0
    1
    2
    3
    11, etc.
    But the users would like to see 00, 01, 02, 03, 11, etc.
    Under the query properties, display tab, there are four separate options - display zeros, show zeros as, etc. I tried all the options but the pay scale still does not show the leading zeros. I remember seeing a SAP note a while back that talks about this. Does anybody know how to force the leading zeros on the BEx report.
    Thanks.
    Abdul

    Try removing the ALPHA Conversion from info object defintion.

  • 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

Maybe you are looking for

  • 2 Macs, 1 blog site.  How can I use 2 Macs to edit my iWeb site???

    I have a Mac at home and my laptop at work. Both have iLife '06 on the and iWeb. I just designed a web site (and uploaded it) using iWeb, and I'd like to add to it from my laptop at work. I brought a pushlised copy with me, but there's no way to load

  • How can I add Rescue E-mail? Please Help

    Hi, I'm Having trouble solving security question. So, I contacted Apple Tech support and they gave me this link. http://support.apple.com/kb/ht5312?viewlocale=en_US I don't have Rescue E-mail option on my Password and security tab.  And I was wonderi

  • Crystal report viewer do not show on client computer installation

    hi hope all you are fine i develop a simple project that show "Hello word My First Crystal Report" on crystal report viewer. after this i add new project "setup and deployment". In Setup Project I add 4 files of .msm for show crystal report. 1. CRRun

  • Can't add any more songs

    yesterday when i added some songs onto my ipod in itunes, it said the songs were there. i ejected my ipod and my songs werent there, i tried again and again and it still didnt work! it said C:\something itunes was unreadable or corrupted... i cant ad

  • Item Master Data Creation - Statuses

    Greetings, My client is looking for best practice - status naming conventions for Item Master Data Creation Process. They are in the Specialized Retail Industry and have internal naming conventions and want to align more with Industry Standards.  The