<?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: Creating Internal tables dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019243#M80754</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;  Merge both the field catalogs into a new field catalog internal table and also add suffix "_1" to all field names from the first field catalog table and "_2" to all field names from the second field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Then use CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Sep 2005 13:25:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-09-20T13:25:33Z</dc:date>
    <item>
      <title>Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019241#M80752</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;  Is there any way to create an internal table dynamically.&lt;/P&gt;&lt;P&gt;My scenario is, I have two internal tables with their field catalog. Now i want ot create a new internal table with fields comprising internal table 1 and 2 without duplication of fields.&lt;/P&gt;&lt;P&gt;  thanx for spending your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:12:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019241#M80752</guid>
      <dc:creator>aaruljothi</dc:creator>
      <dc:date>2005-09-20T13:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019242#M80753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please search the forum for 'dynamic internal table'. You will get lots of post. Many are with sample codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vinid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:24:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019242#M80753</guid>
      <dc:creator>Vinod_Chandran</dc:creator>
      <dc:date>2005-09-20T13:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019243#M80754</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;  Merge both the field catalogs into a new field catalog internal table and also add suffix "_1" to all field names from the first field catalog table and "_2" to all field names from the second field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Then use CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:25:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019243#M80754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-20T13:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019244#M80755</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;&lt;/P&gt;&lt;P&gt;1) merge fieldcatalog 1 and 2&lt;/P&gt;&lt;P&gt;with fm REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) collect fieldcat 1 and 2 to fcat 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) build int. table with fm REUSE_ALV_TABLE_CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;look this weblogs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; /people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Andreas Mann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:26:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019244#M80755</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-09-20T13:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019245#M80756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is too. Thanks for God I have been creating internal table. But now my problem is display this dynamic internal table in ALV grid. If you find any answer please send me too. My code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source : /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Modified code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  ZDYNAMIC_INTERNAL             .

*Data definitions
*** Tables
DATA: LT_DATA type ref to DATA.
DATA: LT_FIELDCATALOG type LVC_T_FCAT.

*** Structure
DATA: LS_FIELDCATALOG type LVC_S_FCAT.

*** Data References
DATA: NEW_LINE type ref to data,
      FS_DATA type ref to data.

*** Field Symbols
FIELD-SYMBOLS: &amp;lt;FS_DATA&amp;gt; type ref to DATA,
               &amp;lt;FS_1&amp;gt; type any table,
               &amp;lt;FS_2&amp;gt;,
               &amp;lt;FS_3&amp;gt;.

*Populating the internal table with fieldnames required for our dynamic
*internal table

LS_FIELDCATALOG-FIELDNAME = 'MANDT'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CARRID'. "Fieldname
LS_FIELDCATALOG-INTTYPE = 'C'. "Internal Type C-&amp;gt; Character
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CONNID'.
LS_FIELDCATALOG-INTTYPE = 'N'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'FLDATE'.
LS_FIELDCATALOG-INTTYPE = 'D'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'PRICE'.
LS_FIELDCATALOG-INTTYPE = 'P'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CURRENCY'.
LS_FIELDCATALOG-INTTYPE = 'C'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

*Calling the method CREATE_DYNAMIC_TABLE
call method cl_alv_table_create=&amp;gt;create_dynamic_table
     exporting
       it_fieldcatalog = LT_FIELDCATALOG
     importing
       ep_table = FS_DATA
     exceptions
       generate_subpool_dir_full = 1
       others = 2
		.
if sy-subrc &amp;lt;&amp;gt; 0.
endif.

*Assigning Field-Symbol to our dynamic internal table
assign LT_DATA to &amp;lt;FS_DATA&amp;gt;.



*Internal Table is ready, now to put data in that table
*** So &amp;lt;FS_1&amp;gt; now points to our dynamic internal table.

assign FS_DATA-&amp;gt;* to &amp;lt;FS_1&amp;gt;.

*** Next step is to create a work area for our dynamic internal table.

create data NEW_LINE like line of &amp;lt;FS_1&amp;gt;.

*** A field-symbol to access that work area
assign NEW_LINE-&amp;gt;*  to &amp;lt;FS_2&amp;gt;.

*** And to put the data in the internal table
select MANDT CARRID CONNID FLDATE PRICE CURRENCY
  from SFLIGHT
  into corresponding fields of table &amp;lt;FS_1&amp;gt;.

*** Access contents of internal table
loop at &amp;lt;FS_1&amp;gt; assigning &amp;lt;FS_2&amp;gt;.
do 5 times.
assign component sy-index of structure &amp;lt;FS_2&amp;gt; to &amp;lt;FS_3&amp;gt;.
write:  &amp;lt;FS_3&amp;gt;.
enddo.
skip 1.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:30:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019245#M80756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-20T13:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Internal tables dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019246#M80757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, you can reference this link:&lt;/P&gt;&lt;P&gt;/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for your scenario, compare with the field catalog of internal table 1 &amp;amp; 2.  delete the duplication, then using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cl_alv_table_create=create_dynamic_table&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;cl_abap_tabledescr=&amp;gt;create&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;about the way to delete duplication.&lt;/P&gt;&lt;P&gt;you can have a third internal table itab 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab1 to itab3&lt;/P&gt;&lt;P&gt;append itab2 to itab3&lt;/P&gt;&lt;P&gt;sort itab3&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB3 COMPARING fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it will be helpful&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2005 13:31:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-internal-tables-dynamically/m-p/1019246#M80757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-20T13:31:55Z</dc:date>
    </item>
  </channel>
</rss>

