Adding zeros to a string

Hi all,As you know mara-matnr field's lenght is 18 char, however in some cases the users do not fill all the length, for example they make it 15 char.
Here I need to add zeros at the beginning of the matnr, as it requires.
For instance, if the user has entered the matnr as 13 char: 1234567891234
then I need to make it as 000001234567891234..
How can I do it?
Thanks.

USE THE FUNCTION MODULE,
<b>conversion_exit_alpha_input.</b>
conversion_exit function modules are for the purpose of converting a fiedl from user format to sap format and vise versa. there are many conversion exit fn modules.
u can give converion_exit* in se37 and see many fn modules.
example: conversion_exit_alpha_output   this is to convert from sap format to user format.
this means example in mara table the length of matnt would be 18. but if we give 1 value . it takes 0000000000...1. but the user needs the output as only 1. then we can use conversion_exit_alpha_input to convert from sap to user format.
conversion_exit_alpha_input cn be used viceversa.
Message was edited by:
        Hymavathi Oruganti

Similar Messages

  • Leading zeros in item strings

    We've recently done a system upgrade to 11.5.10.2. One of the problems we've found since the upgrade is that the Segment 2 from the item description strings has lost its leading zeros. Our string is in the format xxx-0000-0-xxx with segment 1 being the family, 2 being an item number within the family, 3 being the item level, and 4 being a manufacturer id. We previously didn't have any problem with missing leading zeros.
    What was previously ERT-0101-1-ABC is now showing as ERT-101-1-ABC. If this were purely for display purposes it wouldn't be too important, but it's affected some of our interfaces and reports. Even wiithin the standard inventory/mrp/order management screens, the item format changes depending on the individual form.
    It looks as if different screens/functions treat items in different ways - sometimes treating the string as a whole, other times apparently working each segment separately and then displaying a concatenated, lead zero less string. In the System Item segments value set for segment 2, I can see that Right-justify and Zero-fill Numbers is switched on. Is it this option that's failing?
    We've already implemented some fixes by padding the segment out as we produce the XML files we need for export, but before we get our support contractors to build fixes in all over the place I thought I should ask if there's a more singular fix for this.
    I can see some rather old issues logged in Oracle Support, but not a recent one related to this upgrade and zeros going missing.
    Any help gratefully received. :)

    Yes, the format validation for it is number. I'm reasonably certain it always used to be number, though.
    Should their be any detriment elsewhere if I had it changed to Char?
    The field (in our test system) is protected against update - how can I remove the protection to test this?
    Thanks for your help so far :)

  • Removing leading zeros from a string value

    Hi All,
    i have a Requirement like , i need remove leading zeros from a string value,
    like , 00Raj00Shekar==>Raj00shekar,
    how can i do this ?
    if it is only with the custom functions ,where can add the fuction in Jdeveloper and SOA Middle ware?
    Thanks in Advance,
    Raj

    Hi Raj,
    you can use below function to get the desired output in xsl.
    <xsl:value-of select='translate(oraext:left-trim(translate(<inpString>,"0"," "))," ","0")'/>
    HTH,
    Regards,
    Vikas Manchanda

  • Remove leading zeros from a string

    Hi,
    I have a string with some numeric value.
    e.g.
    String a = 54890001
    I want to make it 10 digits long by padding zeros at the begining
    Now a = 0054890001 ( this is for display purpose ) I know how to do it.
    Now How can strip these leading zeros from this number to get back the actual number. The user sees this 10 digit number and he can change it to something like 0067490001. Now I want to strip these leading zeros.
    and i shd get 67490001.
    In other words, how to strip leading zeros from a string ?
    Thanks for help
    Vinod

    I would try two things: First, just try a straightforward parsing of your String using the Integer.parseInt() method. This is only my first suggestion because the number could be interpreted as octals; only testing will really tell. Second, try a method like this:
    public static String removeLeadingZeros(String str) {
        if (str == null) {
            return null;
        char[] chars = str.toCharArray();
        int index = 0;
        for (; index < str.length; index++) {
            if (chars[index] != '0') {
                break;
        return (index == 0) ? str : str.substring(index);
    }Shaun

  • How to add leading zeros to hex string?

    Hi, I've got the following problem:
    I have a string that represents a 8-digits hexadecimal number. But if the number has less as 8 digits, I need to add the leading zeros. I can't use DecimalFormat, 'cause it works only with decimal numbers. Is there any elegant solution to add the leading zeros to hex string (for example "A3F" to "00000A3F")

    Or better use a StringBuffer for that, though I doubt it's a performance problem in your case.

  • (ADI) JOURNAL UPLOAD IS ADDING ZEROS TO SEGMENT VALUES

    제품 : FIN_GL
    작성날짜 : 2003-09-16
    (ADI) JOURNAL UPLOAD IS ADDING ZEROS TO SEGMENT VALUES
    ======================================================
    Problem Description
    ADI에서 Journal Import를 시도할때, Account segment value값에"0"를 자리수만큼 채워서 upload를 시도하는 경우가 있다.
    예를들어, segment value가 300 인데, ADI에서 Journal Import시
    0300 으로 바뀌는 경우이다.
    이 경우, Segment Value중에 0300이라는 값이 없기 때문에, upload시
    에러가 발생한다.
    재현방법 :
    Responsibility = General Ledger Super User
    ADI path = Click on the Ledger Book from the ADI toolbar/Enter Journals
    1. Log on to ADI as the General Ledger Super User.
    2. Proceed to the Create Journal Worksheet form using the above navigation.
    3. Choose the appropriate journal type and click on the green check mark to
    continue. This will load Excel and the appropriate journal template.
    4. Enter your Journal information in the header and body. Place the value of
    the segments that you would like in the segment value portion of the journal.
    5. Once the journal is completed, click on the Ledger Book from the ADI toolbar
    and select the green arrow to upload the journal.
    6. Once the journal upload is complete, you notice that the values that were
    uploaded for a certain segment have a zero added to them.
    Solution Description
    "0"가 자릿수만큼 채워지는 것을 막기위해, ADI setup중 "Zero Pad" 기능을 uncheck한다.
    Responsibility = General Ledger Super User
    ADI path = Click on the Hammer and Screwdriver(망치와 드라이버가 그려져 있는 Icon) from the ADI toolbar/General
    options/Settings
    1. Log on to ADI as the General Ledger Super User.
    2. Proceed to the Settings form using the above menu path.
    3. Uncheck the Zero Pad check box on this form.
    4. Save your changes and repeat the journal import process for this journal.
    Explanation
    "Zero Pad"기능은 check되었을때, 해당 Segment의 Maximun Size만큼 "0"으로 채워준다.
    이 기능을 uncheck하면, "0"의 추가확장 없이 입력된 그대로를 사용하게 된다.
    Reference Documents
    Note : 113051.1

    Hi,
    Are you choosing Functional Journals template and trying to upload Foreign Currency journals or vice versa? Please check
    Regards,
    Sridhar

  • [svn:fx-trunk] 11717: Bug Fixing Localized SDK - modified one file xercesSchema. properties in xercesImpl_ja.jar - added " to one JA string.

    Revision: 11717
    Author:   [email protected]
    Date:     2009-11-12 11:54:22 -0800 (Thu, 12 Nov 2009)
    Log Message:
    Bug Fixing Localized SDK - modified one file xercesSchema.properties in xercesImpl_ja.jar - added " to one JA string.
    ANT CLEAN MAIN successful
    Modified Paths:
        flex/sdk/trunk/lib/xercesImpl_ja.jar

  • Adding zeros to a character string

    Hello friends,
    I want to add leading zeros for a field.
    the field is a character string.
    for example ,
    data: A(5) type c.
    now when A  = 'ab' (non-numeric value)
    i want this to be converted in '000ab'
    so, is there any standard Function module or any other way for doing this conversion ?
    I tried the FM   'CONVERSION_EXIT_ALPHA_INPUT' but this FM does not work for non-numeric inputs..
    Thanks.

    Hi,
    The packed field is transported right-justified to the character field, if required with a
    decimal point. The first position is reserved for the sign. Leading zeros appear as
    blanks. If the target field is too short, the sign is omitted for positive numbers. If this is still not sufficient, the field is truncated on the left. ABAP indicates the truncation with an asterisk (*). If you want the leading zeros to appear in the character field, use UNPACK instead of MOVE.
    UNPACK
    Converts variables from type P to type C.
    Syntax
    UNPACK <f> TO <g>.
    Unpacks the packed field <f> and places it in the string <g> with leading zeros. The opposite of PACK.
    Regards,
    Bhaskar

  • Strings adding zero's to arrays

    I have a program that arranges 4 arrays which consist of columns of 10
    data points from each iteration of the program. The final program puts
    these sets of 10 pts into one long column. I converted the array into a
    spreadsheet string. I used the match pattern to find and replace the new
    line characters and returns with tabs. Each column has 10 data
    points, then one zero separating them from the next 10 points. I've
    tried the same idea using backspace, form feed, space characters, etc,
    and I still have one row of zeros separating my data points. Does
    anyone have any idea what this character could be or how to fix this? I
    tried all of the characters in the manuals and none will get rid of this
    problem.
    Heather
    Sent vi
    a Deja.com http://www.deja.com/
    Before you buy.

    The poster who suggested the "zeroes" could be squares- signifying a
    non-printable character, may be on the right track.
    However, it occurs to me that you're using quite an unwieldy way of tackling
    a simple problem- and that the way you're using is unnecessarily platform
    dependent and complicated by the need to handle a return and a linefeed.
    I'm not quite sure how your arrays are arranged- as four discreet arrays?
    If it's four separate arrays with 10 points and you want one big array, you
    can use the "build array" function. If you pop up the right mouse button
    menu over this, you see an option to change an input from an element to an
    array. If you make a "build array" with four array inputs, what you get out
    is one long 1D array with the four sets of data appended one after the
    other. If you then want the output as one long column, a useful trick is to
    feed your new array into another "build array" node, this time with only a
    single "element" input. This promotes the 1D array to a single column 2D
    array, that you can then feed through a "transpose 2D array" and then into a
    "build spreadsheet string" to generate your output string without having to
    do all the search and replace operations. You may or may not need the
    "transpose 2D array", depending on how the file turns out- I tend to simply
    do things like this without thinking them through and then tweak them to
    make them work- which I find quicker than going through all the details in
    advance.
    wrote in message news:[email protected]...
    > I have a program that arranges 4 arrays which consist of columns of 10
    > data points from each iteration of the program. The final program puts
    > these sets of 10 pts into one long column. I converted the array into a
    > spreadsheet string. I used the match pattern to find and replace the new
    > line characters and returns with tabs. Each column has 10 data
    > points, then one zero separating them from the next 10 points. I've
    > tried the same idea using backspace, form feed, space characters, etc,
    > and I still have one row of zeros separating my data points. Does
    > anyone have any idea what this character could be or how to fix this? I
    > tried all of the characters in the manuals and none will get rid of this
    > problem.
    >
    > Heather
    >
    >
    > Sent via Deja.com http://www.deja.com/
    > Before you buy.

  • Adding zeros to a variable..

    I hav ea program that manipulates/works on six digit number entered by user.what i want is that if user enters less than 6 digits, program adds zeros at the end of number to make it 6 digit. like if user enters 241 program converts it into 241000 before manipulating it.which area i must look into? contecating or what?

    Strings? Strings? We don' need no stinkin' Strings!
      while(x < 100000) x *= 10;this code works for all non-zero input that is actually 6 digits or less.
    You didn't specify what you want to do for zero input, or negative input, or too long input. Here is some more robust code that works for all those cases, but you will need to check if it does what you want.
      int digitLimit = 1000000; // number of zeros here is number of digits.
      if(x<0){ // input was negative
        while(x <= -digitLimit){x /= 10;}
        x = -x; // done backwards to prevent failure on smallest possible negative number
      } else if (x = 0) { // input was zero
        x = 123456;
      } else if (x >= digitLimit) { // input was too big
        while(x >= digitLimit) {x /= 10;}  
      // this final pass deals with both small neg and small pos
      while(x < digitLimit/10){x *= 10;}

  • Pad leading zeros in a string.Format function

    How could use the string.Format function and in the format text pad a leading zero? 
    Pseudo code is:
    string parm = “5”;
    string format = “Some number formatted as 3 dig: Format({0}, 000)”;
    string output = string.Format(format, parm);
    Where the output would look like this:
    “Some number formatted as 3 dig: 005”
    Thanks.

    Thanks everyone. Unfortuantly there's a constraint where the padding operation needs to be embedded in the format string. This entire operatin is being put together dynamically where the format strings are being pulled from a library of format strings stored
    in a database. at runtime we don't know how which format will be used and how many parameters will be passed in. we have logic to handle the unknown number of paramters as there is metadata which helps us with that.
    the need for leading zeros needs to be part of the overall format defined in the format string.  for example, a real format string stored in the database looks like this:
    "LINE_NO = '{0}',  AND GEO_LOCATION = 'T{1}, {2},  R{3}, {4}, , Sec. {5}'"
    and its output from the string.Function is:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 5'"
    the last parameter (param 5) had a value of 5.  In another case the output requirement might need to look like this:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 05'"
    note the "05" at the end...
    the logic of using the leading zero needs to be embedded in the overall format string text.
    Thank you.

  • Adding zeros to filenames when exporting in Lightroom "Filename-001" "Fliename-002" etc?

    Hi, does anyone know if it is possible to add zeros before numbers when exporting files eg: "Filename-001" "Fliename-002" etc? The default setting is "Filename-1" "Filename-2" ect. The reason I want to have zeros in the number sequence is that certain software will display files in the wrong numerical sequence eg: "Filename-1" "Filename-10" Filename-11" etc and then "Filename-2" after "Filename-19". If zeros are added the files will always be displayed in the correct sequence "Filename-001" "Filename-002"... "Filename-009" "Filename-010" "Filename-011" etc.

    Just customize the filename using the template editor, and use the Sequence token set to the number of leading zeroes you want, as shown.

  • How to delete Trailing zeros in a string array

    I am reading data from RS232 port and storing the values in an array of 16 nos. Then converting the array of numbers into string using 'number to fractional string" function with precession 2  and sending the data string to Table. I am printing this table further for report generation.
    I am unable to remove the trailing zeros as i am defining precession 2 which is not needed for all the numbers in the table.
    Please help me how to remove the trailing zeros after decimal point which is very much necessary for report generation.
    regards
    Prasanna Kumar N M

    Use format into string in a FOR loop with a format specified of %#f. See attached example (LabVIEW 7.0)
    Message Edited by altenbach on 10-14-2006 05:40 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AutoFormat.vi ‏17 KB
    AutoFormat.png ‏3 KB

  • How to remove leading zeros from a string

    Hi,
    I have a situation here where i need to remove the leading  zeros from the incoming data.
    i.e if 0009 then it should be taken as 9
       if 0230  it should be taken as 230
    Regards,
    Ashish

    Hi ,
    Write UDF to parse data .
                    String dataVal="0230";
              int parseVal = Integer.parseInt(dataVal);
              System.out.println("parseVal is "+parseVal);
    result.addValue(parseVal); or return parseVal;
    Nanda

  • Validations with date(Adding zero's)

    Hi,
      can anyone tell me regarding this:
    if the date is 5/5/2008 - the output should be 05/05/2008, means 0 should be concatenated in month and date.
    else if date is 5/12/2008 - the output should be 05/12/2008
    means 0 should be concatenated only in front of 5.
    please help.

    Hi,
    I cant get your requirement clearly. Anyway I give you some solution below:
    1. Declare the variable of TYPE SY-DATUM, so that automatically concatenate zero in front.
    OR
    2. You need to declare one variable as STRING and assign the input date to the string and split it at '/' then store date and month in two other variables and check those two variables are less than 10. If so then concatenate '0' in front else leave as it and finally concatenate as per your requirement.
    Regards,
    Raghu

Maybe you are looking for

  • How can I insert/move a table cell in Pages?

    I'm making labels for tab dividers (specifically, for dividers in comic book boxes) and I'm trying to figure out how I can insert an empty cell in the table. Or move the other cells over/down and have them "wrap" from the end of the row to the beginn

  • How can I turn off autosearch in Firefox to allow for an unknow address?

    I need help disabling the autosearch provider in Firefox 8.0. I need to reset my wireless adaptor for my Tivo DVR and in order to do this, I disable my wireless network, type a series of numbers into the Firefox address bar and click return key. This

  • Signature with PSS scheme

    Hi, iam trying to sign a message with the following Siganture: Signature sig = Signature.getInstance(Signature.ALG_RSA_SHA_256_PKCS1_PSS, false);now iam getting a NO_SUCH_ALGORITHM exception. iam using JavaCard 3.0.1 and as far as i know this Signatu

  • Crash using toolbar

    I'm a Mac OS 10.4.11 user. I have a G5 i Mac and I use the Reader 8.1.2 When I use the toolbar commands or I move the mouse on the display the Reader crashs. I haven't problems when I use de menus command. Do you mean what kind od thing causes this p

  • Disabilty of a button?

    I have a button I want to diable clickabilty to but i still want it there how do i do this?  It doesn;t matter which button you choose I just want an example?  Please..... Help import flash.net.URLRequest; import flash.events.MouseEvent; var homeURL: