<?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 in Internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020198#M80976</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think the only solution for your problem is to &lt;/P&gt;&lt;P&gt;create dynamic program with  GENERATE SUBROUTINE ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; i've a programm where i create dynamic where-clauses &lt;/P&gt;&lt;P&gt;for a loop - conditions and statements to the loop can be  maintained by user in a customize-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;short extract:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  append 'loop at tab2 into wa2 ' to prog.
  loop at formel."customize-table
    concatenate 'wa1-' formel-feld1 into dbfeld.
    if sy-tabix = 1.
      concatenate 'where' formel-feld1 formel-operator dbfeld
       into prog-line separated by space.
    else.
      concatenate 'and' formel-feld1 formel-operator dbfeld
       into prog-line separated by space.
    endif.
    append prog.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jul 2005 06:54:29 GMT</pubDate>
    <dc:creator>andreas_mann3</dc:creator>
    <dc:date>2005-07-08T06:54:29Z</dc:date>
    <item>
      <title>Dynamic Where in Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020194#M80972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible for me to write a dynamic where for an internal table. For instance when I try the following it throws a compile-error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_string = 'first_name EQ ''SDN'''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT l_it_tyname ASSIGNING &amp;lt;fs_tyname&amp;gt; WHERE (l_string).&lt;/P&gt;&lt;P&gt;  WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; &amp;lt;fs_tyname&amp;gt;-first_name, '  ', &amp;lt;fs_tyname&amp;gt;-last_name.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this can be done, could you please post a sample one liner. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Sunil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jul 2005 18:37:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020194#M80972</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-05T18:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where in Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020195#M80973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,  I think the dynamic Where Condition is unavailable in the internal table loop.&lt;/P&gt;&lt;P&gt;If you really want to realize it, you can try &lt;/P&gt;&lt;P&gt;GENERATE SUBROUTINE POOL &amp;lt;itab&amp;gt; NAME &amp;lt;prog&amp;gt; [&amp;lt;options&amp;gt;].&lt;/P&gt;&lt;P&gt;or other dynamicly generate tech. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using it, you can generate code as you like, so I think this way should solve you problem, but the performance will drop very much. Are you sure you really want it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And another way to do like this:&lt;/P&gt;&lt;P&gt;DATA:  STR TYPE STRING.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;LOOP AT l_it_tyname ASSIGNING &amp;lt;fs_tyname&amp;gt;.&lt;/P&gt;&lt;P&gt;STR = 'first_name'.&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT STR OF STRUCTURE &amp;lt;fs_tyname&amp;gt; TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;IF &amp;lt;FS&amp;gt; = 'SDN'.&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; &amp;lt;fs_tyname&amp;gt;-first_name, ' ', &amp;lt;fs_tyname&amp;gt;-last_name.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2005 03:16:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020195#M80973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-06T03:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where in Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020196#M80974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A dynamic where caluse is available only for database access (Open SQL). In case of an internal table, you cannot specify a where clause dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however, in most cases, all requirements for dynamism in case of internal tables can usually be met by using Fields symbols. If you could explain your problem further, I'm sure someone on this forum will help you solve it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2005 03:54:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020196#M80974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-06T03:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where in Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020197#M80975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zhenglin, Anand&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your inputs but I will not be able to solve my problem with the suggestion given by Zhenglin.  My problem is I have the same set of logic, which basically involves looping through an internal table with a different where condition.  Instead of writing different methods for each one of them I was thinking of building a "str_where" string and sending it to the method as parameter.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have now created different methods for each of the condition, I guess sometimes its difficult to find a solution which is right fit for you, and thus forcing me to write in a raw way.  If there is another way to solve this problem, I would really appreciate your input. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Sunil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2005 17:06:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020197#M80975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-07T17:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where in Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020198#M80976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think the only solution for your problem is to &lt;/P&gt;&lt;P&gt;create dynamic program with  GENERATE SUBROUTINE ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; i've a programm where i create dynamic where-clauses &lt;/P&gt;&lt;P&gt;for a loop - conditions and statements to the loop can be  maintained by user in a customize-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;short extract:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  append 'loop at tab2 into wa2 ' to prog.
  loop at formel."customize-table
    concatenate 'wa1-' formel-feld1 into dbfeld.
    if sy-tabix = 1.
      concatenate 'where' formel-feld1 formel-operator dbfeld
       into prog-line separated by space.
    else.
      concatenate 'and' formel-feld1 formel-operator dbfeld
       into prog-line separated by space.
    endif.
    append prog.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2005 06:54:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-in-internal-table/m-p/1020198#M80976</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-07-08T06:54:29Z</dc:date>
    </item>
  </channel>
</rss>

