<?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 how to create internal table dynamically? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-internal-table-dynamically/m-p/2154660#M455109</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 particular internal table in memory area( thru EXPORT TO MEMORY ID ....)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i create an internal table of this type in another program at runtime  ?&lt;/P&gt;&lt;P&gt;this internal table need not be a data dictionary type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e., i need to create an internal table of type which&lt;/P&gt;&lt;P&gt;is stored in a particular memory-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Apr 2007 09:42:32 GMT</pubDate>
    <dc:creator>naveen1241</dc:creator>
    <dc:date>2007-04-14T09:42:32Z</dc:date>
    <item>
      <title>how to create internal table dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-internal-table-dynamically/m-p/2154660#M455109</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 particular internal table in memory area( thru EXPORT TO MEMORY ID ....)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i create an internal table of this type in another program at runtime  ?&lt;/P&gt;&lt;P&gt;this internal table need not be a data dictionary type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e., i need to create an internal table of type which&lt;/P&gt;&lt;P&gt;is stored in a particular memory-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Apr 2007 09:42:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-internal-table-dynamically/m-p/2154660#M455109</guid>
      <dc:creator>naveen1241</dc:creator>
      <dc:date>2007-04-14T09:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to create internal table dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-internal-table-dynamically/m-p/2154661#M455110</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 this code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS: slis. 


 FIELD-SYMBOLS: &amp;lt;t_dyntable&amp;gt; TYPE STANDARD TABLE,  
                &amp;lt;fs_dyntable&amp;gt;,                     
                &amp;lt;fs_fldval&amp;gt; type any.              
PARAMETERS: p_cols(5) TYPE c.    

DATA:        t_newtable TYPE REF TO data, 
             t_newline  TYPE REF TO data, 
             t_fldcat   TYPE slis_t_fldcat_alv, 
             t_fldcat   TYPE lvc_t_fcat, 
             wa_it_fldcat TYPE lvc_s_fcat, 
             wa_colno(2) TYPE n, 
             wa_flname(5) TYPE c.  

* Create fields . 

  DO p_cols TIMES. 
    CLEAR wa_it_fldcat. 
    move sy-index to wa_colno. 
    concatenate 'COL' 
                wa_colno 
           into wa_flname. 
    wa_it_fldcat-fieldname = wa_flname. 
    wa_it_fldcat-datatype = 'CHAR'. 
    wa_it_fldcat-intlen = 10. 
    APPEND wa_it_fldcat TO t_fldcat. 
  ENDDO.  

* Create dynamic internal table and assign to FS 

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table 
    EXPORTING 
      it_fieldcatalog = t_fldcat 
    IMPORTING 
      ep_table        = t_newtable.  

  ASSIGN t_newtable-&amp;gt;* TO &amp;lt;t_dyntable&amp;gt;.  

* Create dynamic work area and assign to FS 

  CREATE DATA t_newline LIKE LINE OF &amp;lt;t_dyntable&amp;gt;. 

  ASSIGN t_newline-&amp;gt;* TO &amp;lt;fs_dyntable&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

DATA it_fieldcatalog TYPE lvc_t_fcat. 
DATA lr_table TYPE REF TO data. 
FIELD-SYMBOLS &amp;lt;lt_table&amp;gt; TYPE table. 

*-- Import the fieldcatalog 
IMPORT it_fieldcatalog TO it_fieldcatalog 
       FROM MEMORY ID 'CREATE_DYNAMIC_TABLE'. 
IF sy-subrc &amp;lt;&amp;gt; 0. 
  EXIT. 
ENDIF. 

*-- Create the dynamic table with the field catalog as structure 
CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table 
  EXPORTING 
    it_fieldcatalog           = it_fieldcatalog 
  IMPORTING 
    ep_table                  = lr_table 
  EXCEPTIONS 
    generate_subpool_dir_full = 1 
    OTHERS                    = 2. 
IF sy-subrc &amp;lt;&amp;gt; 0. 
  EXIT. 
ENDIF. 

*-- Convert the reference into a table 
ASSIGN lr_table-&amp;gt;* TO &amp;lt;lt_table&amp;gt;. 
IF sy-subrc &amp;lt;&amp;gt; 0. 
  EXIT. 
ENDIF. 

*-- Export the created table so that the function module can import it 
EXPORT lt_table FROM &amp;lt;lt_table&amp;gt; 
       TO MEMORY ID 'CREATE_DYNAMIC_TABLE'.

&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;L Appana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Apr 2007 09:51:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-internal-table-dynamically/m-p/2154661#M455110</guid>
      <dc:creator>Laxmana_Appana_</dc:creator>
      <dc:date>2007-04-14T09:51:39Z</dc:date>
    </item>
  </channel>
</rss>

