<?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: Problem in Dynamic where clause in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157159#M750978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The syntax of the select statement is false.&lt;/P&gt;&lt;P&gt;if u already have spras in Itab then you need to write inside the loop .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM mara&lt;/P&gt;&lt;P&gt;INTO ktab&lt;/P&gt;&lt;P&gt;WHERE matnr = wa_itab -matnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Dec 2007 11:43:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-27T11:43:48Z</dc:date>
    <item>
      <title>Problem in Dynamic where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157156#M750975</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 am having an issue with using dynamic where clause in a select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query that i want to emulate is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM (p_table)&lt;/P&gt;&lt;P&gt;    INTO TABLE &amp;lt;dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;    WHERE spras IN s_field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(s_field1 is a select-option)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a query like&lt;/P&gt;&lt;P&gt; SELECT * FROM (p_table)&lt;/P&gt;&lt;P&gt;    INTO TABLE &amp;lt;dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;    WHERE (ITAB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB is an internal table with the text 'spras IN s_field1' already present.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i run the report, the query with the dynamic where clause gives a dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if i modify the contents of ITAB to have the text 'spras = 'EN'', the query executes successfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please let me know how to write a dynamic where clause for select-options??? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Raghav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2007 11:25:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157156#M750975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-27T11:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Dynamic where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157157#M750976</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;To specify a condition dynamically, use: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... WHERE (&amp;lt;itab&amp;gt;) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where &amp;lt;itab&amp;gt; is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of &amp;lt;itab&amp;gt;. However, you may only use literals, and not the names of data objects. The internal table can also be left empty. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you only want to specify a part of the condition dynamically, use: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... WHERE &amp;lt;cond&amp;gt; AND (&amp;lt;itab&amp;gt;) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot link a static and a dynamic condition using OR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may only use dynamic conditions in the WHERE clause of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2007 11:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157157#M750976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-27T11:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Dynamic where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157158#M750977</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;Check the following example:&lt;/P&gt;&lt;P&gt;DATA: COND(72) TYPE C,&lt;/P&gt;&lt;P&gt;ITAB LIKE TABLE OF COND.&lt;/P&gt;&lt;P&gt;PARAMETERS: CITY1(10) TYPE C, CITY2(10) TYPE C.&lt;/P&gt;&lt;P&gt;DATA WA TYPE SPFLI-CITYFROM.&lt;/P&gt;&lt;P&gt;CONCATENATE 'CITYFROM = ''' CITY1 '''' INTO COND.&lt;/P&gt;&lt;P&gt;APPEND COND TO ITAB.&lt;/P&gt;&lt;P&gt;CONCATENATE 'OR CITYFROM = ''' CITY2 '''' INTO COND.&lt;/P&gt;&lt;P&gt;APPEND COND TO ITAB.&lt;/P&gt;&lt;P&gt;CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO COND.&lt;/P&gt;&lt;P&gt;APPEND COND TO ITAB.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO COND.&lt;/P&gt;&lt;P&gt;WRITE COND.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;SELECT CITYFROM&lt;/P&gt;&lt;P&gt;INTO WA&lt;/P&gt;&lt;P&gt;FROM SPFLI&lt;/P&gt;&lt;P&gt;WHERE (ITAB).&lt;/P&gt;&lt;P&gt;WRITE / WA.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2007 11:36:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157158#M750977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-27T11:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Dynamic where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157159#M750978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The syntax of the select statement is false.&lt;/P&gt;&lt;P&gt;if u already have spras in Itab then you need to write inside the loop .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM mara&lt;/P&gt;&lt;P&gt;INTO ktab&lt;/P&gt;&lt;P&gt;WHERE matnr = wa_itab -matnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2007 11:43:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/3157159#M750978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-27T11:43:48Z</dc:date>
    </item>
  </channel>
</rss>

