<?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 table column dynamically? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302424#M158926</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in such a case you need to define the internal table dynamically&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which can be done using &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 = 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;search this forum for code sample on using this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Jun 2006 08:57:14 GMT</pubDate>
    <dc:creator>athavanraja</dc:creator>
    <dc:date>2006-06-04T08:57:14Z</dc:date>
    <item>
      <title>Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302420#M158922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to display some information using ALV. But my table's columns are not static. Its column size can be change respect to station. Now, It it possible to add new columns to internal table and show with ALV?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:37:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302420#M158922</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-04T08:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302421#M158923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can'nt we try to fill field catalog based on the logic?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Manohar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:48:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302421#M158923</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-06-04T08:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302422#M158924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I mean that my internal table's column size can be 10 or 15 or 17 or another number respect to user's selection. So, I can not define internal table statically.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:53:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302422#M158924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-04T08:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302423#M158925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As manohar said modify the field catalog and dont forget to call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH_TABLE_DISPLAY method of cl_gui_alv_grid. (i assume you are using class based ALV)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:55:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302423#M158925</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-06-04T08:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302424#M158926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in such a case you need to define the internal table dynamically&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which can be done using &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 = 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;search this forum for code sample on using this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:57:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302424#M158926</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-06-04T08:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302425#M158927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;then you need to create dynamic internal table and respective field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Manohar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 08:58:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302425#M158927</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-06-04T08:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302426#M158928</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;This is a Example progrma to create a Dinamic Internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZDEEP_DYNAMIC_INTERNALTABLE                                 *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

report  zdeep_dynamic_internaltable             .

data: d_ref type ref to data,
d_ref2 type ref to data ,
i_alv_cat type table of lvc_s_fcat,
ls_alv_cat like line of i_alv_cat.


types tabname like dcobjdef-name .
parameter: p_tablen type tabname.

data: begin of itab occurs 0.
include structure dntab.
data: end of itab.


field-symbols : &amp;lt;f_fs&amp;gt; type table,
&amp;lt;f_fs1&amp;gt; type table,
&amp;lt;f_fs2&amp;gt; type any,
&amp;lt;f_fs3&amp;gt; type table,
&amp;lt;f_fs4&amp;gt; type any.

refresh itab.
call function 'NAMETAB_GET'
exporting
langu = sy-langu
tabname = p_tablen
tables
nametab = itab

exceptions
no_texts_found = 1.
loop at itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
append ls_alv_cat to i_alv_cat.
endloop.
* internal table build
call method cl_alv_table_create=&amp;gt;create_dynamic_table
exporting it_fieldcatalog = i_alv_cat
importing ep_table = d_ref .
assign d_ref-&amp;gt;* to &amp;lt;f_fs&amp;gt;.

select * from (p_tablen) into corresponding fields of table &amp;lt;f_fs&amp;gt;.


loop at &amp;lt;f_fs&amp;gt; assigning &amp;lt;f_fs2&amp;gt;.
assign itab-fieldname to &amp;lt;f_fs4&amp;gt;.
loop at itab.
write: / &amp;lt;f_fs4&amp;gt;.
endloop.

endloop.&lt;/CODE&gt;&lt;/PRE&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;Thanks&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 09:52:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302426#M158928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-04T09:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302427#M158929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Refer this below link also&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;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 09:56:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302427#M158929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-04T09:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating table column dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302428#M158930</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;Take a look at these blogs which deal with 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;You will have to create the entire internal table dynamically, once created you cannot add any more fields to the table.&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;Note :Please mark the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jun 2006 13:55:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-column-dynamically/m-p/1302428#M158930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-04T13:55:27Z</dc:date>
    </item>
  </channel>
</rss>

