<?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 Table in ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407003#M1547540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field will be dispalyed with a blank value. Only this is possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Oct 2010 17:57:18 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2010-10-11T17:57:18Z</dc:date>
    <item>
      <title>Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407001#M1547538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it possible to call an ALV via ( class cl_salv or fm REUSE_ALV_GRID_DISPLAY) with a dynamic table?&lt;/P&gt;&lt;P&gt;This dynamic table has for example one fix column for the material number and dynamic colums for additional data. &lt;/P&gt;&lt;P&gt;One material has 1 additional column, the other material has two additional columns.&lt;/P&gt;&lt;P&gt;So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).&lt;/P&gt;&lt;P&gt;To build an itab which can handle this is possible i know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Oct 2010 15:51:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407001#M1547538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-11T15:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407002#M1547539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Yes it is possible,&lt;/P&gt;&lt;P&gt; you can create a dynamic internal table using cl_salv_table_create=&amp;gt;create_dynamic_table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anmol.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Oct 2010 15:58:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407002#M1547539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-11T15:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407003#M1547540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field will be dispalyed with a blank value. Only this is possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Oct 2010 17:57:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407003#M1547540</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-10-11T17:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407004#M1547541</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;i can not find class cl_salv_table_create in my system. Is there a spelling error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 06:46:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407004#M1547541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-12T06:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407005#M1547542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is CL_ALV_TABLE_CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bala Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 06:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407005#M1547542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-12T06:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407006#M1547543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Benjamin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you already found a solution for this, but if not (or for others looking for a solution), here is a sample program that creates, fills, and displays a dynamic table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report ztpar_dynamic_salv.

parameters: p_colnr type i default 3.

start-of-selection.
  perform execute.

form execute.

  data t_table type ref to data.

** create dynamic table
  perform create_dynamic_table using p_colnr
                            changing t_table.

** fill dynamic table
  perform fill_dynamic_table changing t_table.

** display dynamic table
  perform display_table using t_table.

endform.

form create_dynamic_table using colnr type i
                       changing table type ref to data.
  data: lo_field type ref to cl_abap_typedescr,
        lo_struct type ref to cl_abap_structdescr,
        lo_table type ref to cl_abap_tabledescr.
  data: t_comp type cl_abap_structdescr=&amp;gt;component_table,
        l_comp like line of t_comp.

  lo_field ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'CHAR10' ).
  do p_colnr times.
    move sy-index to l_comp-name.
    concatenate 'COLUMN' l_comp-name into l_comp-name.
    condense l_comp-name no-gaps.
    l_comp-type ?= lo_field.
    append l_comp to t_comp.
  enddo.

  lo_struct = cl_abap_structdescr=&amp;gt;create( p_components = t_comp p_strict = space ).
  lo_table = cl_abap_tabledescr=&amp;gt;create( lo_struct ).

  create data table type handle lo_table.
endform.

form fill_dynamic_table changing table type ref to data.
  field-symbols: &amp;lt;fs_table&amp;gt; type standard table,
                 &amp;lt;fs_line&amp;gt; type any,
                 &amp;lt;fs_field&amp;gt; type any.

  assign table-&amp;gt;* to &amp;lt;fs_table&amp;gt;.
  do 5 times.
    append initial line to &amp;lt;fs_table&amp;gt; assigning &amp;lt;fs_line&amp;gt;.
    do.
      assign component sy-index of structure &amp;lt;fs_line&amp;gt; to &amp;lt;fs_field&amp;gt;.
      if sy-subrc ne 0.
        exit.
      endif.
      &amp;lt;fs_field&amp;gt; = sy-index.
    enddo.
  enddo.
endform.

form display_table using i_table type ref to data.
  data lo_alv type ref to cl_salv_table.

  field-symbols &amp;lt;fs_tab&amp;gt; type any table.

  assign i_table-&amp;gt;* to &amp;lt;fs_tab&amp;gt;.
  try.
      cl_salv_table=&amp;gt;factory(
        importing
          r_salv_table = lo_alv
        changing
          t_table      = &amp;lt;fs_tab&amp;gt; ).
    catch cx_salv_msg.
      message 'Cannot display result!' type 'E'.
  endtry.

  lo_alv-&amp;gt;display( ).
endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Tanguy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 12:43:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-in-alv/m-p/7407006#M1547543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T12:43:05Z</dc:date>
    </item>
  </channel>
</rss>

