<?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 in where clause in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039576#M86063</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try looping the table by applying the condition, bcoz delete that too on NOT will definitely kill the time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab where string cp &amp;lt;string&amp;gt;&lt;/P&gt;&lt;P&gt;   append into anothere internal table.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Dec 2005 15:49:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-07T15:49:25Z</dc:date>
    <item>
      <title>string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039571#M86058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a little problem. I want to set a select statement like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; select ID string into table tab_string from DBtable
  where ID in range_searchID
    and string like searchstring.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is not allowed, because in the DBtable the length of the string is to long for a where clause .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I found a solution for myself.&lt;/P&gt;&lt;P&gt;First I read all entries of the DBtable into an itab and than I delete the entries I don't want to have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; delete itab where not ( string cp searchstring and
                         ID in range_searchID ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this takes a lot of time and I am using it in a BSP-application, so I have a timelimit before timeout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have an idea of a faster selection, please tell me ;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mfg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:06:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039571#M86058</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-07T15:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039572#M86059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan, you could define itab as a sorted table by ID and perform first only the deletion using the ID restriction clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type sorted table of itab_type with non-unique key ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete itab where not ID in range_searchID.&lt;/P&gt;&lt;P&gt;delete itab where not string cp searchstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the first delete sentence will use then a binary search and will hopefully be much faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd possible solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make the select statement to limit the records only by ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ID string into table tab_string from DBtable&lt;/P&gt;&lt;P&gt;  where ID in range_searchID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and then delete from itab using the string criteria.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete itab where not string cp searchstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you could request an index to be created on the DBtable by id which would make the select statement a lot faster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:20:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039572#M86059</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-07T15:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039573#M86060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use a range:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ranges: r_string for kna1-name1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r_string-low = '&lt;STRONG&gt;Alexandre&lt;/STRONG&gt;' .&lt;/P&gt;&lt;P&gt;r_string-option = 'CP' .&lt;/P&gt;&lt;P&gt;r_string-sign = 'I'.&lt;/P&gt;&lt;P&gt;append r_string.&lt;/P&gt;&lt;P&gt;select * from kna1 where name1 in r_string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regargds&lt;/P&gt;&lt;P&gt;Alexandre Nogueira.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:22:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039573#M86060</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-07T15:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039574#M86061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you have to look the type table: hashed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;good luck&lt;/P&gt;&lt;P&gt;Frédéric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:25:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039574#M86061</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2005-12-07T15:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039575#M86062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming ID is the primary key and is sufficiently selective, you could combine the two methods:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 select ID string into table tab_string from DBtable
  where ID in range_searchID.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 delete itab where not ( string cp searchstring ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:41:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039575#M86062</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-07T15:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039576#M86063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try looping the table by applying the condition, bcoz delete that too on NOT will definitely kill the time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab where string cp &amp;lt;string&amp;gt;&lt;/P&gt;&lt;P&gt;   append into anothere internal table.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2005 15:49:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039576#M86063</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-07T15:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: string in where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039577#M86064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Sergio&lt;/P&gt;&lt;P&gt;the first: isn't really faster if the range is empty, that'S my main problem&lt;/P&gt;&lt;P&gt;the second: I already tried, but if there are more than 4000 to 5000 entries in the range&lt;/P&gt;&lt;P&gt;	    the select statement just does nothing....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Alexandre&lt;/P&gt;&lt;P&gt;sorry but my problem is not the searchstring, it's the string inside my DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Frédéric&lt;/P&gt;&lt;P&gt;I will try that, and tell you later if it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Rob&lt;/P&gt;&lt;P&gt;its the same problem like in Sergios second advice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Suman&lt;/P&gt;&lt;P&gt;that's what I thought about when I went home. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOT statements cost a lot of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I just wrote it before I read this, but your answer was very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/edit: I just took the time and both delete with NOT cp and loop where cp need the same time...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@all&lt;/P&gt;&lt;P&gt;thanks for your help so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Stefan Huemer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2005 08:33:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-in-where-clause/m-p/1039577#M86064</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-08T08:33:19Z</dc:date>
    </item>
  </channel>
</rss>

