<?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: Dynamic Internal Tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457448#M216183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow the steps to create a dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use the field catalog to create a table dynamically using the method below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T_OUTPUT TYPE REF TO DATA &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;T_OUTPUT&amp;gt; TYPE TABLE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Method CL_ALV_TABLE_CREATE-&amp;gt;CREATE_DYNAMIC_TABLE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exporting &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT_FIELDCATALOG = T_FIELDCAT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Importing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EP_TABLE = T_OUTPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN T_OUTPUT-&amp;gt;* TO &amp;lt;T_OUTPUT&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the field symbol &amp;lt;T_OUTPUT&amp;gt; is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass &amp;lt;T_OUTPUT&amp;gt; to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* the content of itab will be fields of the new table
loop at itab1 into wa1.
  Gs_FIELDCAT-TABNAME     = 'itab2'.
  GS_FIELDCAT-FIELDNAME = wa1-packid.
  GS_FIELDCAT-OUTPUTLEN = 2.
  GS_FIELDCAT-KEY         = space.
  GS_FIELDCAT-SELTEXT_L = wa1-packid.
  GS_FIELDCAT-COL_POS     =  1.
  GS_FIELDCAT-JUST        = 'L'.

  APPEND GS_FIELDCAT TO GT_FIELDCAT.
endloop.

LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.

    MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.

    APPEND ls_fcat TO lt_fieldcat.

  ENDLOOP.



CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table

                     EXPORTING it_fieldcatalog = lt_fieldcat

                     IMPORTING ep_table = t_output.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kinshuk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jun 2006 05:01:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-21T05:01:18Z</dc:date>
    <item>
      <title>Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457443#M216178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a report in PS, in which based on the project I need to increase the number of columns. Thst is, I have to display the sheduled date, start date &amp;amp; its description under the porject name in one column. If the project is new , then I have to display the detailes in a new column. It may have n number of projects. How to do? Is it possible? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;/P&gt;&lt;P&gt;G.Vijayakumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 04:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457443#M216178</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T04:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457444#M216179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at these weblogs which talk about dynamic internal tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/ravikumar.allampallam/blog/2005/05/31/expand-the-list-of-columns-in-a-report-dynamically&lt;/P&gt;&lt;P&gt;/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table&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;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : Please mark the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 04:44:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457444#M216179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T04:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457445#M216180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to build a dynamic internal table,&lt;/P&gt;&lt;P&gt;see the following exmaple&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose itab has fields A, B, C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO ITAB-C HAS THE VALUES OF C. NOW WE WANT A TABLE WITH VALUES OF C RIGHT!!.&lt;/P&gt;&lt;P&gt;NOW BUILD A FIELDCATALOG LIKE BELOW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;LS_FIELDCAT-FIELDNAME = ITAB-C.&lt;/P&gt;&lt;P&gt;LS_FIELDCAT-COL_TEXT = ITAB_C.&lt;/P&gt;&lt;P&gt;APPEND LS_FIELDCAT TO LT_FIELDCAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: DREF TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;TEMP_TAB&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;IT_FIELDCATALOG = LT_LVCFIELDCAT&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;EP_TABLE = DREF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN dref-&amp;gt;* TO &amp;lt;TEMP_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;TEMP_TAB&amp;gt; IS THE REQUIRED DYNAMIC INTERNAL TABLE.&lt;/P&gt;&lt;P&gt;NOW IF U WANT TO FILL THE DYNAMIC INTERNAL TABLE.&lt;/P&gt;&lt;P&gt;DO AS BELOW..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: WA_DREF TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;WA_TAB&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA WA_DREF LIKE LINE OF &amp;lt;TEMP_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN WA_DREF-&amp;gt;* TO &amp;lt;WA_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;FS1&amp;gt;, &amp;lt;FS2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT ITAB-C OF STRUCTURE &amp;lt;WA_TAB&amp;gt; TO &amp;lt;FS1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;FS1&amp;gt; = {SOME VALUE}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND &amp;lt;WA_TAB&amp;gt; TO &amp;lt;TEMP_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 04:47:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457445#M216180</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2006-06-21T04:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457446#M216181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijaykumar,&lt;/P&gt;&lt;P&gt;follow these steps to create dynamic internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Declare an internal table (say lt_fcat) of type lvc_t_fcat.&lt;/P&gt;&lt;P&gt;2. populate lt_fcat with the information about the fields you want in your dynamic internal table.&lt;/P&gt;&lt;P&gt;3. declare a data reference fo type data (say lt_xtab).&lt;/P&gt;&lt;P&gt;4. call the following method:&lt;/P&gt;&lt;P&gt; CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      it_fieldcatalog           = lt_fcat&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      ep_table                  = lt_xtab&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;      OTHERS                    = 2.&lt;/P&gt;&lt;P&gt;5. Declare a field symbol &amp;lt;FS&amp;gt; and use the following statement :&lt;/P&gt;&lt;P&gt;ASSIGN LT_XTAB-&amp;gt;* TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use the field symbol &amp;lt;FS&amp;gt; as an internal table with that many fields, as many records were there in lt_fcat.&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Deb.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 04:50:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457446#M216181</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T04:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457447#M216182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijaykumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;===================================== &lt;/P&gt;&lt;P&gt;REPORT zmaschl_create_data_dynamic . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_fcat TYPE slis_t_fieldcat_alv, &lt;/P&gt;&lt;P&gt;is_fcat LIKE LINE OF it_fcat. &lt;/P&gt;&lt;P&gt;DATA: it_fieldcat TYPE lvc_t_fcat, &lt;/P&gt;&lt;P&gt;is_fieldcat LIKE LINE OF it_fieldcat. &lt;/P&gt;&lt;P&gt;DATA: new_table TYPE REF TO data. &lt;/P&gt;&lt;P&gt;DATA: new_line TYPE REF TO data. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;l_table&amp;gt; TYPE ANY TABLE, &lt;/P&gt;&lt;P&gt;&amp;lt;l_line&amp;gt; TYPE ANY, &lt;/P&gt;&lt;P&gt;&amp;lt;l_field&amp;gt; TYPE ANY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build fieldcat &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' &lt;/P&gt;&lt;P&gt;EXPORTING &lt;/P&gt;&lt;P&gt;i_structure_name = 'SYST' &lt;/P&gt;&lt;P&gt;CHANGING &lt;/P&gt;&lt;P&gt;ct_fieldcat = it_fcat[]. &lt;/P&gt;&lt;P&gt;LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial. &lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING is_fcat TO is_fieldcat. &lt;/P&gt;&lt;P&gt;is_fieldcat-fieldname = is_fcat-fieldname. &lt;/P&gt;&lt;P&gt;is_fieldcat-ref_field = is_fcat-fieldname. &lt;/P&gt;&lt;P&gt;is_fieldcat-ref_table = is_fcat-ref_tabname. &lt;/P&gt;&lt;P&gt;APPEND is_fieldcat TO it_fieldcat. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a new Table &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table &lt;/P&gt;&lt;P&gt;EXPORTING &lt;/P&gt;&lt;P&gt;it_fieldcatalog = it_fieldcat &lt;/P&gt;&lt;P&gt;IMPORTING &lt;/P&gt;&lt;P&gt;ep_table = new_table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a new Line with the same structure of the table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ASSIGN new_table-&amp;gt;* TO &amp;lt;l_table&amp;gt;. &lt;/P&gt;&lt;P&gt;CREATE DATA new_line LIKE LINE OF &amp;lt;l_table&amp;gt;. &lt;/P&gt;&lt;P&gt;ASSIGN new_line-&amp;gt;* TO &amp;lt;l_line&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Test it... &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DO 30 TIMES. &lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'SUBRC' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;. &lt;/P&gt;&lt;P&gt;&amp;lt;l_field&amp;gt; = sy-index. &lt;/P&gt;&lt;P&gt;INSERT &amp;lt;l_line&amp;gt; INTO TABLE &amp;lt;l_table&amp;gt;. &lt;/P&gt;&lt;P&gt;ENDDO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;l_table&amp;gt; ASSIGNING &amp;lt;l_line&amp;gt;. &lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'SUBRC' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;. &lt;/P&gt;&lt;P&gt;WRITE &amp;lt;l_field&amp;gt;. &lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the fields as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mukesh Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 04:51:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457447#M216182</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T04:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457448#M216183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow the steps to create a dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use the field catalog to create a table dynamically using the method below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T_OUTPUT TYPE REF TO DATA &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;T_OUTPUT&amp;gt; TYPE TABLE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Method CL_ALV_TABLE_CREATE-&amp;gt;CREATE_DYNAMIC_TABLE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exporting &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT_FIELDCATALOG = T_FIELDCAT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Importing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EP_TABLE = T_OUTPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN T_OUTPUT-&amp;gt;* TO &amp;lt;T_OUTPUT&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the field symbol &amp;lt;T_OUTPUT&amp;gt; is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass &amp;lt;T_OUTPUT&amp;gt; to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* the content of itab will be fields of the new table
loop at itab1 into wa1.
  Gs_FIELDCAT-TABNAME     = 'itab2'.
  GS_FIELDCAT-FIELDNAME = wa1-packid.
  GS_FIELDCAT-OUTPUTLEN = 2.
  GS_FIELDCAT-KEY         = space.
  GS_FIELDCAT-SELTEXT_L = wa1-packid.
  GS_FIELDCAT-COL_POS     =  1.
  GS_FIELDCAT-JUST        = 'L'.

  APPEND GS_FIELDCAT TO GT_FIELDCAT.
endloop.

LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.

    MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.

    APPEND ls_fcat TO lt_fieldcat.

  ENDLOOP.



CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table

                     EXPORTING it_fieldcatalog = lt_fieldcat

                     IMPORTING ep_table = t_output.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kinshuk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 05:01:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1457448#M216183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T05:01:18Z</dc:date>
    </item>
  </channel>
</rss>

