<?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 Select Statements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915231#M57941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ugesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extract from ABAP help about SELECT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... FROM (dbtabname) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Selects the data from a database table or view. The name is specified at runtime as the contents of the field dbtabname. The database table must be recognized in the ABAP Dictionary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT (itab) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Works like SELECT s1 ... sn, if the internal table itab contains the list s1 ... sn as ABAP source code, and works like SELECT *, if itab is empty. The internal table itab may only contain one field, which must have type C and not be longer than 72 characters. You must specify itab in parentheses. Do not include spaces between the parentheses and the table name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maxim.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Apr 2005 02:49:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-04-29T02:49:54Z</dc:date>
    <item>
      <title>Dynamic Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915230#M57940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to have dynamic select statements such that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the Table name can be dynamically given and field names for selection criterion should be dynamically given in the select statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be more precise, I have set of tables for which I need to fetch data from the database using a single select statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any of you have a solution .please revert ASAP.&lt;/P&gt;&lt;P&gt;Many thanks &lt;/P&gt;&lt;P&gt;ugesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 02:07:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915230#M57940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T02:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915231#M57941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ugesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extract from ABAP help about SELECT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... FROM (dbtabname) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Selects the data from a database table or view. The name is specified at runtime as the contents of the field dbtabname. The database table must be recognized in the ABAP Dictionary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT (itab) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Works like SELECT s1 ... sn, if the internal table itab contains the list s1 ... sn as ABAP source code, and works like SELECT *, if itab is empty. The internal table itab may only contain one field, which must have type C and not be longer than 72 characters. You must specify itab in parentheses. Do not include spaces between the parentheses and the table name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maxim.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 02:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915231#M57941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T02:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915232#M57942</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;See this sample code this will satisfy ur requirement&lt;/P&gt;&lt;P&gt;For dynamic WHERE condition try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF lt_cond OCCURS 0 ,   &lt;/P&gt;&lt;P&gt;     cond_line(60) TYPE c ,     &lt;/P&gt;&lt;P&gt; END OF lt_cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH lt_cond .&lt;/P&gt;&lt;P&gt;CONCATENATE fieldname 'EQ' enteredvalue '.'       &lt;/P&gt;&lt;P&gt;     INTO lt_cond-cond_line       &lt;/P&gt;&lt;P&gt;     SEPARATED BY space .&lt;/P&gt;&lt;P&gt;APPEND lt_cond .&lt;/P&gt;&lt;P&gt;SELECT SINGLE key INTO varkey&lt;/P&gt;&lt;P&gt;        FROM (tablename)   &lt;/P&gt;&lt;P&gt;        WHERE lt_cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;OR&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how you need to modify your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF lt_cond OCCURS 0 ,  &lt;/P&gt;&lt;P&gt;      cond_line(60) TYPE c ,     &lt;/P&gt;&lt;P&gt; END OF lt_cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF glacct-low IS INITIAL.&lt;/P&gt;&lt;P&gt; searchedfld = 'GLACCT'.  &lt;/P&gt;&lt;P&gt;enteredvalue = glacct-low.&lt;/P&gt;&lt;P&gt;ELSEIF custno-low IS INITIAL. &lt;/P&gt;&lt;P&gt; searchedfld = 'CUSTNO'.  &lt;/P&gt;&lt;P&gt;enteredvalue = custno-low.&lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt; EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT catalogname fld INTO (tablename,fieldname)   &lt;/P&gt;&lt;P&gt;                    FROM zcatfld              &lt;/P&gt;&lt;P&gt;        WHERE searchedfld EQ searchfld.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;REFRESH lt_cond.&lt;/P&gt;&lt;P&gt;CLEAR lt_cond.&lt;/P&gt;&lt;P&gt;CONCATENATE fieldname    &lt;/P&gt;&lt;P&gt;        'EQ'    &lt;/P&gt;&lt;P&gt;  enteredvalue       &lt;/P&gt;&lt;P&gt;     '.'     &lt;/P&gt;&lt;P&gt; INTO lt_cond-cond_line SEPARATED BY space .&lt;/P&gt;&lt;P&gt;APPEND lt_cond .&lt;/P&gt;&lt;P&gt;CLEAR lt_cond.&lt;/P&gt;&lt;P&gt;SELECT key INTO varkey   &lt;/P&gt;&lt;P&gt;        FROM (tablename)   &lt;/P&gt;&lt;P&gt;      WHERE (lt_cond).&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure that the field name and the table name are in uppercase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try any one of these depending on ur requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Judith&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 04:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915232#M57942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T04:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915233#M57943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ugesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have u tried this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U have marked as problem solved??????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Judith.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 06:10:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-statements/m-p/915233#M57943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T06:10:41Z</dc:date>
    </item>
  </channel>
</rss>

