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.

Similar Messages

  • 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

  • Removal of leading zeros for material no. in report

    hi
    my issue is that i have to remove leading zeros for material number when displaying in alv grid.iam getting output.but leading have to truncated automatically.
    eg: 000000000000000102
    the ouput should be 102.
    please do provide solution for this or any function module.thanks in advance.

    Hi Sanjana,
    while populating the internal table use the conversion exit available for MATNR. this will remove the leading zeros.
    oter possible way, declare the internaltable by referring the data element MATNR, i hope if you do this, it will delete the leading zeros automaticallt.
    or if you declare the internal table field as charecter type, use the ALPLA_CONVERSION_EXIT_INPUT ot OUTPUT function module to remove the leading zeros.
    Reward the points if it is helpful..

  • Display key and text in dropdown box & suppress leading zeros in material #

    Hi Everyone,
    I have some questions on how to ....  Can anyone help me?  Here they are:
    How to show material # and description (key and text) both in dropdown box list? 
    How to suppress leading zeros in material #, i.e. 0000000012345678 only show 12345678 ?
    How to show a date with format mm/dd/yyyy not yyyymmdd?
    Thanks alot, Jin
    Edited by: Jin Freda on Mar 25, 2008 4:47 PM

    Hi,
    What type control you are useing for date .
    If you are useing Input field of date type or Date picker control you should get this option in the control properties.
    Can you tell me what are  tabs are appaering in the conrtol properties.
    2.When you you are using the formula Round(@material) ,Are you typing it or draging Field from right side in to  the formula .If you did not drag it you will get Message:Formula has errors.
    One more probelm is there if the Data type of field where you using formula is not Number type.
    Check all above and get back to me.
    3.You are not able to give 6 points for all because its a resrticed one you execeded giving6 points option now you can give only 10 points.
    Regards,
    GOVINDU

  • Delete leading zeros for material in mapping.

    Hi,
    How to delete leading zeros for material like 0000000128736 if so I am expecting 128736 only.
    We need to consider if I get  material number is like RPG2389 .
    Thanks,
    Vinay.

    Hi,
    If you will be getting alphanumeric codes, it would be best to use a UDF with a regex-expression.
    UDF Type:
    ContextType
    imports:
    java.util.regex; (if you are using PI 7.1 you must remove the semicolon)
    arguments:
    input1
    Here's the code (courtesy of Sun Developer Network):
            Pattern p = Pattern.compile("[^a-zA-Z]");
            Matcher m = p.matcher(input1[0]);
            StringBuffer sb = new StringBuffer();
            boolean output = m.find();
            while(output) {
                m.appendReplacement(sb, "");
                output = m.find();
            m.appendTail(sb);
    result.addValue(input1[1]);
    Now to solve the leading zeroes, just add formatNumber: 0 after the UDF and it will work.
    Hope this helps,

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

  • Leading Zeros in SU Number

    We are using SU Managment
    How do we get rid of leading zeros in SU# number range. System is storing pallet ID # with leading zeros in the LEIN table. This is causing issues while we retrive SU data from the tables, systems ask to enter the SU#  number with leading zeros.
    My Pallet Tag is printed with out leading zeros SU # 1234567890 and when the user tries to put away using LM02 system does not read the pallet ID. It looking for 00000000001234567890.
    Even on desktop LS33 if I try to display a pallet with SU # 1234567890 system looks for SU Num. with leading zeros.  Is there a way to get the leading zeros off from SU#
    Appriciate your help

    Please check in SPRO whether the conversion exit is maintained for Storage Unit Management. Follow the below path to do so.
    SPRO -> Storage Unit Management - > Master Data - > Define Number Ranges. In the Pop Up choose "Conversion exit for storage unit number" .
    Here you can define the "length of SU Numbers "
    Regards,
    Kumaran

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

  • BADI to add leading zero to material in DP

    Hello,
    I wanted to check if there is a BADI that can be used while generating CVC (/sapapo/mc62) that will add leading zeros to the product number (9amatnr) while uploading CVCs from FLAT FILE.
    Thanks,
    Sanju

    Hello,
    I am basically trying to create CVC from a TAB delimited file using tcode /sapapo/mc62. The file will be loaded on Application server and  /sapapo/mc62 will pick up the tab delimited file in background. I want a FM or BADI that can pad leading zero in front of the material Characteristics when CVCs are generated.
    Please advise.
    I am not planning to load the file into infocube and generate CVC from infocube.
    Thanks

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

  • Remove Leading zeros for Material in Transformation

    Hi Experts,
    I'm using DTP first time. I don't have much exp on DTP & Transformations.
    I'm creating infocube with some objects. I want to remove leading zeros for zmaterial.
    In 3.x writen update routines as fallows:
    data: zmat(18) type c.
    zmat = COMM_STRUCTURE-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    result value of the routine
      RESULT = zmat.
    I'm confusing in Transfermation where to write this routines.
    I'm writing in Transformation as fallows:
    data: zmat(18) type c.
    zmat = SOURCE_FIELDS-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    RESULT = zmat.
    But it's getting remove zero's.
    Anybody suggest on this.
    Siri

    Dear Sir,
    No confusion at all.
    Just double click on the Target Infoobjct i,e Material object in Transformation, you will see a wizard popping up.
    There you will see a option called "RULE TYPE" and the default value will be "Direct Assignment". In the same check box click on the drop down icon and select "Routine".
    The moment you select the routine option, it will open up ABAP workspace where in you can write your routine and get the desired result.
    Hope it helps.

  • @ adding leading zeros to a number

    Hi,
    How do I go abt adding leading zeros to a 8- digit number?
    eg DATA: number(8) Type N.
        number = 16.
    How do i go about converting this to '00000016'.
    Note that the value in variable number would be read frm a file (Inbound prog).

    Hi,
      Use the function.
    data: tknum type vttk-tknum value '99156'.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
         exporting
              input  = tknum
         importing
              output = tknum
    Regards

  • How can I format a cell in Numbers to have leading zeros in a number?

    I imported a spreadsheet from Excel (Office 2014, Win 7) through iCloud and some numbers were formatted to have leading zeros (012358) in the original Excel file but the leading zero format was lost in Numbers.  Is there a way to format cells to have a number displayed with the leading zero in Numbers?  The leading zero is part of an identification and is important to the numbers (0027 is not the same as 27 in these records).
    thanks,
    Bob

    James has the formating part, but if you already did the import you can use the following formula to replace the zeros that were leading if you know it is a four digit reference number....
    =right("000" & A2,4)
    copy those values into your text formatted column from James' answer and you got it.
    Jason

Maybe you are looking for