How to find string with trailing space

Hi,
I need to search a word instead of string from another string.
I tried below code and expected that FIND will not search 'weeds' but it seems FIND ignores trailing spaces of string zstr and thus finds word 'weeds'.
DATA: zstr type string value 'we ',
          lv_string type string value 'These are weeds',
          result_tab TYPE match_result_tab.
FIND FIRST OCCURRENCE OF regex zstr IN lv_string
                      IGNORING CASE
                      RESULTS result_tab.
Please consider that zstr is runtime variable with no fixed length.
If anybody has the solution, reply back fast !
Regards,
Sourabh

Hi,
Hi,
  DATA STRING(30) VALUE 'This is a little sentence.'.
WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
ULINE /1(26).
SEARCH STRING FOR 'X'.
WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC',
               SY-FDPOS UNDER 'SY-FDPOS'
SEARCH STRING FOR 'itt '.
WRITE: / 'itt   ', SY-SUBRC UNDER 'SY-SUBRC',
                   SY-FDPOS UNDER 'SY-FDPOS'
SEARCH STRING FOR '.e .'.
WRITE: / '.e .', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
SEARCH STRING FOR '*e'.
WRITE: / '*e ', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
SEARCH STRING FOR 's*'.
WRITE: / 's* ', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
Hope it will solve your problem..
Pls. reward if useful...

