<?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/1393489#M190955</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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;&amp;lt;i&amp;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.&amp;lt;/i&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so try reducing the size of ur internal table to 70 or so...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gunjan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Gunjan Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jun 2006 12:38:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-26T12:38:35Z</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/1393486#M190952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a dynamic internal, populating the same in program itself and the trying to pass the same in the select clause&lt;/P&gt;&lt;P&gt;following 2 lines are populated in the internal table i_where. &lt;/P&gt;&lt;P&gt;DATA i_where TYPE STANDARD TABLE OF char100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these lines are populated in i_where.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   A~LIFNR IN &amp;lt;L_TABLE1&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   AND   A~LIFNR = vendor_tab-LIFNR.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*****************************************************&lt;/P&gt;&lt;P&gt;    SELECT a~lifnr FROM lfa1 as a&lt;/P&gt;&lt;P&gt;    inner join lfm1 as m&lt;/P&gt;&lt;P&gt;    on a&lt;SUB&gt;lifnr = m&lt;/SUB&gt;lifnr&lt;/P&gt;&lt;P&gt;    INTO TABLE i_vendor&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN vendor_tab&lt;/P&gt;&lt;P&gt;    WHERE (i_where).&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;but the query doesnt execute......&lt;/P&gt;&lt;P&gt;if I write the same query as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT a~lifnr FROM lfa1 as a&lt;/P&gt;&lt;P&gt;    inner join lfm1 as m&lt;/P&gt;&lt;P&gt;    on a&lt;SUB&gt;lifnr = m&lt;/SUB&gt;lifnr&lt;/P&gt;&lt;P&gt;    INTO TABLE i_vendor&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN vendor_tab&lt;/P&gt;&lt;P&gt;    WHERE  A~LIFNR IN &amp;lt;L_TABLE1&amp;gt;&lt;/P&gt;&lt;P&gt;    AND   A~LIFNR = vendor_tab-LIFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the desired result....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone guide me why is this happening?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Dnyanesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 12:33:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393486#M190952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T12:33:16Z</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/1393487#M190953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZDYNAMIC_WHERE                         .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TABLES: VBAK.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: CONDITION TYPE STRING.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;VBELN LIKE VBAK-VBELN,&lt;/P&gt;&lt;P&gt;POSNR LIKE VBAP-POSNR,&lt;/P&gt;&lt;P&gt;END OF ITAB.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CONCATENATE 'VBELN' 'IN' 'S_VBELN.'&lt;/P&gt;&lt;P&gt;INTO CONDITION SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;WHERE (CONDITION).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;WRITE 'hello'.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreenivasulu P&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 12:36:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393487#M190953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T12:36:21Z</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/1393488#M190954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Instead of declaring i_where type table declare it of type char or string and then use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 12:38:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393488#M190954</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2006-06-26T12:38:19Z</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/1393489#M190955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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;&amp;lt;i&amp;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.&amp;lt;/i&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so try reducing the size of ur internal table to 70 or so...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gunjan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Gunjan Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 12:38:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393489#M190955</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T12:38:35Z</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/1393490#M190956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See this exapmle:&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Creating a dynamic comparison from user input. In the case of incorrect syntax or incorrect semantics, exceptions are generated, which are handled using the common superclass. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: column(8) TYPE c, &lt;/P&gt;&lt;P&gt;            value(30) TYPE c. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA spfli_wa TYPE spfli. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA cond_syntax TYPE string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE column '= value' &lt;/P&gt;&lt;P&gt;            INTO cond_syntax SEPARATED BY space. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY. &lt;/P&gt;&lt;P&gt;    SELECT SINGLE * &lt;/P&gt;&lt;P&gt;           FROM spfli &lt;/P&gt;&lt;P&gt;           INTO spfli_wa &lt;/P&gt;&lt;P&gt;           WHERE (cond_syntax). &lt;/P&gt;&lt;P&gt;  CATCH cx_sy_dynamic_osql_error. &lt;/P&gt;&lt;P&gt;    MESSAGE `Wrong WHERE condition!` TYPE 'I'. &lt;/P&gt;&lt;P&gt;ENDTRY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the only mistake you have done is the declaration of the i_where as an internal table instead of a string.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 13:20:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393490#M190956</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T13:20:12Z</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/1393491#M190957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Cross check with ST05 ; u will come know how exactly the select query getting generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) put break point before select query and start debugging&lt;/P&gt;&lt;P&gt;2) open another session for transaction ST05&lt;/P&gt;&lt;P&gt;3) click activate trace&lt;/P&gt;&lt;P&gt;4) come back to the debugging screen press F5 to execute the select query.&lt;/P&gt;&lt;P&gt;5) go back to ST05 and click deactivate trace ; u will &lt;/P&gt;&lt;P&gt;   find select query ; which being executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark Helpfull Answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 13:33:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393491#M190957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T13:33:19Z</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/1393492#M190958</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 think you can &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; use variable like &amp;lt;L_TABLE1&amp;gt;&lt;/P&gt;&lt;P&gt;in where clause - only constants &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 13:37:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393492#M190958</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-06-26T13:37: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/1393493#M190959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We should use 'into corresponding fields of table'&lt;/P&gt;&lt;P&gt;in the select clause .......then it is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the suggestions.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 14:00:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393493#M190959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T14:00:03Z</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/1393494#M190960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we cannot use 'in' in dynamic where clause&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 15:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-dynamic-where-clause/m-p/1393494#M190960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T15:01:32Z</dc:date>
    </item>
  </channel>
</rss>

