<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: String manipulation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016188#M1497401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you have a misunderstanding of the sap patterns...ABC* means a string starts with ABC. &lt;STRONG&gt;FA&lt;/STRONG&gt; means FA is somehwere in the string. *ED means the string ends in ED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: t1 type table of string with header line.&lt;/P&gt;&lt;P&gt;data: t2 type table of string with header line.&lt;/P&gt;&lt;P&gt;data e1 type string. data e2 type string.                                                                                &lt;/P&gt;&lt;P&gt;e1 = 'ABCDE'. append e1 to t1.              &lt;/P&gt;&lt;P&gt;e2 = 'ABC*'. append e2 to t2.               &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;                                            &lt;/P&gt;&lt;P&gt;e1 = 'GFABCDE'. append e1 to t1.            &lt;/P&gt;&lt;P&gt;e2 = '&lt;STRONG&gt;FA&lt;/STRONG&gt;'. append e2 to t2.               &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;                                            &lt;/P&gt;&lt;P&gt;e1 = 'FGDEAED'. append e1 to t1.            &lt;/P&gt;&lt;P&gt;e2 = '*ED'. append e2 to t2.                &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;skip 1.                                     &lt;/P&gt;&lt;P&gt;write:/ 'T1-before-deletes:'.               &lt;/P&gt;&lt;P&gt;loop at t1. write:/  t1. endloop.           &lt;/P&gt;&lt;P&gt;loop at t2.                                 &lt;/P&gt;&lt;P&gt;skip 1.                                     &lt;/P&gt;&lt;P&gt;delete t1 where table_line cp t2.           &lt;/P&gt;&lt;P&gt;write:/ 'after-try-to-delete',t2.           &lt;/P&gt;&lt;P&gt;loop at t1. write:/  t1. endloop.           &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jun 2010 04:52:19 GMT</pubDate>
    <dc:creator>former_member186741</dc:creator>
    <dc:date>2010-06-24T04:52:19Z</dc:date>
    <item>
      <title>String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016179#M1497392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello expert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table contains strings. I have to delete the entry that contains some pattern. For example: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
   *ABC       delete the entry that starts with ABC
   *ABC*      delete the entry that contains ABC
    ABC*      delete the entry that ends with ABC
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can someone tell me how I can manipulate the string. Are there any methods or functions to find the pattern in a String?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 17:10:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016179#M1497392</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T17:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016180#M1497393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This looks pretty basic to me. Have you pressed F1 on DELETE??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 17:16:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016180#M1497393</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T17:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016181#M1497394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can write like &lt;/P&gt;&lt;P&gt;delete str WHERE name CP 'ABC*'.&lt;/P&gt;&lt;P&gt;delete str WHERE name CP '&lt;STRONG&gt;ABC&lt;/STRONG&gt;'.&lt;/P&gt;&lt;P&gt;delete str WHERE name CP '*ABC'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bala Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bala Duvvuri on Jun 22, 2010 11:29 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bala Duvvuri on Jun 22, 2010 11:30 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 17:28:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016181#M1497394</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T17:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016182#M1497395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess I didn't explain well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume I have two internal tables as follow: The value in Table 1 is unknown (dynamic)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;Table 1:                 Table 2:&lt;/P&gt;&lt;P&gt;&amp;gt;ABCDE                      *ABC                 delete the entry if the string in Table 1 starts with ABC&lt;/P&gt;&lt;P&gt;&amp;gt;GFABCDE                    &lt;STRONG&gt;FA&lt;/STRONG&gt;                  delete the entry if the string in Table 1 contains FA&lt;/P&gt;&lt;P&gt;&amp;gt;FGDEAED                    ED*                    delete the entry if the string in Table 1 ends with ED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to find if the string in Table 1 contains * first, I then have to hold pattern such as ABC, FA, and or ED from Table 2, &lt;/P&gt;&lt;P&gt;Finaly I have to find if the pattern is in the beginning of the string, middle of the string, or end of the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do not use code tags to format text.&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jun 22, 2010 2:35 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 18:33:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016182#M1497395</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T18:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016183#M1497396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you use table 2 to create a range table of the patterns you want to delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 18:39:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016183#M1497396</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T18:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016184#M1497397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. it is easier to use a range table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found a class CL_ABAP_MATCHER that contains lots of methods. I wonder if anyone used them before.&lt;/P&gt;&lt;P&gt;Can someone give me some suggestion. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 20:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016184#M1497397</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T20:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016185#M1497398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can also use CS in if condition and check...CS means COntains String...&lt;/P&gt;&lt;P&gt;try with CS...&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt;if wa_int CS 'ABC'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: poo_m_s on Jun 23, 2010 6:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 16:18:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016185#M1497398</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-23T16:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016186#M1497399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: begin of itab OCCURS 0,
        s1 type string,
      END OF itab.

itab-s1 = 'asdjyaskdasdhjakjABC'.
APPEND itab.
itab-s1 = 'asdjyaskdasdhjakjABCasd'.
APPEND itab.
itab-s1 = 'ABCdfghjkdskfsdf'.
APPEND itab.


DELETE itab WHERE s1 NP 'ABC*'. " deletes entry other than starting with ABC
"DELETE itab WHERE s1 NP '*ABC'. ===&amp;gt;deletes entry other than ending with ABC
"DELETE itab WHERE s1 NP '+*ABC*+'. " deletes entry with ABC in middle


