Leading Zeros Supression

How Can I supress Leding zeroes into target Structure?. Iam getting 10 digits filled zeros left justified and my target systems doesn't need zeros. Is there Standard function in Mapping I can use?

Hi,
With th ehelp of Substring standard function you can achieve that, if you know the exact number or length.
Elese it is prefer to write a Java User Defined function to achieve the same.
Just check with <i>FormatNum</i> inbuilt functions.
This thread discusses about padding zeros, instead of this, you need to substring it..
Lpadding zeroes to a string in message mapping- material/customer format
Regards,
Moorthy

Similar Messages

  • Supressing Leading Zero's

    My database has a field that has a total of 30 characters.
    Depending on the data that was entered there could be a large number of leading zero's that is displayed within that field.  How do you supress the leading zero's for that field when the number of leading zero's could fluctuate?
    In addition to that, they are also using Bar Code Scanning on that same field.  How can you suppress the Leading zero information on the same field once it has been converted to Bar Code?

    I dont think cstr(val(x)) will work if the value is "001000000000000000005147002589" as val(x) will convert it to a number and due to the number of digits, CR will convert it to scientific notation, at least CR XI converts.
    One possible solution would be to loop through the digits and extract the data by eliminating the leading zeros.  For example:
    stringvar x := "001000000000000000005147002589";
    // Example, you don't need this in your formula
    numbervar i;
    for i := 1 to length(x) do
    if x<i> NOT EQUAL TO '0' then exit for
    // use the not equal sign (greater than and less than symbols)
    x[i to length(x)];
    You can use this formula for both display and bar code purposes by replacing X with the db field.
    Edited by: Sanjay Kodidine on Oct 21, 2009 4:50 AM

  • To Supress Leading Zeros

    Hi Gurus
       I am developing ALV Report.
    For my Header I have to display Material Number.
    It is displaying with Leading Zeros.
    I want to supress those Zeros.
    Please send me the sample code urgently.
    Regards,
    Kumar

    when you are storing the material no in your int table take it in a character variable
    and use
    SHIFT cmatnr left deleting leading '0'.
    now itab-matnr = cmatnr.
    append or modify your inttable.
    or
    loop at itab.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        INPUT         = itab-matnr
    IMPORTING
       OUTPUT        = itab-matnr
    modify itab.
    endloop.
    regards
    shiba dutta

  • How can we supress leading zeros?

    how can we supress leading zeros?

    use
    <b>CONVERSION_EXIT_ALPHA_OUTPUT</b>
    Conversion exit ALPHA, external->internal
    ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.
    Example:
    (Input field and output field are both eight characters in length)
    1. '1234 ' --> '00001234'
    2. 'ABCD ' --> 'ABCD '
    3. ' 1234 ' --> '00001234'
    Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.
    Usage:
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
    exporting
    input = v_input
    importing
    output = v_output
    exceptions
    others = 1.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • 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

  • Supression leading zeros

    Hi guys,
    I have to delete leading zeros from a set of fields.
    please help with an example.
    thanx in advance

    U can either use this function module also
    CONVERSION_EXIT_ALPHA_OUTPUT
    or
    SHIFT <yourField> LEFT DELETING LEADING '0'
    or
    try NO-ZERO option of WRITE statement
    or
    Another way is to create another variable of type I and assign the value into it
    example:
    DATA: L_NUMC(08) TYPE N.
    DATA: L_INT TYPE I.
    L_NUMC = '00000018'.
    L_INT = L_NUMC.
    Result will be = 18.
    Regards,
    Santosh

  • BAPI_PO_CHANGE document number leading zero problem

    Hi experts,
    The following code clears the "Delivery Complete" flag on a list of Purchase Orders uploaded from a CSV file.
    The PO number is 9 digits long, however, in EKPO table it is stored as 10 digits (prefixed with a zero). The BAPI does not recognise the document number unless it is prefixed with a zero in the CSV file (which adds extra work for the user to create custom format in Excel to add the leading zero).
    What code is required for the BAPI to recognise the 9 digit number without the leading zero?   Perhaps the leading zero could be hard-coded into the program?
    Any advice is much appreciated.  Thanks for your time.
    REPORT  Z_MASS_REMOVE_FDI_DCI_BAPI.
    *Check if file exists
    DATA: rc TYPE sy-ucomm.
    CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = 'X:\STO.TXT'
           IMPORTING
               return   = rc.
    IF rc EQ 0.
      WRITE: / 'File does not exist'.
    ENDIF.
    TYPES: BEGIN OF ty_tab,
            DOCNO(10),
            ITEM(4),
           END OF ty_tab.
    DATA : it_tab TYPE STANDARD TABLE OF ty_tab,
           wa_tab TYPE ty_tab.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = 'X:\STO.TXT'
    *     FILETYPE = 'ASC
          has_field_separator = 'X'
    *     HEADER_LENGTH = 0
    *     READ_BY_LINE = 'X'
    *     IMPORTING
    *     FILELENGTH =
    *     HEADER =
          TABLES
          data_tab = it_tab
          EXCEPTIONS
          file_open_error = 1
          file_read_error = 2
          no_batch = 3
          gui_refuse_filetransfer = 4
          invalid_type = 5
          no_authority = 6
          unknown_error = 7
          bad_data_format = 8
          header_not_allowed = 9
          separator_not_allowed = 10
          header_too_long = 11
          unknown_dp_error = 12
          access_denied = 13
          dp_out_of_memory = 14
          disk_full = 15
          dp_timeout = 16
          OTHERS = 17.
    END-OF-SELECTION.
    LOOP AT it_tab INTO wa_tab.
      WRITE:/ 'DOCUMENT: ',
      wa_tab-DOCNO,
      ' ITEM: ',
      wa_tab-ITEM.
      WRITE: / '-----------------------------------------------------------------------'.
      DATA: s_header TYPE bapimepoheader,
            s_headerx TYPE bapimepoheaderx,
            s_item TYPE bapimepoitem,
            s_itemx TYPE bapimepoitemx,
            i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
            i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
            s_bapimepoheader TYPE bapimepoheader,
            s_bapimepoheaderx TYPE bapimepoheaderx,
            s_bapimepoitem TYPE bapimepoitem occurs 0 with header line,
            s_bapimepoitemX TYPE bapimepoitemX occurs 0 with header line,
            wa_message TYPE c LENGTH 100.
      s_bapimepoheaderx-po_number = wa_tab-DOCNO.
      s_bapimepoheader-po_number = wa_tab-DOCNO.
      s_bapimepoitemx-PO_ITEM = wa_tab-ITEM.
      s_bapimepoitem-PO_ITEM = wa_tab-ITEM.
    *Remove Delivery Complete Indicator (DCI)
      s_bapimepoitemx-NO_MORE_GR = 'X'.
      s_bapimepoitem-NO_MORE_GR = ' '.
      append s_bapimepoitem.
      clear s_bapimepoitem.
      append s_bapimepoitemx.
      clear s_bapimepoitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = wa_tab-DOCNO
        TABLES
          return        = i_return
          poitem        = s_bapimepoitem
          poitemx      =  s_bapimepoitemx.
    *Message types: S Success, E Error, W Warning, I Info, A Abort
    *Supress all Warning Messages
    DELETE i_return WHERE ( TYPE EQ 'W' ).
    *Commit only if no errors have been returned
      read table i_return with key type = 'E'.
      if sy-subrc ne 0.
        COMMIT WORK AND WAIT.
      endif.
    *Display Return Messages on Screen
      LOOP AT i_return.
        WRITE: /   'RETURN MESSAGE: ',
        'ID: ',
        i_return-id,
        ' TYPE: ',
        i_return-type,
        ' NUMBER: ',
        i_return-number,
        i_return-message.
      ENDLOOP.
      WRITE: / '-----------------------------------------------------------------------'.
      refresh : s_bapimepoitem,s_bapimepoitemx.
    ENDLOOP.

    hi,
    Use the conversion exit to make it as 10 digit char CONVERSION_EXIT_ALPHA_INPUT.

  • Variable substitution: (delete leading zeros from file name)

    Hi All,
    I am configuring an IDOC to FILE (fcc scenario) with a requirement of using the IDOC number in the output file name. 
    Using variable substitution, I manged to get the IDOC number from incoming Idoc-control record but it comes in its entitre length with a few leading zeroes like '00000001234'.
    So my output file name looks like 'Output_000000001234.txt'  . I want it to be like 'Output_1234.txt'.
    Is it possible to achieve it ?
    Thanks
    Shirin

    Hi Shirin,
    First supress the leading zeros of IDOC number by using the following code:
    Create a user defined funciton zerosuppress and take the cache as value and take one argument input. Then put the code below:
    //write your code here
    String output = input.replaceFirst("^0+","");
    return output;
    Then use variable substitution for generating ur IDOC number in the out put file name.
    Regards,
    Vinod.

  • Displaying leading zeros in ALV

    Hi experts,
      I have a field of length 12 char. I want to display the field in grid.
    My requirement is if the field is below 6 char(such as 101) i want to display as 000101 .I added logic for adding zeros up to six char but the leading zeros are supressed in my grid.
    I want as 000101 but it is showing as 101.
    I am using REUSE_ALV_FIELDCATALOG_MERGE for building the field catalog.
    How to solve this.
    Thanks & regards,
    karthik.

    Hi,
    you must work with a mask for your field like this:
      repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = repid
                i_internal_tabname = 'MY_TABLE'
                i_inclname         = repid
           CHANGING
                ct_fieldcat        = field_catal.
      Modify field for leading 000
      LOOP AT field_catal INTO w_fieldcat_alv.
        CASE w_fieldcat_alv-fieldname.
          WHEN 'NUM_FELD'.                                    "<-- this is your field
            w_fieldcat_alv-edit_mask   = '000000'.
            MODIFY field_catal FROM w_fieldcat_alv.
        ENDCASE.
      ENDLOOP.

  • Leading Zeros in the Numeric Field

    I am working with accounting numbers that may start with zero (0). After this information is inputted and you tab or hit return the leading zero is removed and goes to the first numberic digit. How can I make the leading zero display?
    Thanks,

    Change the display format to show all numbers ('9,999,999.99')and not to supress the leading zero (z,zzz,zzz,zz9.99').
    More information about the display format is contained in the 'Scripting Reference' under LiveCycle Designer's 'Help' menu option.

  • Suppressing Leading Zero in Date

    We are currently having a problem when running a query in BEX.  The date which displays as MM/DD/YYYY is suddenly displaying with the leading zero in the month and day supressed, for example "3/5/2006" instead of "03/05/2006".  This is interfering with macros in our workbook.  We recently implemented support packs but don't know if this is related.  Does anyone know how to fix this?  When running the same query from the Query Designer the dates display correctly, without the leading zeros suppressed.

    Hi adadms,
    Plz check ur system settings.
    Go to control panel : regional options-Date
      check with short date format.
    it may be d/m/yy.
    Thanks,
    sekhar.

  • Reg : leading zeroes

    Hi,
    How to display leading zeroes for the numbers in the output?
    can we use no edit-mask?
    Thanks in advance,
    Sowmya.

    Hi
      use this FM
    CONVERSION_EXIT_ALPHA_INPUT
    to add the leading zeros and
    use this FM
    CONVERSION_EXIT_ALPHA_OUTPUT
    to supress the leading zeros in display.
    Regards,
    kumar

  • Adding leading zeros in abap objects.

    Can anyone explain me
    1. How to add leading zeros to a field in abap objects.
    For eg:
    data: dmb(6) type c value '123456',
    actually the output value of c should have leading zeros added to it for length 16.
    i.e '0000000000123456' . If the length of dmb is less than 16 then leading zeros should be added to that value to make it 16 as length.
    Please tell me how to do it in ABAP Objects.

    Hi Camila
    Try to use the statement
    DATA: ALPHABET(15) VALUE '     ABCDEFGHIJ',
          M1(4)        VALUE 'ABCD',
          M2(6)        VALUE 'BJJCA '.
    SHIFT ALPHABET LEFT DELETING LEADING M1.
    The field
    ALPHABET
    remains unchanged.
    SHIFT ALPHABET LEFT DELETING LEADING SPACE.
    The field ALPHABET now has the following contents:
    'ABCDEFGHIJ     '.
    SHIFT ALPHABET RIGHT DELETING TRAILING M2.
    <b>ALPHABET</b> now has the following contents:
    '      ABCDEFGHI'.
    <u><b>IN CHARACTER MODE</b></u>
    <b>Effect</b>
    This is the default setting (see above), and the addition is therefore optional.
    <b>Note
    Performance:</b>
    For performance reasons, you should avoid using SHIFT in WHILE loops.
    The runtime required to shift a field with length 10 by one character to the right or left requires about 5 msn (standardized microseconds). A cyclical shift requires around 7 msn. The runtime for the ...
    LEFT DELETING LEADING
    ... variant is around 3.5 msn, for ...
    RIGHT DELETING TRAILING
    ... around 4.5 msn.
    Reward all helpfull answers
    Regards
    Pavan

  • How do I use the print function to output a numeric variable with a fixed amount of leading zeroes

    I need to create an output from a T-SQL query that picks a numeric variable and uses the print function to output with leading zeroes if it is less than three characters long when converted to string.  For example if the variable is 12 the output should
    be 012 and if the variable is 3 the output should be 003.
    Presently the syntax I am using is PRINT STR(@CLUSTER,3) .  But if @CLUSTER which is numeric is less than three characters I get spaces in front.
    Please help!

    >> I need to create an output from a T-SQL query .. <<
    NO! NO! In RDBMS, we have a presentation layer that handles displays. We do not ever do it in the database. This is fundamental. But more than that, the purpose of PRINT is for debugging in T-SQL and never for output.
    You are still writing 1960's COBOL or BASIC, but you want to to it in SQL.  You probably picked the wrong data type (a numeric that should be a string) and are trying to repair your design error.  
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • IR - Column with leading Zeros issue

    Hello,
    I've got an IR report which includes as "default report settings" 1 column with leading 0s. In order to export to Excel that column as text rather than as a numeric I followed a workaround proposed before in this forum (excel copy drops leading zeros
    In essence this workaround is to create an identifical column but in "excel text format" and display the columns depending on the request value: INSTR(NVL(:REQUEST,'YABBADABBADO'),'CSV') <> 0 for example.
    This works just fine for the default report.
    The problem arise when a user creates his own customise report that includes the mentioned column and saves it as a named report. Here, when the results are exported to excel the "excel" column does not appear.
    In fact, just hiding one of the displayed columns produces the same undesired result.
    I would appreciate any comments or suggestions.
    Many thanks
    Edited by: Javier Gil on Jul 20, 2010 7:52 AM

    I have found a better method. In your IR query:
    SELECT LPAD(v.vendor, 7, ' ') vendor,
    /*Just LPAD to a length of the column defined in the database table or to 7, whichever is greater. */
    FROM v, r
    WHERE v.VENDOR = r.VENDOR
    AND date_rcv <= to_date(:P150_CUTOFF,'yyyy/mm/dd')
    AND inv_nbr = ' '
    AND to_stores <> 'T'
    AND (V.VENDOR = RPAD(:P150_VENDOR,10,' ') OR :P150_VENDOR = 'ALL')
    When you download to Excel by Download/XLS (Request=XLS), it preserves the leading zeros.
    In the case of dates, you should LPAD 10 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YY'), 10, ' ') date_rcv,
    I haven’t tried it yet but I think in the case of ‘MM/DD/YYYY’, you should LPAD 12 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YYYY'), 12, ' ') date_rcv,
    Drawbacks of this method:
    Since the string has leading white spaces, you cannot use the filter for the ‘=’ comparison operator. Even filtering using leading white spaces will not return anything. You must use the LIKE and NOT LIKE operator instead.
    Advantages of this method over the original one I posted yesterday:
    1)     You do not have to create another column for download, just one column will suffice.
    2)     Even though the query has leading white spaces, they will not display in the IR region.
    Edited by: richardlee on Aug 5, 2010 11:10 AM
    Edited by: richardlee on Aug 5, 2010 11:16 AM

Maybe you are looking for

  • How do I get my apps back on the iPad after OS upgrade?

    I upgraded to OS 5 and all my apps are now gone from my iPad.  I can see them all in iTunes and all the data/photos are on the iPad, but none of the apps.  How do I restore or transfer the apps back to my iPad?  Help!

  • Error in f.14 (recurring jnl)

    Hi, When I am psoting transaction by useing recurring document templete by way of batch input session F.14 It giving an error message. "Session SAPF120 was not created" Cud anyone guide me where I am missing. Regards, Krishna

  • Synchronise Macbook with iMac

    I recently bought a Macbook pro. I also use my iMac. I copied all my files to my macbook but would like to synchronise the two everytime they are in the same network. Is there a possibility without placing all my documents in Icloud?

  • I Chat will not start for the first time on my Macbook Pro after Migration

    Hi hope someone can help as this problem has stumped me. I cannot get ICHAT to even start having migrated all applications via Migration Assistant from a Macbook to a Macbook Pro. Everything else seems to work fine except when I run ICHAT and follow

  • IPhone SDK Download Problems

    I have just made the account and started the long download process for the iPhone SDK. When I download the file and it completes the process, I click on it and it says Disk Image not able to mount. I tried that three more times and it still won't ope