Regarding the Elimination of leading Zeroes .

Hi Experts,
Iam new to XI.
Iam doing a File to Idoc scenario (PO Response) ,
I want to remove the leading zeroes from one of the field from file and map it to the corresponding Idoc field.
Is there any Standard functions to do this ? If not , Can anyone pls post the code for UDF to execute this Logic.
waiting for ur response.
Thanks in Advance.
Regards
Krupa.

say ur inptu to the udf is <b>inputVal</b> use the below code in UDF:
String output = <b>inputVal</b>.replaceFirst("^0+","");
return output;
or also
int Seq = Integer.parseInt(<b>inputVal</b>)

Similar Messages

  • Add leading zeroes in the IDOC segment data

    Hi,
    How to populate the Document number and EAN code  in the segment with leading zeroes because I have checked that all fields in the segment are of charcter type.
    I want to know can this be handled by customizing or coding but how?
    Thanks
    Prince

    Hi,
    You can use :
       call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exportiong
          input = c1
        importing
          output = c1.
    Regards,
    Subramanian

  • Suppressing Leading Zeroes in the Query output

    Hi,
    I have selected a data field(0MATERIAL) as a free characteristics, It displays text and key and the key has leading zeroes.
    In the infoobject 0MATERIAL, ALPHA conversion routine is not selected, I can't change and insert the ALPHA right now because it would end up with reloading a large volume of data in different targets. To avoid this or to reduce the impact, in the reverse way,
    Could it be possible to suppress this leading zeroes at the query level? I was hoping that there would be a change that I could make at the query level, since it is 0Material and am looking at the point of minimal impact.
    Thank You.

    Hi Senthil,
    create InfoObject ZMATERIAL like a copy of 0MATERIAL, delete all the attributes and insert ALPHA conversion.
    Insert this ZMATERIAL like display attribute of 0MATERIAL. In InfoSource for 0MATERIAL map also ZMATERIAL with the same field that is feeding 0MATERIAL (MATNL). In your query insert 0MATERIAL and ZMATERIAL, and then hide 0MATERIAL (you need to insert also 0MATERIAL because ZMATERIAL is only in display), you will see only the values of ZMATERIAL, that is the material without the zeros in front.
    You can also decide to transform ZMATERIAL like navigational attribute, but in this case you have to change all the structure where do you want ZMATERIAL, because you need to flag it like navigational in that specific structure.
    Ciao.
    Riccardo.

  • CRM 7.0 Leading zeros on material in sales documents delta replication

    Hi
    During initial load of sales documents from ECC to CRM the item is replicated with leading zeros.
    The consequences is that CRM do not find the product and the crm order gets an error message that the product is not maintianed in product master.
    So my question is; how to replicate the order without leading zeros for items?
    BR
    Johan

    Hello Johan,
    You need to check txn:OMSL in ERP and you need to make sure that settings are in sync with CRM customizing path settings.
    SPRO>IMG>Cross-Applicaiton Component>SAP Product>Basic Settings-->Define O/P Format..
    Especially you need to check for the lexicographical flag.
    If this flag is set, then 0123 is different from 123.
    Hope this helps!
    Best Regards,
    Shanthala Kudva.

  • ABAP HR leading zero's for PERNR

    Hi,
    I am working on a report where I have select statements. When the pernr is given with out leading zeros its not taking it.. I need to make the pernr with leading zeros like
    if I hav pernr 35 its not getting data.. when i give 0000035 it gets.. so can i add the leading zeros to the pernr.
    if 3737 then it should be 00003737..
    how can i do this..
    Thanks.

    Hi Oscar,
    Use CONVERSION_EXIT_ALPHA_INPUT Function module.
    Please check this code...
    DATA: lf_pernr LIKE pa0000-pernr.
    MOVE '35' TO lf_pernr.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = lf_pernr
      IMPORTING
        output = lf_pernr.
    OUTPUT: 00000035
    Best regards,
    raam

  • 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

  • Leading zeros in product ID for catalog items

    Hi,
    Does anyone know why some product IDs in the catalog have leading zeros while some don't? It's a hassle to the users to add a wildcard character in the product ID when searching for items in the catalog just because the product ID format is inconsistent. How do we correct the existing catalog items with leading zeros in the product ID and how do we prevent this from happening again.
    Many thanks,
    Joy

    Hi Joy,
    Are the catalog items created in SAP CCM 2.0 SRM_EXTRACTED_CATALOG by extraction from SRM_SERVER or created manually by upload file or similar?
    Regards,
    Jason

  • Adding two leading zeroes infront of a variable(both character and numeric)

    Hi Experts,
    I have a variable v_data. Whatever is the value of the v_data, two leading zeroes should get added to it.
    v_data may be numeric or charachter type.
    I am using FM CONVERSION_EXIT_ALPHA_INPUT for adding two preceding zeroes for numeric types but for character types what logic I should use?
    Currently I am doing:
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = v_data
    IMPORTING
       OUTPUT        = v_data.
    if v_data CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
        SHIFT v_data BY 2 PLACES right.
        v_data+0(1) = '0'.
        v_data+0(2) = '0'.
    endif.
    But the above code is giving output like this: 0 P0001 but I want output like 00P0001.
    How to fix it?
    Regards,
    Sangeeta.
    Edited by: Sangeeta on Nov 11, 2008 6:22 AM

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_data
    IMPORTING
    OUTPUT = v_data.
    if v_data CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
    SHIFT v_data BY 2 PLACES right.
    v_data+0(1) = '0'.
    v_data+1(1) = '0'.   " change this
    endif.

  • Function Module for adding Leading Zero's to a specific field

    Hi,
    Can anyone please provide a Function that will do the following:
    1. Take the value of the field
    2. Take the field type
    3. Output the value of the field with leading zero's.
    Anything similar would be very helpful.
    Thank You & Best Regards,
    John

    Sure use the function  CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
    data: lv_c(10) type c value '123'.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                      input = lv_c
              importing
                     output = lv_c.
    write:/ lv_c.
    Regards,
    Rich Heilman

  • Leading zero

    Hi,
       I working in table control.When i click the download button then all the material number which is in table control should be download in local excel file.
    Its working fine.But the leading zero of the material number is removed.
    Is it possible to download the material with leading zero.If then please guide me.
    Regards,
    K.Sudhakaran.

    Sudha,
    Sorry for a mis-leading answer before. i didnt think through the problem before giving you an answer. The thing here is there are leading zeroes added to your data as long as your data stays in SAP. You will also see leading leading zeroes if you have downloaded the file as a text file.
    But the problem here is Excel has already been set to remove zeroes from the front of a number if that particular coloumn has been declared as a numerical field. You try to show your user to change that field in excel to character so that there will be leading zeroes again.
    Unfortunately, there is not much we can do on the SAP side, as SAP is giving the number out with leading zeroes and excel is doing the trick for you.
    Regards
    Aneesh.

  • EBS check number with leading zeros

    When we upload EBS, we are getting the check number in the record 16 (reference field). But unlike the check number posted in SAP, the check number in the BAI file has 2 leading zeros. Now since check number is coming in record 16, instead of record 88 we are not able to solve this problem through String configuration.
    So, we thought of following solutions(Options):
    1.    Modify the check lot numbers to have two leading zeros plus associated changes like the form and so on.
    2.    Modify the check number in the incoming file u2013 strip the check number with two leading zeros with the use of customer enhancement. (After upload and before posting)
    Can we solve the problem of leading zeros (before the check number) through any configuration steps instead of changing the SAP script form for check(Check lot) or going for customer enhancement.
    Thanks
    Ron

    You are correct, since the check numbers are coming through only in the 16 records and not in the 88 records, you cannot use a search string to resolve the issue with leading zeros.  Also, I do not know of any other configuration that can be used to reformat the reference values in the 16 records.
    The 2 solutions you have listed are both valid options.  Although with the first option (changing the check lots), you would need to make sure the business users approved of changing the check lots before going forward with that option.  And you would still have to manually clear checks that had been issued prior to the check lot change.
    At my company, we went with the second option - using ABAP code to update the check numbers from the file to match those in SAP (we actually had to add leading zeros to the check numbers).  In our case, we had already created a pre-processor program for other re-formatting of the file that was needed prior to loading it into SAP - so we added the check number logic to that.
    However, if you do not have a pre-processor program, I know there is a user exit available for EBS - exit EXIT_RFEBBU10_001, include ZXF01U01.  I have heard of others using this exit to update the check numbers from 16 records.  The exit is called during the FF.5 processing.
    Regards,
    Shannon

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

  • Leading Zero's

    Hi All,
       I am facing the problem with leading zeros.I am getting the  value for the field ZZMATNR is '00000000000000000000000000000000000000000000000000358934'.But user is expecting the value '0358934'.
    I used the function module 'CONVERSION_EXIT_ALPHA_OUTPUT'.
    I am getting the value is '358934'.But user expecting the value is '0358934'.
    In the table itself the value is '0358934'.
    Please help me how to code this.
    Regards,
    sujan

    Hi Sujan T,
    Does the user always expects a leading zero even if the value has 7 digits?
    If so, then after you use the FM 'CONVERSION_EXIT_ALPHA_OUTPUT',
    use the following:
                               CONCATENATE '0'  '358934' into new_value.

  • Add and remove leading zeroes

    Hi all,
           Iam having a requirement where in a enduser enters the vendor number and after pressing enter key it should display the vendor num along with vendor name concatenated in the same field. But the end user is provided the facility that he may not enter the exact vendor number ( I mean if vendor number is for example 0000055,  the enduser may enter simply 55). The system should convert it with leading zeroes internally. And in display it should display removing leading zeroes.
    like     input:  55              output : 55 Vendor_Name
    my approach
    iam using conversion_exit_alpha_input    for adding leading zeroes       before select query ( to fetch the vendor name for vendor number the user supplies)
    before displaying the output after concatenation,
    iam using  conversion_exit_alpha_output.
    after execution,
    it is asking the exact vendor number .  But in the output, it is giving the vendor number along with vendor name by removing leading zeroes ( as expected).
    how to make the system accept the number without leading zeroes. please suggest me.
    tthanking you in advance
    regards
    Bikash

    Hi Bikash,
    Since you have to display the Vendor number concatenated along with the Vendor Name, why do you need to use the Alpha Exit Function Module. As you have the Vendor number without the zeros in the input field, you can store it in a temporary variable and then once the Vendor name is available you can concatenate it along with the number in the same field.
    If you need a code snippet, you can provide the Technical details of the fields of input. We can use the implicit ABAP    type casting feature to get the Vendor Number without any leading zeros.
    Hope this helps.
    Thanks,
    Samantak.

  • Default leading zeros during loading

    Hi! I have part numbers that tend to have varying length and I have a requirement to put leading zeros before them when I load the catalog data via Import Manager. The Replace function would not work for this as the number of leading zeros is not fixed. Does anyone know o a way to do that?
    Cheers!
    SF

    Hi,
    Have a look at the below approach
    Assumption- Max Part Number length would be 10 digits.
    Create one Assignment with expression
    Mid(10000000000+PartNumber,2,10)
    Expression will first add the PartNumber with 1000000000 then using Mid function it will extract the desired result.
    E.g.
    PartNumber = 3030
    1000000000+3030 = 10000003030
    After Mid = 0000003030
    Create one workflow with the Assign step and use the assignment created above. Launch this workflow on Record Import.
    I tried this and its working fine.
    Regards,
    Jitesh Talreja

Maybe you are looking for