Remove leading numbers in string field

I have a string field "01-Submitted" and wold like to remove the "01-".  How can this be done?

Hi Create a formula:
split(field,"-")[2];
place this in the detail and see if prints the values.
Regards,
Vinay

Similar Messages

  • Removing Leading Spaces in the field to be displayed

    Hi,
    Could you please tell me how to remove leading spaces in currency field in write statement?
    the length of the field cannot be changed by writing fieldname(length).
    is there any other method to do the same. the length should vary according to the amount in the field.
    Ragards,
    Krutika

    hi,
    please use "SPLIT "  or condense  .
    eg:  SPLIT wa_bseg-hzuon at space into wa_bseg1-hzuon l_space.
    to better understand refer this code:
    IF it_mhnd IS NOT INITIAL.
      SELECT hzuon bukrs gjahr augdt augbl
      FROM Bseg
      INTO TABLE it_bseg
      FOR ALL ENTRIES IN it_mhnd
      WHERE belnr = it_mhnd-belnr
        AND bukrs = it_mhnd-bukrs
        AND gjahr = it_mhnd-gjahr
        AND umskz = 'E'.
    endif.
    data: l_space type char6.
    loop at it_bseg into wa_bseg.
      SPLIT wa_bseg-hzuon at space into wa_bseg1-hzuon l_space.
      wa_bseg1-bukrs = wa_bseg-bukrs.
      wa_bseg1-hzuon = wa_bseg-belnr.
      wa_bseg1-hzuon = wa_bseg-gjahr.
      wa_bseg1-hzuon = wa_bseg-umskz.
      append wa_bseg1 to it_bseg1.
      clear: l_space, wa_bseg1.
    endloop.
    IF it_bseg1 IS NOT INITIAL.
          SELECT belnr bldat
            FROM bsad into table it_bsad
            FOR ALL ENTRIES IN it_bseg1
            WHERE belnr = it_bseg1-hzuon
            AND   bukrs = it_bseg1-bukrs
            AND   augbl = it_bseg1-belnr.
    endif.
    regards
    rahul
    Edited by: RAHUL SHARMA on Jan 5, 2009 12:19 PM
    Edited by: RAHUL SHARMA on Jan 5, 2009 12:20 PM

  • How to remove leading zeroes of string

    Hello All,
    I have a scenario where Partnumber string type shows 00000000012345 format, I want to remove leading zeroe and displ only 12345 .
    How to do it,
    Suggest

    Hi Pradeep,
      Please go through this wiki. [https://www.sdn.sap.com/irj/scn/wiki?path=/display/java/remove%252bleading%252band%252btrailing%252bzeros%252bfrom%252ba%252bstring]
    It explains how to remove zeros from strings.
    extract from the wiki. This is an efficient way.
    public java.lang.String removeLeadingZeros( java.lang.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);
    If you want to show this string in a table instead of the ones with zeros you can create a calculated attribute  of type string on the same node and in the getter method read the string with zeros using getAttributeValue() api and pass the string to the above method and return that string value.
    You can also have another approach if you will only have numbers in your string. Have a calculated attribute of type int. In the getter method read the String using getAttributeValue() api and then convert it to an int using Integer.parseInt(String) and return the int value.
    Regards,
    Sanyev

  • Truncate numbers from string field

    Afternoon all,
    This time I'd like to extract only 2 strings out of a string field. The field is of sales area which contains numbers and letters. For example, Scotland is given a number 01, West midlands is 02, Ireland however is given IR.
    however, the field which holds the information is like, 012, where 01 is the area number and 2 is type of area number.
    The information which we are interested in is first two strings.
    I have tried this in the formula given below but it doesn't work, it states a field is required
    If hasvalue({?Sales Area}) then
    totext(Minimum({slslsp.slr_slsperson}[1 to 2])) + " - " +
    totext(Maximum({slslsp.slr_slsperson}[1 to 2]))
    else
    "n/a"
    Should I be using a truncate and if yes then how?
    P.S. This is to show only the sales area number or text if selected under a parameter. The values of the parameter will stay the same. In other words it is just to show in the report.
    Many thanks once again
    Regards
    Jehanzeb

    Is it a range parameter? If so try this
    If hasvalue({?Sales Area}) then
    totext(Minimum({slslsp.slr_slsperson})[1 to 2]) + " - " +
    totext(Maximum({slslsp.slr_slsperson})[1 to 2])
    else
    "n/a"
    regards,
    Raghavendra.G
    Edited by: Raghavendra Gadhamsetty on Jan 16, 2009 4:16 PM

  • How to remove leading 'S' in target field

    hi
    i have to remove the leading 'S' in the target field, can some on help me with this reqmnt.
    regards
    manoj

    Hi Manoj,
    Check out : http://help.sap.com/saphelp_nw04/helpdata/en/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm
    Activities
           1.      To create a new user-defined function, choose Create New Function (This graphic is explained in the accompanying text) in the data-flow editor at the bottom of the screen, on the left-hand side.
           2.      Specify the attributes of the new function in the subsequent window:
    Name:
    Technical name of the function. The name is displayed in the function chooser and on the data-flow object.
    Description:
    Description of how the function is used.
    Cache:
    Function type (see above).
    Arguments:
    In this table, you specify the number of input values the function can process, and name them. All functions are of type String.
           3.      In the subsequent window, you can create Java source code:
                                a.      You can import Java packages to your methods from the Imports input field, by specifying them separated by a comma or semi-colon:
    You do not need to import the packages java.lang.*, java.util.*, java.io.*, and java.lang.reflect.* since all message mappings require these packages and therefore import them. You should be able to access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the package under Import. In other words, you do not have to import it as an archive into the Integration Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
    In addition to the standard packages, you can also specify Java packages that you have imported as archives and that are located in the same, or in an underlying software component version as the message mapping.
                                b.      Create your Java source text in the editor window or copy source text from another editor.
           4.      Confirm with Save and Close.
           5.      User-defined functions are limited to the message mapping in which you created the function. To save the new function, save the message mapping.
           6.      To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box displayed.
    Thanks,
    Pooja

  • Remove leading zeros from string

    I am working on a report and I am having a little issue with the output.
    I have several dollar amount fields that I need to format with only the decimal place. The amount fields are coming in as strings between 10-16 characters.
    I could not find a way to use the currency formatter so I used substrings to break it apart and put it back together in the format I need. However I am now running into an issue with leading zeros. I can't used ReplaceAll as there is a possibility of having a 0 in the amount field.
    Here is what I have done for the substrings:
    int intLength = strField.length();
    intDollar = intLength - 2;          
    strDollar = strField.substring(1, intDollar);
    strCent = strField.substring(intDollar, intLength);
    System.out.println(strDollar + "." + strCent);The original string: 0000000037049469
    My output now: 00000000370494.69
    Desired output: 37049469
    Any suggestions on how to remove the leading zeros?
    Edited by: xxwhocaresxx on Jun 10, 2009 12:11 PM

    804350 wrote:
    Just wanted to comment that I solved the issue differently by casting the string value to an integer and back. Don't know if it's bad solution performancewiseNever, ever, ever, ever, ever, ever, ever worry about performance. At least not until you're much further along the road; and even then not until you've proved that it's inadequate.
    but it's quite compact and readable and did the job of eliminating leading zeros.I suspect you'll also find that it has the great advantage of providing you with a dollar (or cent) value that you can use elsewhere in your program the way it was intended.
    example:
    String noZeros = String.valueOf(Integer.parseInt(stringWithZeros));Or possibly even more usefully:
    int cents = Integer.parseInt(stringWithZeros);
    String noZeros = String.valueOf(cents);I'd also suggest looking up the NumberFormat and DecimalFormat classes, and PrintStream.printf(); all very useful for what you're trying to do.
    Winston

  • 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

  • Remove leading Zeros from the mapped context node(Table)

    HI,
    I have he following requirement:
    In the Leave approval application , in the Approver worklist we have the coloumn to display the resuqester's Perner.
    The perner starts with leading zeros. We have to remove these leading zeros.
    I have refer the following threads:
    Removing leading zeros in a column
    How to remove leading zeroes of string
    and wiki document:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/java/remove%252bleading%252band%252btrailing%252bzeros%252bfrom%252ba%252bstring
    but I am not able to create the calculated attribute in the Mapped Node( NWDS is not allowing indicating it is not allowed for mapped nodes.)
    Any pointer how I can remove leading Zeros from existing column?
    If I create the calculated attribute outside the mapped node then it is taking only the first value of the mapped node.
    Please note we do not want to modify the RFC.
    _vishal

    Hi,
    Thanks for inputs,
    Now I created a test application where the original structure is as follows in the View Controller:
    1) Context -> Z_Portal_Test_Input (mapped Node/folder) -> IT_Tab_Input(mapped Node/folder) -> Eid(Mapped attribute)
    note: this attribute Eid has the values (01, 02,03,04,05)
    2)Context -> Z_Portal_Test_Input (mapped Node/folder) -> Output(mapped Node/folder) ->IT_Tab_Input(mapped Node/folder) -> Eid(Mapped attribute)
    Now as per your suggestion I created another node like this
    Context -> Z_Portal_Test_Input (mapped Node/folder) ->testnode(value node) ->testValue(value attribute)
    testnode cardinality is 1..1 and singlton = false
    In the Layout
    The tablecell editor  of one coloumn is mapped to text     Z_Portal_Test_Input.testnode.testvalue
    It is expected that this will show the values like(1,2,3,4,5) but it is showing value(1,1,1,1,1)
    The code of get method is:
      public java.lang.String getTestnodeTestvalue(IPrivateTestpernerView.ITestnodeElement element)
        //@@begin getTestnodeTestvalue(IPrivateTestpernerView.ITestnodeElement)
          String  msg =wdContext.nodeZ_Portal_Test_Input().nodeOutput().nodeIt_Itab().currentIt_ItabElement().getEid();
            return removeLeadingZeroes(msg);
        //@@end
    the functon removeLeadingZeroes(msg) is implemented as per the wiki link.
    What wrong I am doing/ missing....
    _vishal

  • Removing leading spaces

    How can I remove leading spaces on a field before it is saved to the database. I know that I need to use the LTrim function. However, I am unsure as to where.
    thanks.

    though there are plenty of ways you could do this depending on your page's setup, a simple implementation of this in a wizard-generated form on a table would be to put a Computation on your page for that item that fires with a "Computation Point" of after submit. so if you had a form on the Emp table, and you wanted to ltrim your P1_JOB item, you could do it using an after submit computation with a "Type" of "SQL Expression" where the body of your computation would simply be...
    ltrim(:P1_JOB)
    ...hope this helps,
    raj

  • Leading zeros remove from FB05 for assignment field in process open items b

    Dear expert
    At present i am using the electronic bank statement completed OT83 & OT51configuration, when i am running FF-5 the EBS soft copy has been uploaded and created batch input session.
    I executed  batch input session and the transactions has been posting through FB05 for outgoing payment clearing  with assignment field ( where check number is laying correctly and matching EBS soft copy cheque number and SAP outgoing clearing account line item assignment cheque number ) in case of outgoing clearing is happening correctly.
    but where as i have a problem incoming clrg cheque number which is displaying in assignment field and updated when client using FF68(check deposit / collections).
    the user is punching all collections from customers using t.code FF68 and cheque number is updated with 6 digit number in the variant. it is like a JV.
    after posting batch input session the cheque is number displaying in assignment field. the cheque number is updated with 6 digit number. but in the variant cheque number width 6 digit only  but after posting FF68 & SM35 the system automatically taking leading zeros for the remaining length. Cheque number standard length in SAP 13 in table .
    total 13 digit length but user punched only 6 digit only, because the cheque number 6 digit numberonly. so the remaining 7 digits it is occupaying 0000000.
    while executing FF_5 and SM35  (thr FB05) the assignment field cheque number (0000000586585) and soft copy cheque number 6 digit (586585) is not matching , because of that i am unable to clear the incoming collections or incoming payments clrg.
    so how  can i remove the leading zeros after cheque number ( actually displaying 0000000586585 , but i want without zeros only cheque number 586585) in assignment field in FB05 using FF-5 & SM35).
    is there any enhancement or user exit to remove leading zeros or any other way of work around .
    Regards

    Hi Amareswar,
    In your case, request your bank to provide cheque number with leading zeros in electronic bank statement as the leading zeros in the assignment field is SAP system behaviour.
    Alternatively, use 'Define Search String for Electronic Bank Statement' (refer http://help.sap.com/erp2005_ehp_05/helpdata/EN/6d/0cdf4b142e11d3963800a0c9426c73/frameset.htm for details) in the IMG, customize it to search for the cheque number provided in the note to payee field > then append leading zeros.
    The first method is the solution we are using and it is the most cost effective.
    Hope the above helps.
    Kind regards,
    John Chin

  • Removing number appended at the end from a string field

    Hi,
    I have a string field which has numbers appended to its end. I need to remove the numbers and display only the string values.
    The string is not of fixed length, and the numeric values can be single digit or 2 digits and might be separate by a space but not always.
    Here is some sample data:
    SHOWCASE NOTT12
    SHOWCASE PETE12
    SHOWCASE BRIST7
    SHOWCASE READI1
    CINEDROME PAD1
    RITZ BELPER   1
    STEPH.JOSEPH S1
    I need to display this as below (without any numbers appended at the end)
    SHOWCASE NOTT
    SHOWCASE PETE
    SHOWCASE BRIST
    SHOWCASE READI
    CINEDROME PAD
    RITZ BELPER  
    STEPH.JOSEPH S
    Please let me know how this can be achieved.
    Thanks!

    Hi there,
    Just a quick option is to use the REPLACE function, i.e.
    REPLACE(REPLACE(REPLACE({contr_actv.dept_id},'1' ,''),'2', ''), '3', '');
    You just have to build it up a little more so it caters for numbers 0 - 9.  At the moment it only works for numbers 1 - 3.  Another way you could do this is write some code to loop through the length of the string looking at each individual character to test for a number.
    I don't have time today to write something like that but the above should work as long as you don't have numbers in the middle of names etc.
    Cheers,
    Chris

  • To remove leading zeroes and take directly from IDOC(Segment field) to file

    Hi SapAll.
    i have got a simple requirement in a idoc to file Interface.
    here in a sender Idoc there will be one segment with one field,the requirement is to remove leading zeroes and take directly the data from this field and map to one of the field in  reciever  file structure.
    i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
    it would be preferable if any body can give me the solution without user defined functions.
    regards.
    Varma.

    from your first post:
    i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
    use the same formatting that you used in 3.0 .... try with just a # in the FormatNum function.
    Regards,
    Abhishek.

  • Removing leading zeros for the quantity field

    Hi all,
    In my script form there is a quantity field, of 13 and 3 decimals , on the out put its taking that much space un neccesarily,and messing up.
    how to make this adjustable in the provided space.
    It always 3 digits and 2 decimal points in our case.
    Please help me out,
    Thanks,
    Praveen

    Hi,
    For removing leading zeros
    &V_VARIABLE(Z)&
    Thanks,
    Naren

  • 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

  • Function mudule to remove leading zeros of curreny and decimal type field

    Hi Expers,
    can any body suggest me the function mudule to remove leading zeros of curreny and decimal type  fields.
    plz do reply as early as possible.
    Thanks .....
    sunil.

    Hi,
    Use this FM CNIF_CONVERT_CURRENCY2EXT
    Import parameters               Value
    I_CURRENCY                      USD
    I_AMOUNT                        00000001233
    I_DECIMALS                      2
    Export parameters               Value
    E_AMOUNT                                           1.233,0000
    Regards
    Shiva

Maybe you are looking for

  • Save and Save as... query

    Hi, I'm using the following code to allow the user to save a string myString in file xml1.xml:     var fileRef:FileReference=new FileReference();     fileRef.save(myString, "xml1.xml"); However, this pops a save dialog box every time and becomes tedi

  • When watching youtube the video randomly jumps to the start of the video even if the cursor is not on the video.

    When watching youtube the video randomly jumps to the start of the video even if the cursor is not on the video. This happens randomly and does not seem to be a problem with the videos as they run fine. what is going on?

  • Two Admin Accounts - How to delete one?

    Hi All In fixing another problem I have ended up with two Admin accounts. One is my main admin account and the other a short term fix. Trouble is I can't delete the second admin account from any account. When I try to delete the second account the 'm

  • Screen resolution options in Mini

    I'm sorry to post a speculative question. I'm planning to get a Mac mini shortly. I have assumed that the Minis have very flexible display options and I will able to set a screen resolution that matches a monitor's aspect ratio of 16:10 without disto

  • Ouput type and the date

    Dear Experts       I hope you  all are doing well i encountered one issue with the invfoicig To print invoicing using VF31, the value for the field Date/time in output type must be ‘3’. Configured default value  for dispatch time to ‘3’  but the Outp