<?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: dynamic where clause in loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274157#M782740</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be aware that a LOOP AT ... WHERE is not an optimized access .&lt;/P&gt;&lt;P&gt;+ because on a standard table there is not sort order, &lt;/P&gt;&lt;P&gt;   so the loop goes over the whole table and does   &lt;/P&gt;&lt;P&gt;   something when the condition is fulfilled&lt;/P&gt;&lt;P&gt;+ it is optimzed for sorted tables, but only for one key!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; so your idea must have bad performance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not a problem, then you can solve the problem&lt;/P&gt;&lt;P&gt;in the following way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if ( dynamic condition )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But maybe is dynamic condition is not necessary, but&lt;/P&gt;&lt;P&gt;a some fixed if-conditions are also o.k.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jan 2008 12:09:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-08T12:09:17Z</dc:date>
    <item>
      <title>dynamic where clause in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274155#M782738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I know dynamic clause works for SELECT.....  &lt;/P&gt;&lt;P&gt;e.g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I built where_clause using concatenate...    based on when key fields are available.   So sometime where_clause  has: A = X-1 and B = X-2.    and another time where_clause can have A = X-1 and C = X-5 and D = X-6.....  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * from db into table int_tab where (where_clause) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I use the same way to build this dynamic where_clause, then used on the loop at statement : &lt;/P&gt;&lt;P&gt;LOOP AT int_tab into int_line&lt;/P&gt;&lt;P&gt;    where (where_clause) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got syntax error : Statement Concluding with ".... (where_clause)" ended unexpectedly.    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea to make where clause dynamicly for LOOP?&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, 08 Jan 2008 11:09:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274155#M782738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-08T11:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic where clause in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274156#M782739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi yi-wen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   this is not possible since the LOOP statement wants to know the static type of the fields used in   the WHERE clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2008 11:23:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274156#M782739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-08T11:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic where clause in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274157#M782740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be aware that a LOOP AT ... WHERE is not an optimized access .&lt;/P&gt;&lt;P&gt;+ because on a standard table there is not sort order, &lt;/P&gt;&lt;P&gt;   so the loop goes over the whole table and does   &lt;/P&gt;&lt;P&gt;   something when the condition is fulfilled&lt;/P&gt;&lt;P&gt;+ it is optimzed for sorted tables, but only for one key!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; so your idea must have bad performance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not a problem, then you can solve the problem&lt;/P&gt;&lt;P&gt;in the following way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if ( dynamic condition )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But maybe is dynamic condition is not necessary, but&lt;/P&gt;&lt;P&gt;a some fixed if-conditions are also o.k.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2008 12:09:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274157#M782740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-08T12:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic where clause in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274158#M782741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Siegfried, &lt;/P&gt;&lt;P&gt;Thanks for your response.  &lt;/P&gt;&lt;P&gt;I did try IF ( dynamic_condition).&lt;/P&gt;&lt;P&gt;               some logic...&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;but I got syntax error : Relational operator ")"  is not supported.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I spill wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;the dynamic_condition will contain A-A1 = B-A1 and A-A2 = B-A2, A-A4 = B-A4......  whatever the combination when A-Ax is available.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2008 15:26:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause-in-loop/m-p/3274158#M782741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-08T15:26:12Z</dc:date>
    </item>
  </channel>
</rss>

