<?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: SQL Question. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357373#M1399882</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using LIKE, why not just use a range table??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Dec 2009 22:34:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-10T22:34:07Z</dc:date>
    <item>
      <title>SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357369#M1399878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody, the idea of the following query is to get the customers that some of their fields match partially or totally with an input text pattern (w_text_pattern).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CONCATENATE '%' im_pattern '%' INTO w_text_pattern.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT * INTO TABLE customer_list&lt;/P&gt;&lt;P&gt;    FROM kna1&lt;/P&gt;&lt;P&gt;    WHERE kunnr LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          name1 LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          name2 LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          ort01 LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          pstlz LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          regio LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          stras LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          telf1 LIKE w_text_pattern OR&lt;/P&gt;&lt;P&gt;          telfx LIKE w_text_pattern.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query is working fine, but the LIKE word has a limitation where w_text_pattern can not have more than 6 characters. The question is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another way to do that avoiding the restrction of the LIKE word?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 13:50:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357369#M1399878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T13:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357370#M1399879</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 to create ranges:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
RANGES: lr_kunnr for kna1-kunnr,
        ls_kunnr LIKE LINE OF lr_kunnr.

CONCATENATE '%' im_pattern '%' INTO w_text_pattern.

ls_kunnr-sign = 'I'.
ls_kunnr-option = 'CP'.
ls_kunnr-low = w_text_pattern.
append ls_kunnr to lr_kunnr.

SELECT * INTO TABLE customer_list
FROM kna1
WHERE kunnr IN lr_kunnr and
  ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only problem is to create one range for each field...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Frisoni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 14:11:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357370#M1399879</guid>
      <dc:creator>guilherme_frisoni</dc:creator>
      <dc:date>2009-12-10T14:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357371#M1399880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fernando Franzolini,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no such limit of 6 Characters .. Please have a look on below example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try declaring w_text_pattern of more length and assign more then 6 characters in it and check out...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZILESH_TEST_LIKE.
PARAMETERS: P_NAME(40) TYPE C .

DATA L_SRCH_STR(60) TYPE C .
DATA L_ENAME LIKE P0001-ENAME .

CONCATENATE '%' P_NAME '%' INTO L_SRCH_STR .

SELECT ENAME FROM PA0001
       INTO L_ENAME
       WHERE ENAME LIKE L_SRCH_STR .

  WRITE:/ L_ENAME .

ENDSELECT .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope it will solve your problem..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;ilesh 24x7&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ilesh Nandaniya&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 14:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357371#M1399880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T14:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357372#M1399881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi thanks for your answer, but if I assign something with more than 6 characters the system shows me the following dump:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short text&lt;/P&gt;&lt;P&gt;    ABAP/4 Open SQL statement with WHERE ... LIKE and pattern too long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error analysis&lt;/P&gt;&lt;P&gt;    An exception occurred that is explained in detail below.&lt;/P&gt;&lt;P&gt;    The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was&lt;/P&gt;&lt;P&gt;     not caught in&lt;/P&gt;&lt;P&gt;    procedure "Y_FA_GET_CUSTOMER_LIST" "(FUNCTION)", nor was it propagated by a&lt;/P&gt;&lt;P&gt;     RAISING clause.&lt;/P&gt;&lt;P&gt;    Since the caller of the procedure could not have anticipated that the&lt;/P&gt;&lt;P&gt;    exception would occur, the current program is terminated.&lt;/P&gt;&lt;P&gt;    The reason for the exception is:&lt;/P&gt;&lt;P&gt;    The current ABAP program attempted to execute an Open SQL statement in&lt;/P&gt;&lt;P&gt;    which the WHERE condition contains a LIKE operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The pattern belonging to a LIKE operator should be (with the exception&lt;/P&gt;&lt;P&gt;    of closing blanks) no more than 6 characters long. This is a minimum&lt;/P&gt;&lt;P&gt;    of 256 and twice as long as the database field (3) to which the&lt;/P&gt;&lt;P&gt;    condition&lt;/P&gt;&lt;P&gt;    applies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    In this particular case, the pattern contains&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       "%ASDDDEEEER%"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    more than the maximum permitted 6 valid characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 20:48:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357372#M1399881</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T20:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357373#M1399882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using LIKE, why not just use a range table??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 22:34:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357373#M1399882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T22:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357374#M1399883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fernando,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you use the pattern to check against a couple of fields. If you check pattern %ASDDDEEEER% it will match all text fields containing string ASDDDEEEER. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, for me, it is given that the field that is checked ha a minimum length of 10 characters. I'm not on the system now, but regio field is probably shorter. Thats why it dumps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just think abaout what you are coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use ranges anyway, but then it is &lt;STRONG&gt;ASDDDEEEER&lt;/STRONG&gt; not %ASDDDEEEER% as some wannabe recommended.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 23:05:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357374#M1399883</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2009-12-10T23:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Question.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357375#M1399884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, your anwser was the solution, but I had to use '*' instead '%' in the concatenate statement. Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2009 15:03:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-question/m-p/6357375#M1399884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-11T15:03:08Z</dc:date>
    </item>
  </channel>
</rss>

