<?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 ALV with variable columns in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417212#M200606</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 to do a ALV with variable no. of columns. i.e Depending on the data , the columns should get populated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dnyanesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jun 2006 10:51:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-27T10:51:56Z</dc:date>
    <item>
      <title>ALV with variable columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417212#M200606</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 to do a ALV with variable no. of columns. i.e Depending on the data , the columns should get populated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dnyanesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2006 10:51:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417212#M200606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-27T10:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: ALV with variable columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417213#M200607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The solution here is to create a internal table dynamically depending on how many columns you want. Please take a look at my blog, where a table can be created at runtime from the fieldcatalog.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;/people/ravikumar.allampallam/blog/2005/05/31/expand-the-list-of-columns-in-a-report-dynamically&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2006 10:55:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417213#M200607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-27T10:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: ALV with variable columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417214#M200608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CReate a dynamic internal table and buid the field catalog for that internal table.&lt;/P&gt;&lt;P&gt;Refer the following thread for some insight.&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1499453"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="517818"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="520617"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2006 10:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417214#M200608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-27T10:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: ALV with variable columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417215#M200609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dnyanesh,&lt;/P&gt;&lt;P&gt;    If you know the no. of columns to be used in the ALV before hand then you can change the field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but if you dont know the no. of columns then you can create dynamic table.&lt;/P&gt;&lt;P&gt;eg:&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;Example:&lt;/P&gt;&lt;P&gt;*the content of itab will be fields of the new table&lt;/P&gt;&lt;P&gt;loop at itab1 into wa1.&lt;/P&gt;&lt;P&gt;  Gs_FIELDCAT-TABNAME     = 'itab2'.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-FIELDNAME = wa1-packid.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-OUTPUTLEN = 2.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-KEY         = space.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-SELTEXT_L = wa1-packid.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-COL_POS     =  1.&lt;/P&gt;&lt;P&gt;  GS_FIELDCAT-JUST        = 'L'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  APPEND GS_FIELDCAT TO GT_FIELDCAT.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.&lt;/P&gt;&lt;P&gt;     MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.&lt;/P&gt;&lt;P&gt;     APPEND ls_fcat TO lt_fieldcat.&lt;/P&gt;&lt;P&gt;ENDLOOP.&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 it_fieldcatalog = lt_fieldcat&lt;/P&gt;&lt;P&gt;                      IMPORTING ep_table = t_output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; you can refer the following link also.&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="167116"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;P&gt;do get back if you need further clarification.&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>Tue, 27 Jun 2006 10:59:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-with-variable-columns/m-p/1417215#M200609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-27T10:59:10Z</dc:date>
    </item>
  </channel>
</rss>

