<?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: select from variable table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941287#M63233</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your code.  Are you looking for a dynamic where clause?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a short sample of a dynamic select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter your table name in the parameter on selection screen.  Enter you where clause in the select-option on selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MARA&lt;/P&gt;&lt;P&gt;MTART = 'HALB'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0004 .

data: xwhere(30) type c.
data: iwhere(30) type c occurs 0.

data:itab(1000) type c occurs 0 with header line.

parameters: p_table(30) type c.
select-options: s_where for xwhere.

loop at s_where.
  clear iwhere.
  xwhere = s_where-low.
  append xwhere to iwhere.
endloop.

select * up to 100 rows into table itab
          from (p_table)
                where (iwhere).

loop at itab.

  write:/ itab.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jun 2005 15:35:36 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-06-24T15:35:36Z</dc:date>
    <item>
      <title>select from variable table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941286#M63232</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 would like to request your help.&lt;/P&gt;&lt;P&gt;  I want to select some data from one table .but the table is dynamic.&lt;/P&gt;&lt;P&gt;  It is continuously changing.So what i thought is accept the tablename as &lt;/P&gt;&lt;P&gt;  parameter and then do the select from the parameter but the select &lt;/P&gt;&lt;P&gt;  statement is not working .&lt;/P&gt;&lt;P&gt;  Please advise whether i can select from parameter any data or is there &lt;/P&gt;&lt;P&gt;  any other way to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;aasr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2005 15:21:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941286#M63232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-24T15:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: select from variable table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941287#M63233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your code.  Are you looking for a dynamic where clause?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a short sample of a dynamic select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter your table name in the parameter on selection screen.  Enter you where clause in the select-option on selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MARA&lt;/P&gt;&lt;P&gt;MTART = 'HALB'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0004 .

data: xwhere(30) type c.
data: iwhere(30) type c occurs 0.

data:itab(1000) type c occurs 0 with header line.

parameters: p_table(30) type c.
select-options: s_where for xwhere.

loop at s_where.
  clear iwhere.
  xwhere = s_where-low.
  append xwhere to iwhere.
endloop.

select * up to 100 rows into table itab
          from (p_table)
                where (iwhere).

loop at itab.

  write:/ itab.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2005 15:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941287#M63233</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-06-24T15:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: select from variable table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941288#M63234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Rich,&lt;/P&gt;&lt;P&gt;  Your solution is excellent.&lt;/P&gt;&lt;P&gt;  I fixed my problem .&lt;/P&gt;&lt;P&gt;  Your knowledge is amazing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton.&lt;/P&gt;&lt;P&gt;aasr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2005 16:30:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-variable-table/m-p/941288#M63234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-24T16:30:56Z</dc:date>
    </item>
  </channel>
</rss>

