Leading zeros of matnr.

i would not like material no to be displayed with leading zeros in my alv report, how to control the dispay patten? "lzero" can only affect numc field.

Hi ,
Try this...
SHIFT <matnr> LEFT DELETING LEADING '0'.
OR
CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
  exporting
    input  = <matnr>
  importing
    output = <matnr>.

Similar Messages

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

  • Add leading zero to matnr in a conversion program

    Hi All,
    When uploading matnr from a text legacy file , should i add leading zeroes to the sku value. For ex the data from the lagacy is 1000123456 (10 digits length). The values are always numbers. The matnr in SAP is 18 chars. Should my program transform it into 000000001000123456 before saving it into mara-matnr?
    Regards, Oli

    Are you sure that in configuration, the Indicator for lexicographical material numbers is unchecked?  If it checked, then SAP will not then the all numeric material numbers will not get leading zeros by default.   =====>
    Indicator for lexicographical material numbers
    Defines the way numeric material numbers are stored in the database.
    Use
    Caution
    It is only possible to set or reset (cancel) this indicator if no numeric material numbers have been used yet in the system since they would no longer be interpretable after setting or resetting this indicator.
    If this indicator is not set, numeric material numbers are padded with leading zeros and stored right-justified

  • Leading zero check got activated in production .

    Hi,
    We had a DIMP ( Discrete Industries Mill Products) addtional installation to our existing landscape on last weekedn.  we have a strange issue after that.
    Most of the select queries based on material number,vendor,customer are failing. with further analysis it was observed that select queries are failing because of leading zero's missing .
    we are surprised since the same queries worked perfectly fine before ( and it still runs perfectly fine in qulaity client) but now it is failing.
    we know workaround to change all custome programs with conversion exit addtion to material,lifnr,kunnar ect.. but does anybody know if there is any business function which got activated to check leading zero's in select queries and this got activated along with DIMP.
    let me know if you have any helpful inputs.
    PS: i wnat to restore my original settings for leading zero so we dont need to change nay programs.

    Hi Santosh,
    some more analysis is required: For the failed selects, where do the missing-leading-zero kunnr/matnr/lifnr come from?
    If from screen input, check the screens are active, check the input fields data type, active, conversion exit correct?
    It may be a good idea to check the whole system for inactive objects.
    If from other sources, check the complete way the data goes before use in SELECT WHERE clause.
    If you have found one errors source, this will lead to more.
    There are a couple of SAP notes on DIMP, at least the activation process of DIMP should be checked.
    Regards,
    Clemens

  • &CAUFVD-MATNR& with leading zeros in sapscript

    Hi,
    i use &CAUFVD-MATNR& in an sapscript-formular for an PP-Order.
    It prints the MATNR without leading zeroes.
    How is it possible to print this field with leading Zeros?
    Thanks.
    Regards, Dieter

    hi,
    use these function modules.
    CONVERSION_EXIT_ALPHA_INPUT    Conversion exit ALPHA, external->internal
    CONVERSION_EXIT_ALPHA_OUTPUT   Conversion exit ALPHA, internal->external
    reward points if hlpful.

  • Why MATNRs leading zeros hv much Impact?

    Hi Experts,
    Just curious to know that, Why MATNR 's leading zeros do hv much impact on many functions, like data pulling, passing them in FM, display on reports/alv i.e. If I pass my_MATNR as 0000000000000018, data will b pulled, if I pass the same as 18, no result! both together same, right! - 0000000000000018 = 18! I mean, Wht is SAPs idea bhind it/MATNRs behaviour?
    I dont think, this is the same case/issue with VBELN/EBELN/KUNNR/LIFNR etc!
    thanq.

    thanq,
    Yes, I hv seen and understand the point.
    But, pls. let me clarify that, for instance am loading up the MATMAS from flat file via LSMW, so my_matnr_1_in_flat_file = 18, my_matnr_2_in_flat_file = AB, my_matnr_3_in_flat_file = 00000000000018, so, How they r stored/posted in data base?
    1)my_matnr_1_in_flat_file = 18, Is it undergoes Conversion<i><b>(CONVERSION_XXXXXX_INPUT)</b></i> routine and stored as 000000000018?
    2)my_matnr_2_in_flat_file = AB, Is it undergoes Conversion routine and stored as AB________________?16spaces
    3)my_matnr_3_in_flat_file = 00000000000018, It is NOT undergo for conversion routine? coz, its already possessing the leading zeros!
    coz, I set breakpoint in CONVERSION_XXXXXX_OUTPUT, and pulled the MATNRs from MARA into my_alv, but the control did not stopped in the said routine!
    thanq.

  • UDF for leading zero's in message mapping

    Dear team,
    I need UDF for leading zero's in my message mapping.
    Source and Target both structures contains matnr field.But we have to maintain total 18 chars at target matnr , because RFC in R/3 needed.So I want to add leading zero's when mapping. Can anybody provide the UDF code.
    Matnr[source]--->split by value(eachvalue) ->UDF->Matnr[Target]
    Ex::if source matnr conatains value "9846538" ; I need matnr value at target side like "000000000009846538"[total 18 chars].
    -Drumi

    Hi Ambrish,
    Good day...
    I have enterd what you said and I got below error... and I gave "input" in place of var1, 18 in place of filedlenght in below program...
    =================================
    int len = Integer.parseInt(18);
    int inputLength = input.length();
    try {
    Integer.parseInt(input);
    // If it is an integer, add 0 (len - inputLength) times
    for (int i=0; i< len-inputLength;i++)
        input = "0" + input;
    return input;
    } catch (NumberFormatException numForEx) {
    // return as it is, if alphanumeric
    return input;
    ====================================
    ERROR:
    Source text of object Message Mapping: Lubrisur_SHPMNT_SHPMNT05_TO_WMMBXY_WMMBID02_TransferPosting | urn:bp:xi:dwn:lu:common:Logistics:100 has syntax errors:
    Function LeadingZeros, Line 1:
    cannot find symbol symbol  : method parseInt(int) location: class java.lang.Integer int len = Integer.parseInt(18);                  ^ 1 error
    =======================
    Please suggest

  • Removing leading zeros in a column

    Hi,
    I would like to remove leading zeros of a column in a table. My Questions :
    1. Is it possible?
    2. Where is it better to truncate, in RFC or Web Dynpro?.
    3. If Possible, How can I do that.
    I appreciate your input.
    Thanks,
    Sunita.

    Hi Sunita,
           Please specify the datatype of the column that contains leading zeros, because if the data type of the column is integer then the leading zeros are automatically taken care.
    If your RFC return you int and you are assigning it to a String then the leading zeros will appear.
    For example, see the below simple ABAP Program. Just copy and execute it. You will see the difference.
    data: a type mara-matnr,
          str type string.
    select single matnr from mara into a.
    write a.
    str = a.
    write / str.
    Hope it helps you.
    Regards,
    Maheswaran.B
    Message was edited by: Maheswaran B

  • Leading zeros in the Product allocation characteristic combinations.

    Hi All,
    I am copying Characteristic combination from planning area to product allocation group, after i complete the transaction system is automatically preceding the zeroes to the product number.
    I have one the following activities before copying CVC of planning area to product allocation group.
    against all the Product allocation settings.
    2.Created the MPOS with product (characteristic length of Product is 18), Customer and Allocation object.
    3.Created planning area and planning book.
    4.Copied cvc combination from planning are to product allocation group and also copied planning area values in to Product allocation group.
    5.Tried to check in the ATP simulation mode, while I was doing system has given no characteristic combination found, when I checked Product is preceding zeros as per the filed MATNR length 40 and this MATNR is selected from the Product allocation field catalog, But when I add zeros to product system is performing Product allocations in simulation mode.
    6.Tried triggering gATP Product allocations by creating Order in ECC, here also it has given same error No characteristic combination exists.
    When I did initial R&D on this. I found that material number in the product allocation characteristic combination is leading by zeros for ex:- 000000000000000002200325.
    Could any one please suggest me what to do on this.
    Thanks and Regards,
    T.Muthyalappa

    Hi Muthyalappa ,
    If i have understood your question properly , then my guess is you should be facing this problem only for numeric material codes. Try out the following things
    1. Execute the same test condition for a non numeric material. I believe it will work perfectly .
    2. For numeric material codes it is not working because of the difference in MATNR length between ECC and APO. In ECC the maximum possible MATNR length is 18 char whereas it is 40 chars in APO. So as per std SAP functionality the numeric materials get concatenated with leading zeros when you try to transfer it (or carry out any kind of processing ) from ECC to APO.
    ex consider material 12345. In ECC it will be stored internally as 13 leading zero's followed by12345 . But in APO it will be stored as 35 leading zero's followed by 12345.  Your issue is the system does not recognize the CVC that has this material as characteristic. At the time of cvc creation / change make sure your material characteristic ( especially for numeric material codes) totally has 40 chars . Pack it with leading zeros and make the material length 40.
    Try this out and update me .
    Thanks
    Saradha

  • Leading zeros in downloaded excel

    Hi,
    I'm facing a problem with truncated leading zeros in downloaded excel. Can anybody suggest me how to get those leading zeros in excel.
    I tried Function modules XXL_FULL_API and WS_DOWNLOAD, both did not work.
    Regards,
    Praveena

    Hi Praveena,
    check the following code.
    data : begin of itab occurs 0,
             matnr  like mara-matnr,
             maktx  like makt-maktx,
             matnr2 like mara-matnr,
           end of itab.
    itab-matnr  = '00000011111'.
    itab-maktx  = 'test1'.
    itab-matnr2 = '00000011112'.
    append itab.
    itab-matnr  = '00000033333'.
    itab-maktx  = 'test2'.
    itab-matnr2 = '00000044444'.
    append itab.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
        FILENAME                      = 'D:\c.xls '
        FILETYPE                      = 'WK1'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        data_tab                      = itab
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    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,
    nagaraj

  • Leading zeros in XLS sheet

    Hello Experts,
    I have one report in ALV format. It is displayed perfect.
    When we download it into XLS format it appends leading zeros in 'NETWORK no' Field.
    Can you all please help me how to remove it?
    Remember, ALV is showing perfect o/p. So
    CONVERSION_EXIT_ALFA_OUTPUT  or any other FM in that category is of no use.
    Also there is no code to download in XLS. User selects Standord procedure to download from ALV.
    But he is getting Leading zeros.
    I would be thankful for the help.
    Best Regards,
    Harish

    HI Joshia,
    Lets consider you are downloading MATNR which comes with leading Zero.
    We solve this by below case .
    you can download the value in character format with preceding single quote .
    if you are downloading 000010 means, assign that value as '000010.
    So that, excel can treat it as character & the zeros will be retained.
    While uploading the data to internal table it_material
    CONCATENATE '"' it_material-matnr into it_material-matnr.
    append it_material.

  • Leading zeroes dropped in Excel

    Hello folks
    I've got an issue with using downloading data onto an Excel file using the FM GUI_Download. The leading zeroes of the PERNR field get truncated when opening the file with MS Excel.
    However the zeroes are in place when the downloaded file is opened with notepad or any other text editor.
    Is there any solution to prevent Excel from dropping the leading zeroes.
    I'm currently using tab as the field separator, and have defined the PERNR field as TYPE C at the internal table used for populating and displaying the data.

    Hi,
    data:matnr(20) type c.
    concatenate text-001 g_t_ekpo-matnr into g_t_ekpo-matnr.
    text-001 is having '.
    I had declared the Matnr as type c so that it can accomodate that single quote.It is indeed downloading the matnr with preceeding zeroes into the excel but along with the single quote.Can't we get the preceeding zeroes into excel without the single quote into the excel.
    Thanks,
    Kiran.

  • 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

  • Display leading zeros in the ALV

    Hello All,
    My requirement is to display leading zeros in the ALV. The leading zeros are not getting displayed. Please suggest how do I achieve this. I have tries NO_ZERO = ' ' and lzero = ' '.
    Thanks in advance.
    Regards,
    Anju

    Here is the Sample code for your ref
    type-pools: slis.
    data: begin of t_itab occurs 0,
           col1 type matnr,
           col2 type char10,
          end of t_itab.
    data: t_fieldcat type slis_t_fieldcat_alv,
          w_fieldcat type slis_fieldcat_alv.
    t_itab-col1 = 10.
    t_itab-col2 = 'A'.
    append t_itab.
    clear t_itab.
    t_itab-col1 = 11.
    t_itab-col2 = 'B'.
    append t_itab.
    clear t_itab.
    loop at t_itab.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input         = t_itab-col1
       IMPORTING
         OUTPUT        = t_itab-col1 .
       modify t_itab index sy-tabix.
    endloop.
    w_fieldcat-fieldname = 'COL1'.
    w_fieldcat-lzero = 'X'.
    append w_fieldcat to t_fieldcat.
    clear w_fieldcat.
    w_fieldcat-fieldname = 'COL2'.
    append w_fieldcat to t_fieldcat.
    clear w_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       IT_FIELDCAT                       = t_fieldcat
       I_SAVE                            = 'X'
      TABLES
        t_outtab                          = t_itab
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    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,
    Bhavana

  • How to remove leading zeroes on form.

    Hi all,
       Is there a way that I can remove the leading zeros that come along with the Serial number from showing in my form.
    i.e for example: the value of &QALS-EMATNR&
    Actual value in the databse table is : "0280012380",
    Printing value on the form is            : "000000000280012380",
    Now I should get the actual value of the field EMATNR
       I had tried with the ways like..
    &QALS-EMATNR(Z)&
    &QALS-EMATNR(CIZ)&
      Is there any aternatives???
    Thanks,
    Surender.

    Hi
    If you print 000000000280012380 it means the value in the variable QALS-EMATNR is 000000000280012380.
    The field EMATNR has MATNR as domain, this is a type char long 18, it has the routines  MATN1 for input/output convertion and that routine doesn't delete the leading.
    I think the option Z works for type number only, so u need to delete the leading zero before printing the data.
    So just as somebody said u can use the fm CONVERSION_EXIT_ALPHA_OUTPUT in order to convert the output format, u should use it in driver program:
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
           EXPORTING
                input  = QALS-EMATNR
           IMPORTING
                output = QALS-EMATNR.
    If you can't change the program, u can create a routine (form) in a new program and call it by the sapscript:
    /: PERFORM DELETE_LED_ZERO IN PROGRAM ZPROGRAM
    /: USING       &QALS-EMATNR&
    /: CHANGING &QALS-EMATNR&
    /: ENDPERFORM
    * &QALS-EMATNR(Z)&
    So create the new program where defining the routine
    FORM DELETE_LED_ZERO TABLES IN_TAB   STRUCTURE ITCSY
                                                            OUT_TAB STRUCTURE ITCSY.
      DATA: MATNR TYPE MATNR.
      READ TABLE IN_TAB  WITH KEY NAME = ' QALS-EMATNR'.
      IF SY-SUBRC = 0.
        MOVE IN_TAB-VALUE TO MATNR. 
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
              EXPORTING
                   input  = MATNR
              IMPORTING
                  output = MATNR
        READ TABLE OUT_TAB  WITH KEY NAME = ' QALS-EMATNR'.
        IF SY-SUBRC = 0.
           MOVE MATNR TO OUT_TAB-VALUE.
           MODIFY OUT_TAB INDEX SY-TABIX.
        ENDIF.
    ENDIF.
    ENDFORM.
    Max

Maybe you are looking for

  • Conversion of Decimal to Binary String

    Hello Labview People: I'm rather new to Labview, so this may be a simple-minded question . . . I would like to take a numeric control and have the decimal input converted to a binary string of 8 bits. So, for example, if I were to put in the number '

  • Help setting up accounts and user rights for students

    hi there, we've just bought an xserve for a college classroom running 20 imac clients and me being new to the xserve and macs in general wondered if you guys can tell me the workflow for setting user accounts up and getting the students to log onto t

  • HTMLTextarea in a custom activity space - _htFormData problem

    I can create a form in a custom activity space and read the HTMLInput form types after the form post in the XPHashtable available in both the Model's SavePage() method and the RepostControl's PerformAction() method - they're all in the htFormData has

  • Inspiron N5050 owners name - how to change

    It's time for my almost daily stupid question. I have a Dell Inspiron N5050, I'm the original owner (bought new at Best Buy in 2012). I had the hard drive replaced under extended warranty and now under Users (when I go into the files on the hard driv

  • Ipod Shuffle is Doing nothing with no Errors??

    Just got My ipod shuffle, was working great had about 120 songs on it, then walking down the street oneday listening to my ipod and it just stoped, wouldn't start back up.. got it home to realize that all my songs were gone on it and it would add any