<?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: How to read a table dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568906#M256823</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi u just combine my previous solution wid this 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using earlier solution u r creating a dynaminc databse tab name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now to create dynamic internal table name.........plz hv a look at &lt;A href="http://www.sap-img.com/ab030.htm" target="test_blank"&gt;http://www.sap-img.com/ab030.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I dont hv muc htime ...otherwise i culd hv combined both da solution for u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so just do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : name (10) type c.&lt;/P&gt;&lt;P&gt;name = wa_itab-tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * into table (dynamic internal table)&lt;/P&gt;&lt;P&gt;from (name).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Sep 2006 08:18:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-21T08:18:02Z</dc:date>
    <item>
      <title>How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568897#M256814</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;  I need to read the table which i will get that dynamically in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some times the table name like * and some times it's like &lt;/P&gt;&lt;P&gt;a 4 digit name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to read the 4 digit table name only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i read taht table only......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;srikanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:39:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568897#M256814</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568898#M256815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How come your table name can change in a program?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you creating customised table or using standard SAP table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to use if/else statement for different selecting of tables, but you must rectify the tables name at first hand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:43:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568898#M256815</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568899#M256816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;same thread.&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="424056"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:44:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568899#M256816</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568900#M256817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For dynamic table name.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_select_dynamic_database . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA wa TYPE scarr. &lt;/P&gt;&lt;P&gt;DATA name(10) TYPE c VALUE 'SCARR'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;INTO wa &lt;/P&gt;&lt;P&gt;FROM (name) CLIENT SPECIFIED &lt;/P&gt;&lt;P&gt;WHERE mandt = '000'. &lt;/P&gt;&lt;P&gt;WRITE: / wa-carrid, wa-carrname. &lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:49:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568900#M256817</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568901#M256818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI kishan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Thanks...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:49:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568901#M256818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568902#M256819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks rajesh..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i will explain you clearly..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  iam getting table names in itab-checktable.&lt;/P&gt;&lt;P&gt;  It has multiple entries like * ,vbuk etc....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i want to read the table name which is in itab-checktable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:54:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568902#M256819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568903#M256820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ong rukawaw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  My requirement is:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; iam getting table names in itab-checktable.&lt;/P&gt;&lt;P&gt;  It has multiple entries like  *,vbuk,tvak etc....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i want to read the table name which is in itab-checktable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;srik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:56:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568903#M256820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T07:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568904#M256821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am afraid that when you read the table name from itab-checktable, you may need to store in a variable. The problem is we cant use select command to select record from variable. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: ong rukawaw&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 08:02:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568904#M256821</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T08:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568905#M256822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My propose solution for you will be as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab-checktable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-checktable-tablename = 'vbuk'.&lt;/P&gt;&lt;P&gt;Select * from vbuk...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif itab-checktable-tablename = 'tvak'.&lt;/P&gt;&lt;P&gt;Select * from tvak...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 08:04:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568905#M256822</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T08:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568906#M256823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi u just combine my previous solution wid this 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using earlier solution u r creating a dynaminc databse tab name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now to create dynamic internal table name.........plz hv a look at &lt;A href="http://www.sap-img.com/ab030.htm" target="test_blank"&gt;http://www.sap-img.com/ab030.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I dont hv muc htime ...otherwise i culd hv combined both da solution for u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so just do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : name (10) type c.&lt;/P&gt;&lt;P&gt;name = wa_itab-tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * into table (dynamic internal table)&lt;/P&gt;&lt;P&gt;from (name).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 08:18:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568906#M256823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T08:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568907#M256824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ong rukawaw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Thanks for your view. It's really very helpful for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 08:38:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568907#M256824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T08:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568908#M256825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi rajesh,&lt;/P&gt;&lt;P&gt;  Thanks for ur code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  It helped me alot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Thanks,&lt;/P&gt;&lt;P&gt;srikanth.J&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 08:39:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568908#M256825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T08:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568909#M256826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi srikanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you want to read table dynamically, thus i would suggeest to use most dynamic method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; DATA ds_table TYPE REF TO data.
 DATA descr_struct_ref TYPE REF TO cl_abap_structdescr.
 DATA it_fieldcatalog TYPE lvc_t_fcat.
 DATA wa_fcat TYPE lvc_s_fcat.

 DATA ep_table TYPE REF TO data.
 FIELD-SYMBOLS: &amp;lt;my_table&amp;gt; TYPE ANY TABLE,
                &amp;lt;LINE_TABLE&amp;gt; TYPE ANY.
 FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.
 FIELD-SYMBOLS: &amp;lt;components&amp;gt; TYPE abap_compdescr.

PARAMETERS: p_table TYPE tabname.
PARAMETERS: p_maxrow type i.

* Create reference for structure of the table
* because statement CREATE DATA ref TYPE TABLE OF
* is not allowed in 4.6
 CREATE DATA ds_table TYPE (p_table).
 ASSIGN ds_table-&amp;gt;* TO &amp;lt;fs&amp;gt;.

* cast down
 descr_struct_ref ?= cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;fs&amp;gt; ).

* build fieldcatalog
 LOOP AT descr_struct_ref-&amp;gt;components ASSIGNING &amp;lt;components&amp;gt;.
   wa_fcat-fieldname     = &amp;lt;components&amp;gt;-name.
   wa_fcat-ref_table     = p_table.
   wa_fcat-ref_field     = &amp;lt;components&amp;gt;-name.
   APPEND wa_fcat TO it_fieldcatalog.
 ENDLOOP.

* build a reference for internal table
 CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
   EXPORTING
     it_fieldcatalog           = it_fieldcatalog
   IMPORTING
     ep_table                  = ep_table
   EXCEPTIONS
     generate_subpool_dir_full = 1
     OTHERS                    = 2.

* assign refrence to field-symbol
 ASSIGN ep_table-&amp;gt;* TO &amp;lt;my_table&amp;gt;.

* select dynamically in your table
 SELECT * FROM (p_table) INTO TABLE &amp;lt;my_table&amp;gt; UP TO p_maxrow ROWS.
  LOOP AT &amp;lt;MY_TABLE&amp;gt; ASSIGNING &amp;lt;LINE_TABLE&amp;gt;.
    WRITE:/ &amp;lt;LINE_TABLE&amp;gt;.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 09:51:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-a-table-dynamically/m-p/1568909#M256826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T09:51:41Z</dc:date>
    </item>
  </channel>
</rss>

