<?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 table in select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000728#M1606648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure which version you have, if RTTS is available, you can use class CL_ABAP_TABLEDESCR to get all the fields of table then check if the field you need is there or not,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jun 2011 21:37:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-06-08T21:37:20Z</dc:date>
    <item>
      <title>Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000726#M1606646</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 have a requirement where i have a select option in which the input is table name , i need to use this input in my select statement and fetch entries in the table where bname is eq to ' ' or uname eq ' '. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the challenge that i am facing is not all the tables have both the fields (uname and Bname).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Request your help on how to code the above requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bhanu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 18:59:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000726#M1606646</guid>
      <dc:creator>former_member556412</dc:creator>
      <dc:date>2011-06-08T18:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000727#M1606647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the dynamic where condition for your requirement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 19:15:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000727#M1606647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-08T19:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000728#M1606648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure which version you have, if RTTS is available, you can use class CL_ABAP_TABLEDESCR to get all the fields of table then check if the field you need is there or not,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 21:37:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000728#M1606648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-08T21:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000729#M1606649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2011 06:51:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000729#M1606649</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-09T06:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000730#M1606650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;better you use field-symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first assign your table name to &amp;lt;FS&amp;gt; the use it in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;linkfarm removed by moderator&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sujeet Mishra&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kishan P on Jun 9, 2011 2:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2011 08:58:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000730#M1606650</guid>
      <dc:creator>SujeetMishra</dc:creator>
      <dc:date>2011-06-09T08:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000731#M1606651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bhanu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please use this sample code i made for your reference to solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

TABLES: dd02t.
SELECT-OPTIONS s_tabnme FOR dd02t-tabname NO INTERVALS OBLIGATORY.

SELECT field1 field3 field3
  INTO TABLE gt_master_data
  FROM s_tabnme-low
  WHERE tablefield = condition.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this could help. Cheers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Michaeldahm&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2011 09:36:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000731#M1606651</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-09T09:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000732#M1606652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bhanu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know what exactly is your requirement but I don't see any reason why a business user enters a table name as input in the selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

MANDT NAME                           TYPE NUMB SIGN OPTI   LOW    HIGH

223   ZPROGNAME                       P    0001     I        EQ    XXX      ZTABLENAME

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can maintain an entry like the above in TVARVC table and get the table name using a select query on TVARVC and then use the table as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT SINGLE * FROM (l_tabname)
           into g_wa_tab2
           WHERE quosrc   EQ g_wa_tab1-quosrc  AND
                 quotyp   EQ g_wa_tab1-quotyp  AND
                 quotno   EQ g_wa_tab1-quotno  AND
                 quotdate EQ g_wa_tab1-quotdate.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Funda is using TAVRVC to maintain the table names and determine the table based on a condition and the using the table in the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2011 09:48:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000732#M1606652</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2011-06-10T09:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000733#M1606653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bhanu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for not providing you code but you can try the logic given below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Pick all table fields of table given in select options from table DD03L.&lt;/P&gt;&lt;P&gt;2. Now check what fields you need to pick or which fields exist in selection condition (where) from the list you got from point 1.&lt;/P&gt;&lt;P&gt;3. Accordingly either write you query or create a dynamic where condition in an internal table using these fields.&lt;/P&gt;&lt;P&gt;4. Use field symbol to create your structure at run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Now write query something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM s_tab-low into &amp;lt;fs&amp;gt; where condition[] "here condition is your internal table with dynamic conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ravi Ahuja on Jun 11, 2011 12:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2011 07:08:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-select-statement/m-p/8000733#M1606653</guid>
      <dc:creator>raviahuja</dc:creator>
      <dc:date>2011-06-11T07:08:47Z</dc:date>
    </item>
  </channel>
</rss>

