<?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: Declare Internal Table dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219777#M1008258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avik.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest a few references,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN Weblog - Standard Reference for Dynamic Internal Tables and Structures by Rich Heilman - ABAP|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2071] &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN - Reference for Creating Dynamic Internal Tables|/thread/418716 &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN Wiki - Code Snippets - Standard Reference for Dynamic Internal Table|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/dynamic%2binternal%2btable]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that's usefull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck &amp;amp; Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Harsh Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Jul 2008 13:11:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-28T13:11:02Z</dc:date>
    <item>
      <title>Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219768#M1008249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Expart,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I declare Internal Table dynamically by using the table name as input parameter in the selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data i_table type standard table of (p1) . (dynamically taken by the input parameter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 12:58:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219768#M1008249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T12:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219769#M1008250</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;Check the link for step by step guidence of creation of internal table dynamicaly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?p=107594" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?p=107594&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:00:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219769#M1008250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219770#M1008251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Please find the sample program to create dynamic internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;type-pools : abap. 
  field-symbols: &amp;lt;dyn_table&amp;gt; type standard table, 
               &amp;lt;dyn_wa&amp;gt;, 
               &amp;lt;dyn_field&amp;gt;. 
  data: dy_table type ref to data, 
      dy_line  type ref to data, 
      xfc type lvc_s_fcat, 
      ifc type lvc_t_fcat. 
  selection-screen begin of block b1 with frame. 
parameters: p_table(30) type c default 'T001'. 
selection-screen end of block b1. 
  start-of-selection. 
    perform get_structure. 
  perform create_dynamic_itab.      **********Creates a dyanamic internal table********** 
  perform get_data. 
  perform write_out. 
  form get_structure. 
  data : idetails type abap_compdescr_tab, 
       xdetails type abap_compdescr. 
  data : ref_table_des type ref to cl_abap_structdescr. 
  * Get the structure of the table. 
  ref_table_des ?=  
      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ). 
  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. 
  endform. 
  form create_dynamic_itab. 
  * Create dynamic internal table and assign to FS 
  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 dynamic work area and assign to FS 
  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;. 
  endform. 
    
  form get_data. 
  * Select Data from table. 
  select * into table &amp;lt;dyn_table&amp;gt; 
             from (p_table). 
  endform. 
   Write out data from table. 
  loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;. 
    do. 
      assign component  sy-index   
         of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_field&amp;gt;. 
      if sy-subrc &amp;lt;&amp;gt; 0. 
        exit. 
      endif. 
      if sy-index = 1. 
        write:/ &amp;lt;dyn_field&amp;gt;. 
      else. 
        write: &amp;lt;dyn_field&amp;gt;. 
      endif. 
    enddo. 
  endloop. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Saravanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:02:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219770#M1008251</guid>
      <dc:creator>former_member254848</dc:creator>
      <dc:date>2008-07-28T13:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219771#M1008252</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;Refer to the link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="752479"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219771#M1008252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219772#M1008253</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;check out this link it may help you a lot with easy understanding step by step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm" target="test_blank"&gt;http://saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:03:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219772#M1008253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219773#M1008254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these links for examples of dynamic creation of internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sample-code-abap.blogspot.com/2008/07/sap-abap-dynamic-internal-table-and.html" target="test_blank"&gt;http://sample-code-abap.blogspot.com/2008/07/sap-abap-dynamic-internal-table-and.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:03:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219773#M1008254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219774#M1008255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One such example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zdynamic.
 
FIELD-SYMBOLS: &amp;lt;l_table&amp;gt; TYPE table,
&amp;lt;l_line&amp;gt; TYPE ANY,
&amp;lt;l_field&amp;gt; TYPE ANY.
 
DATA: is_lvc_cat TYPE lvc_s_fcat,
      it_lvc_cat TYPE lvc_t_fcat.
 
DATA: new_table TYPE REF TO data,
      new_line  TYPE REF TO data.
 
 
START-OF-SELECTION.
 
  is_lvc_cat-fieldname = 'KUNNR'.
  APPEND is_lvc_cat TO it_lvc_cat.
 
  is_lvc_cat-fieldname = 'NAME1'.
  APPEND is_lvc_cat TO it_lvc_cat.
 
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_lvc_cat
    IMPORTING
      ep_table        = new_table.
 
*Create a new Line with the same structure of the table.
  ASSIGN new_table-&amp;gt;* TO &amp;lt;l_table&amp;gt;.
  CREATE DATA new_line LIKE LINE OF &amp;lt;l_table&amp;gt;.
  ASSIGN new_line-&amp;gt;* TO &amp;lt;l_line&amp;gt;.
 
 
  DO 2 TIMES.
    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;.
    &amp;lt;l_field&amp;gt; = sy-index.
 
    ASSIGN COMPONENT 'NAME1' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;.
    &amp;lt;l_field&amp;gt; = 'A'.
    INSERT &amp;lt;l_line&amp;gt; INTO TABLE &amp;lt;l_table&amp;gt;.
  ENDDO.
 
  LOOP AT &amp;lt;l_table&amp;gt; INTO &amp;lt;l_line&amp;gt;.
    WRITE:/ &amp;lt;l_line&amp;gt;.
  ENDLOOP.
 
  READ TABLE &amp;lt;l_table&amp;gt; INTO &amp;lt;l_line&amp;gt; INDEX 2.
  &amp;lt;l_line&amp;gt;+10(2) = 'B'.
  MODIFY &amp;lt;l_table&amp;gt; FROM &amp;lt;l_line&amp;gt; INDEX 2.
 
 
  LOOP AT &amp;lt;l_table&amp;gt; INTO &amp;lt;l_line&amp;gt;.
    WRITE:/ &amp;lt;l_line&amp;gt;.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijay Babu Dudla&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219774#M1008255</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219775#M1008256</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;use this links &lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="416161"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="752479"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Snehi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: snehi chouhan on Jul 28, 2008 3:07 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:05:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219775#M1008256</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219776#M1008257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ Saravanan &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont copy paste the code, From some one else post. If it is your post you can copy it. Try to Refer the Link.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:06:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219776#M1008257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Declare Internal Table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219777#M1008258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avik.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest a few references,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN Weblog - Standard Reference for Dynamic Internal Tables and Structures by Rich Heilman - ABAP|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2071] &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN - Reference for Creating Dynamic Internal Tables|/thread/418716 &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN Wiki - Code Snippets - Standard Reference for Dynamic Internal Table|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/dynamic%2binternal%2btable]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that's usefull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck &amp;amp; Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Harsh Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2008 13:11:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declare-internal-table-dynamically/m-p/4219777#M1008258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-28T13:11:02Z</dc:date>
    </item>
  </channel>
</rss>