Similar Messages

  • String with Trailing Space in a 4.7 / Basis 620 system

    Hi
    My customer is using SAP 4.7(Enterprise Management Version) / SAP BASIS Release 6.20 (Kernel 640).
    We have a requirement to print a product label using a 2D Datamatrix barcode following HIBC standards.  We are using a custom development object (Z function module) that builds the barcode string (variable length string) using a Mod43 calculated check digit as the last character of the string.  One of the valid check digits is a "space" character as the last character of this barcode string.
    Everything in our solution is working fine, except for the situation of the "space" check digit character at the end.  We are running into an ABAP syntax limitation when we are trying to concatenate the calculated check digit onto the barcode string.
    For example, we have a barcode value "+M53210250 " (within the quotes).  This string ends with a SPACE character at the end.  We are calculating the barcode value (some fixed elements + SAP material number, batch, etc.), then calculating the check digit, and concatenating the check digit onto the end of the initial barcode string value.
    I have tried this in a higher version system and am able to make it work by using the statement CONCATENATE RESPECTING BLANKS.  This syntax is not available with WebAS 620 however.
    Here are the attempts we have made:
    *Get HIBC 2D Barcode String
      CONCATENATE E_HIBC_2D_BC L_CHECK_DIGIT INTO E_HIBC_2D_BC.
    IF L_CHECK_DIGIT = SPACE.
    The following attempts does not work
    CONCATENATE with SPACE at end
    Concatenate HIBC SPACE and a dummy variable like 'TEST' into HIBC builds a space in between the dummy and HIBC
    and then when i split it the space is lost again.
    Insert SPACE in the beginning bulding a new variable with 0(1) space followed by HIBC and then SHIFT CIRCULAR BY 1 place
    It will work only if moved to a variable of length which is exactly HIBC + 1 char in length then by default the last char is SPACE.
    Use a replacement variable which is not a HIBC Check Digit like # & ! ? ^ or other for SPACE
    ECC 5.0 and HIGHER
    *CONCATENATE {dobj1 dobj2 ...}|{LINES OF itab}
               INTO result
               [IN {BYTE|CHARACTER} MODE]
               [SEPARATED BY sep]
               [RESPECTING BLANKS].
    *4.7 Version *
    *CONCATENATE f1 ... fn INTO g.
    *1. ... SEPARATED BY h
    *2. ... IN BYTE MODE
    *3. ... IN CHARACTER MODE
    Having the customer upgrade to ECC 5.0 is not feasible to solve this.
    If anyone has any alternative ideas on how to manage this variable length string and respect the trailing space, I would appreciate it.
    I have searched the forums but the only solutions that are close deal with outputting to a file during a download or FTP, or else mention the newer syntax of CONCATENTATE with the option RESPECTING BLANKS, but that is not available in this release.

    If you could predict how long the string is (assuming you might determine whether the last element length is shorter than the db length), you could try to insert your check digit based upon fieldname+your_calculated_length(1) = checkdigit.
    for example if batch is 3 cahr and you have '50' in the data, you could calculate as lv_len = strlen( the value ) .
    lv_len = lv_len + 1.
    move checkdigit to barcodefield+lv_len(1).
    Perhaps something like this would allow you to work around.  At any rate, if you can figure out if there's supposed to be one or ?? blanks on the end, specifying the position by +offset(columns) should do the trick, instead of the concatenate.

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • HOW to find out the tablespace space utilized by a patch after applying the

    someone has already applied the patch in test env before recording the tablespace size , so I cannot find out the figure in test env.
    So is there any general practice or general guidelines on it?
    hOW to find out the tablespace space utilized by a patch after applying the patch?
    Thanks & Regards,
    Sree.
    Edited by: 846579 on Mar 22, 2011 10:50 PM

    I think there is no direct way to determine what tablespace is utilized by a patch from the README file. You could check the content of the patch file and see what modules are affected (assuming there are changes and the database level), then query DBA_USERS (DEFAULT_TABLESPACE column) for those schemas which are updated by a patch. Or, you could check the size of the tablespaces before and after applying the patch and you will determine what tablespaces have been utilized (provided that the application services are down, and none of the application users is connected to the application).
    Thanks,
    Hussein

  • How to display string with XML content in 4.6?

    Hi,
    I`d like to know how to display string with XML content in it for 4.6.
    4.6 has not method parse_string.
    And example like this is not helpful:
      DATA: lo_mxml    TYPE REF TO cl_xml_document.
      CREATE OBJECT lo_mxml.
      CALL METHOD lo_mxml->parse_string
        EXPORTING
          stream = gv_xml_string.
      CALL METHOD lo_mxml->display.
    Thank you.

    Hi,
    May be you can use fm SAP_CONVERT_TO_XML_FORMAT. But it have some issues with memory usage, the program consumed tons of memory during convert.

  • How to find inbound with repect to goods receipt?

    Dear Gurus,
    how to find inbound with repect to goods receipt?
    Any report?
    Thanks,

    Once you do goods receipt inbound delivery no gets updated in Material document delivery note field.Use Table MKPF to get inbound delivery umber against material document
    Material document field :MKPF -MBLNR
    Inbound delivery Ref :MKPF-XBLNR

  • How to concatenate string with a numeric control ?

    Hi,
    How to concatenate string with a numeric control ?
    Thankyou.
    Solved!
    Go to Solution.

    Its simpler to just use the Format Into String.
    Attachments:
    Format Into String.png ‏11 KB

  • How to write strings with an underline on the TOP-OF-PAGE of ALV

    How to write strings with an underline on the TOP-OF-PAGE of ALV

    if u r using classes and methods it can be done
    but if u r using normal fms and then u have to use HTML_TOP_OF_PAGE but the drawback for this it cannot be printed when the report is printed .

  • How to find sunstring with regular expression?

    How can I find a substring in a string with a regular expression?
    Example:
    I have a original string "<tr><th>RecordId: </th><td valign=middle>A4711</td></tr>"
    Now i want to extract the value "A4711" from this string with a regular expression. Everything except "A4711" is fixed, the id "A4711" itself is dynamic. How is it possible to get the substring "A4711" of the original string with a regular expression?

    i wrote a little method with the infos above to get such results:
         * Get all substrings of a string that matches a regular expression.
         * @param original String to inspect.
         * @param regExp Regular expression as search criteria.
         * @return All matches of <i>regExp</i> or null if one input parameter is null.
        public static String[] getSubstrings(String original, String regExp) {
            String[] result = null;
            if (original != null && regExp != null) {
                Pattern pattern = Pattern.compile(regExp);
                Matcher matcher = pattern.matcher(original);
                boolean matchFound = matcher.find();
                Vector matches = new Vector();
                while (matchFound) {
                    String match = matcher.group();        
                    matches.addElement(match);
                    matchFound = matcher.find();
                }//next match
                int count = matches.size();
                result = new String[count];
                for (int i = 0; i < count; i++) {
                    result[i] = (String) matches.elementAt(i);
                }//next match
            }//else: input unavailable
            return result;
        }//getSubstrings()

  • How to find Heap and stack space

    How to find the heap sapce and stack space allocated at the moment.
    My requirement, I need to test our application by changing both of these, and atfter finish testing and have to set them to old values.

    You may consider reading up on how the Java stores data. There is no malloc() in java. I don't believe there is anyway within java that you can check the heap and stack size. And you can't allocate memory directly in java anyway so you wouldn't be able to change the value if you did get it. I would suggest using C or C++ to do this. Of course you can use JNI to call a C/C++ method from your java class but you will still have to first write the method in C/C++ which will make it platform specific anyway, so again I would suggest writeing this in another language which provides methods with direct access to the stack.

  • How to put String with html tags as it is into xml

    I am using apache dom API to create xml from java.
    I have a string with html tags in it .when I add the string to xml, its replacing all the "<"; with &lt and ">" with > I would like the html tags to look as it is instead of the > and & lt;. How can I acheive that
    this is the code snippet of what I am doing
    In java class
    String titleString = "<font color=red>This Is an Example of a Red Subject</font>"
    Document doc = new DocumentImpl();
    Element root = doc.createElement("bulletin");
    Element item = doc.createElement("title");
    item.appendChild(doc.createTextNode(titleString));
    In Xml it looks like below
    <title><font color=red>This Is an Example of a Red Subject</font></title>
    but I would like to have the xml like below
    <title><font color="red">This Is an Example of a Red Subject</font></title>
    Can you please suggest me whats the best way to acheive this.
    I appreciate all your help
    Thank you
    Suma

    One problem is that you don't understand escaping. If you re-read what you posted you'll see that what you say you get, and what you say you want, are identical. That's because you didn't escape one of the two properly. So your first step should be to find the section about escaping in Chapter 1 of your XML book and read it carefully. Figure out what you should have done here (yes, the same rules apply).
    However, to attempt to answer what I think your question is: if you have a String which contains markup, and you want to convert that String to XML elements, then you have to feed the String into an XML parser.

  • How to find table with colum that not support by data pump network_link

    Hi Experts,
    We try to import a database to new DB by data pump network_link.
    as oracle statement, Tables with columns that are object types are not supported in a network export. An ORA-22804 error will be generated and the export will move on to the next table. To work around this restriction, you can manually create the dependent object types within the database from which the export is being run.
    My question, how to find these tables with colum that that are object types are not supported in a network export.
    We have LOB object and oracle spital SDO_GEOMETRY object type. our database size is about 300G. nornally exp will takes 30 hours.
    We try to use data pump with network_link to speed export process.
    How do we fix oracle spital users type SDO_GEOMETRY issue during data pump?
    our system is 32 bit window 2003 and 10GR2 database.
    Thanks
    Jim
    Edited by: user589812 on Nov 3, 2009 12:59 PM

    Hi,
    I remember there being issues with sdo_geometry and DataPump. You may want to contact oracle support with this issue.
    Dean

  • How to find out the used space and free space in the DB for attachments

    Hi,
    In CRM 5.2 web UI, we can save a transaction by saving attachments like work documents or text files.
    Could someone help me find out the used space, free space, maximum capacity on the CRM DB for these attachments.
    Thanks & Best Regards,
    Ramesh.

    Hi,
    check with  below table
    TNAPR   ---  Processing programs for output
    and NACE Transaction code
    NACE  --  out types
    Regards,
    Madhu

  • How to Search strings with and without quotes

    Hello,
    I need to search a string with quote and without quote the same way
    Ex: Wendy's
    If user enters wendys without ' also need to return all the Wendy's..!
    I appreciate any help...!
    Thanks
    RG

    Hi,
    RG wrote:
    Hello,
    I need to search a string with quote and without quote the same way
    Ex: Wendy's
    If user enters wendys without ' also need to return all the Wendy's..!
    I appreciate any help...!So you want to ignore single-quotes, is that it?
    Here's one way:
    INSTR ( REPLACE (big_string,       '''')
          , REPLACE (substring_sought, '''')
          )  > 0 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • How can i write with double spaces between words ?

    hello everyone,
    i need to write in pages with double spaces between words not between lines ..
    how can i do it and make it default ?
    for now, just write and click space bar twice ..!!!

    Do you really need to do this? It is so ugly and illegible.
    You can use a monospace font or use the auto-complete in Menu > Pages > Preferences to auto-substitute 2 spaces for each one.
    Peter

Maybe you are looking for