<?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: Help with a string search in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004538#M709941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Naimesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have multiple phrases to search for, such as if the field contains "this phrase" then do this, if the field contains "this other phrase" then do this, if the field contains "this guy" then do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would the statement look like?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you use CASE?  Would you just use SEARCH....IF....ENDIF...repeat???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Nov 2007 15:29:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-13T15:29:22Z</dc:date>
    <item>
      <title>Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004535#M709938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I need syntax when I am merging tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to search a particular field and do some logic against it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, field A1 could say "i have no idea how to code this problem" and I would have to search for a BEGINNING phrase "i have no idea..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If found, A1  = B1 (a different field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone post syntax on how to search for a phrase within a field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you use the search?&lt;/P&gt;&lt;P&gt;If so, then what would the if statement look like?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 22:45:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004535#M709938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-09T22:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004536#M709939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can search it with SEARCH command,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST_NP.

data: l_text type string,
      l_find type string.


l_text = 'i have no idea how to code this problem'.
l_find = 'i have no idea'.

search l_text for l_find.
if sy-subrc = 0.
 write: 'found'.
** do your processing.

endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 22:51:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004536#M709939</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-09T22:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004537#M709940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You have to use the String commands like&lt;/P&gt;&lt;P&gt;CP (Contains pattern)&lt;/P&gt;&lt;P&gt;CS(contains string) etc for this purpose&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : str (30) type c,&lt;/P&gt;&lt;P&gt;          str1(15) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;str =  'i have no idea how to code this problem'.&lt;/P&gt;&lt;P&gt;str1 = 'i have no idea'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str CP str1.&lt;/P&gt;&lt;P&gt;....do something...&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str CS str1.&lt;/P&gt;&lt;P&gt;....do something...&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 23:44:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004537#M709940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-09T23:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004538#M709941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Naimesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have multiple phrases to search for, such as if the field contains "this phrase" then do this, if the field contains "this other phrase" then do this, if the field contains "this guy" then do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would the statement look like?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you use CASE?  Would you just use SEARCH....IF....ENDIF...repeat???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2007 15:29:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004538#M709941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-13T15:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004539#M709942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I would suggest to make in loop rather doing hardcode:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST_NP.

DATA: L_TEXT TYPE STRING.

DATA: BEGIN OF IT_FIND OCCURS 0,
      FIND TYPE STRING,
      END   OF IT_FIND.

L_TEXT = 'i have no idea how to code this problem'.
IT_FIND-FIND = 'problem'.
APPEND IT_FIND.

IT_FIND-FIND = 'i have no idea'.
APPEND IT_FIND.

LOOP AT IT_FIND.
  SEARCH L_TEXT FOR IT_FIND-FIND.
  IF SY-SUBRC = 0.
    WRITE: / IT_FIND-FIND,'was found'.
** do your processing.

  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2007 15:36:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004539#M709942</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-13T15:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004540#M709943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Points to Naimesh.  Thanks man.  Too bad we dont work together- it would be sweet learning what you know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2007 17:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004540#M709943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-13T17:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a string search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004541#M709944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't worry.. Someday we will ... &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2007 17:17:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-a-string-search/m-p/3004541#M709944</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-13T17:17:10Z</dc:date>
    </item>
  </channel>
</rss>

