<?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: Reg. reading database tables. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585063#M1081558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried Advait's answer with a slight modification - added ( ) for the variable tab_name. It's working. Thank you.&lt;/P&gt;&lt;P&gt;I have n't tried Abhishek's answer but thanks for your reply to this question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Oct 2008 17:15:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-07T17:15:29Z</dc:date>
    <item>
      <title>Reg. reading database tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585060#M1081555</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 have stored some database table names in a custom table. In my custom report, I have to read those database tables depending on certain criteria.&lt;/P&gt;&lt;P&gt;For ex: I have the table names 'MARA' , 'MARC' stored in my custom table ztables.&lt;/P&gt;&lt;P&gt;In my report, if a flag is set to 'X', I have to read MARA otherwise MARC...(these entries in ztables can change in future..so i can not read directly from MARA or MARC)..How to achieve this? Once the table names are stored in a variable, how to read data from this table name? if i say 'read' it will try to read this variable and not the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2008 17:01:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585060#M1081555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-02T17:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. reading database tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585061#M1081556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You can pass a table name dynamically to a select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tb_name(4) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"select your table name.....&lt;/P&gt;&lt;P&gt;"lets say that tb_name now has 'MARA'.&lt;/P&gt;&lt;P&gt;so the select query will be &lt;/P&gt;&lt;P&gt;select * from tb_name &lt;/P&gt;&lt;P&gt;....and then the where conditions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For further info, refer to ABAPDOCU transaction in that look for Database Access and dynamically specifying table name. or write SELECT in abap editor and press F1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2008 17:09:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585061#M1081556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-02T17:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. reading database tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585062#M1081557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can try this approach &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : ref_table_des type ref to cl_abap_structdescr.

data:tabname like dd02l-tabname.

data : idetails type abap_compdescr_tab,
       xdetails type abap_compdescr,
    xfc type lvc_s_fcat,
    ifc type lvc_t_fcat.

data: dy_table type ref to data,
    dy_line  type ref to data,

field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,
             &amp;lt;dyn_wa&amp;gt;.


  ref_table_des ?=
      cl_abap_typedescr=&amp;gt;describe_by_name( tabname ).

  idetails[] = ref_table_des-&amp;gt;components[].

  loop at idetails into xdetails.
    clear xfc.
    xfc-fieldname = xdetails-name .
    xfc-datatype = xdetails-type_kind.
    xfc-inttype = xdetails-type_kind.
    xfc-intlen = xdetails-length.
    xfc-decimals = xdetails-decimals.
    append xfc to ifc.
  endloop.

  call method cl_alv_table_create=&amp;gt;create_dynamic_table
                 exporting
                    it_fieldcatalog = ifc
                 importing
                    ep_table        = dy_table.

  assign dy_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;.

  create data dy_line like line of &amp;lt;dyn_table&amp;gt;.
  assign dy_line-&amp;gt;* to &amp;lt;dyn_wa&amp;gt;.

select *
into table &amp;lt;dyn_table&amp;gt;
from  (tabname).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where variable tabname stores the name of the table stored in your custom table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2008 17:10:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585062#M1081557</guid>
      <dc:creator>former_member195698</dc:creator>
      <dc:date>2008-10-02T17:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. reading database tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585063#M1081558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried Advait's answer with a slight modification - added ( ) for the variable tab_name. It's working. Thank you.&lt;/P&gt;&lt;P&gt;I have n't tried Abhishek's answer but thanks for your reply to this question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2008 17:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-reading-database-tables/m-p/4585063#M1081558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-07T17:15:29Z</dc:date>
    </item>
  </channel>
</rss>