LOOP AT itab .
  WRITE :/ itab-s1.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;try this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 18:03:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016186#M1497399</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-23T18:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016187#M1497400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;anna.. do this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : s1 type range of itab1-field1,
       s2 like line of s1..

s2-sign = 'I'.
s2-option = CP.
loop at the table2 into is2.
 if is2-field1 CA '*'.
   s2-low = is2-field1.
 else.
  concatenate '*' is2-field1 '*' into s2-low.
 endif.
 append s2 to s1.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is jsut an example how to create the range table... but i dont think this will help you much.... you need line by line matching..&lt;/P&gt;&lt;P&gt;so.. do this for your purpose.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at tabl1 into is1.
 read table itab2 into is2 index sy-tabix.
 if sy-subrc = 0.
   if is2-f1 NA '*'. "means there are no *s so you have to provide the two *s
     concatenate '*' is2-f1 '*' into is2-f1.
   endif.
   if is1-f1 CP is2-f1.
     delete TAB1. "current line will be deleted.
   endif.
 endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will check line by line from itab1 with itab2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 18:18:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016187#M1497400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-23T18:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016188#M1497401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you have a misunderstanding of the sap patterns...ABC* means a string starts with ABC. &lt;STRONG&gt;FA&lt;/STRONG&gt; means FA is somehwere in the string. *ED means the string ends in ED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: t1 type table of string with header line.&lt;/P&gt;&lt;P&gt;data: t2 type table of string with header line.&lt;/P&gt;&lt;P&gt;data e1 type string. data e2 type string.                                                                                &lt;/P&gt;&lt;P&gt;e1 = 'ABCDE'. append e1 to t1.              &lt;/P&gt;&lt;P&gt;e2 = 'ABC*'. append e2 to t2.               &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;                                            &lt;/P&gt;&lt;P&gt;e1 = 'GFABCDE'. append e1 to t1.            &lt;/P&gt;&lt;P&gt;e2 = '&lt;STRONG&gt;FA&lt;/STRONG&gt;'. append e2 to t2.               &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;                                            &lt;/P&gt;&lt;P&gt;e1 = 'FGDEAED'. append e1 to t1.            &lt;/P&gt;&lt;P&gt;e2 = '*ED'. append e2 to t2.                &lt;/P&gt;&lt;P&gt;if e1 cp e2. write:/ e1,'cp',e2. endif.     &lt;/P&gt;&lt;P&gt;skip 1.                                     &lt;/P&gt;&lt;P&gt;write:/ 'T1-before-deletes:'.               &lt;/P&gt;&lt;P&gt;loop at t1. write:/  t1. endloop.           &lt;/P&gt;&lt;P&gt;loop at t2.                                 &lt;/P&gt;&lt;P&gt;skip 1.                                     &lt;/P&gt;&lt;P&gt;delete t1 where table_line cp t2.           &lt;/P&gt;&lt;P&gt;write:/ 'after-try-to-delete',t2.           &lt;/P&gt;&lt;P&gt;loop at t1. write:/  t1. endloop.           &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 04:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016188#M1497401</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2010-06-24T04:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016189#M1497402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Thanks for all your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finally created a dynamic range table to solve my problem and it works well. Here is the code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*  ALV - Field catalog data
 DATA: l_fc  TYPE lvc_s_fcat,
       ltab_fc TYPE lvc_t_fcat,
       r_fld_desc  TYPE REF TO cl_abap_elemdescr.
*       dy_range_table TYPE REF TO data.

*   Get the field description
    r_fld_desc ?= cl_abap_typedescr=&amp;gt;describe_by_data( field ).

*   Create a field catalogue of ALV for dynamic ranges table
    REFRESH ltab_fc.
    CLEAR l_fc.
    l_fc-fieldname = 'SIGN'.
    l_fc-datatype  = 'C'.
    l_fc-inttype   = 'C'.
    l_fc-intlen    = '1'.
    APPEND l_fc TO ltab_fc.

    CLEAR l_fc.
    l_fc-fieldname = 'OPTION'.
    l_fc-datatype  = 'C'.
    l_fc-inttype   = 'C'.
    l_fc-intlen    = '2'.
    APPEND l_fc TO ltab_fc.

    CLEAR l_fc.
    l_fc-fieldname = 'LOW'.
    l_fc-datatype  = r_fld_desc-&amp;gt;type_kind.
    l_fc-inttype   = r_fld_desc-&amp;gt;type_kind.
    l_fc-intlen    = r_fld_desc-&amp;gt;length.
    l_fc-decimals = r_fld_desc-&amp;gt;decimals.
    APPEND l_fc TO ltab_fc.

    CLEAR l_fc.
    l_fc-fieldname = 'HIGH'.
    l_fc-datatype  = r_fld_desc-&amp;gt;type_kind.
    l_fc-inttype   = r_fld_desc-&amp;gt;type_kind.
    l_fc-intlen    = r_fld_desc-&amp;gt;length.
    l_fc-decimals = r_fld_desc-&amp;gt;decimals.
    APPEND l_fc TO ltab_fc.

*   call static method to create the dynamic range table
    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
      EXPORTING
        it_fieldcatalog = ltab_fc
      IMPORTING
        ep_table        = dy_range_table.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Anna  Smith on Jun 29, 2010 9:48 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jun 2010 19:46:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/7016189#M1497402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-29T19:46:30Z</dc:date>
    </item>
  </channel>
</rss>

