<?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: Create internal table dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866823#M1476501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some more code line where we create an itab with dynamic numer of columns (see the loop)&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( lv_time ).
  &amp;lt;component&amp;gt;-name = mc_colname_prof_time.
* value columns
  lr_data = get_ref_2_t_column( ).
  ASSIGN lr_data-&amp;gt;* TO &amp;lt;table&amp;gt;.
  LOOP AT &amp;lt;table&amp;gt; ASSIGNING &amp;lt;any&amp;gt;.
    APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
    &amp;lt;component&amp;gt;-type ?=
      cl_abap_datadescr=&amp;gt;describe_by_data( lv_prof_value ).
    &amp;lt;component&amp;gt;-name = get_colname_4_column( &amp;lt;any&amp;gt; ).
  ENDLOOP.
* description for single record
  lo_structdescr   ?= cl_abap_structdescr=&amp;gt;create( lt_components ).
* description for table
  lo_tdescr        = cl_abap_tabledescr=&amp;gt;create( lo_structdescr ).
* create table object
  CREATE DATA rr_table TYPE HANDLE lo_tdescr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Later we display it using SALV&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
    lr_alvtab       TYPE REF TO data.
    lr_alvtab = get_data( ).
    salv_display( lr_alvtab ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;METHOD salv_display.
* MO_SALV	Instance Attribute	Private	Type Ref To	CL_SALV_TABLE
  FIELD-SYMBOLS:
    &amp;lt;alvtab&amp;gt;       TYPE table.
  DATA:
    lo_container   TYPE REF TO cl_gui_container.
  lo_container ?= get_container( ).

  ASSIGN ir_table-&amp;gt;* TO &amp;lt;alvtab&amp;gt;.
  TRY.
      cl_salv_table=&amp;gt;factory(
       EXPORTING
         list_display    = if_salv_c_bool_sap=&amp;gt;false
         r_container     = lo_container
       IMPORTING
          r_salv_table   = mo_salv
        CHANGING
          t_table        = &amp;lt;alvtab&amp;gt; ).
    CATCH cx_salv_msg.                                  "#EC NO_HANDLER
  ENDTRY.
* set the columns headers according to selected function
  set_column_headers( ) .
  set_salv_functions( ).
  mo_salv-&amp;gt;display( ).
  set_layout_properties( ) .
ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try this way, see CL_SALV_TABLE blogs, Rich Heilman created good intro.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 May 2010 12:52:46 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2010-05-06T12:52:46Z</dc:date>
    <item>
      <title>Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866815#M1476493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to create an internal table based on the contents of internal table. For example contents of itab is fieldname, fieldtext and I need to create internal table dynamically from these fields.&lt;/P&gt;&lt;P&gt;Please advice me !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 08:01:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866815#M1476493</guid>
      <dc:creator>stefan_kolev4</dc:creator>
      <dc:date>2010-05-06T08:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866816#M1476494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;This program creates internal table dynamically and sort it too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zreport_SORT.

parameters:
  p_f1(15) obligatory,
  p_f2(15) obligatory,
  p_f3(15) obligatory,
  p_table(15).

data:
  w_tab type ref to data,
  fs_tab type ref to data,
  w_flag,
  w_count type i.


create data w_tab type table of  (p_table) .
create data fs_tab type (p_table).

data:
  t_tab type table of spfli,
  fs_tab1 like line of t_tab.

field-symbols:
  &amp;lt;fs&amp;gt; type any table,
  &amp;lt;fs1&amp;gt; type any,
  &amp;lt;fs2&amp;gt; type any,
  &amp;lt;fs3&amp;gt; type any,
  &amp;lt;fs4&amp;gt; type any.

at selection-screen.

select count(*)
  from dd03l
  into w_count
 where tabname eq p_table
   and fieldname eq p_f1.
if w_count eq 0.
  w_flag = 'Y'.
 endif.
select count(*)
  from dd03l
  into w_count
 where tabname eq p_table
   and fieldname eq p_f2.

if w_count eq 0.
  w_flag = 'Y'.
 endif.

select count(*)
  from dd03l
  into w_count
 where tabname eq p_table
   and fieldname eq p_f3.

if w_count eq 0.
  w_flag = 'Y'.
 endif.
if w_flag eq 'Y'.
 clear w_flag.
 Message 'Incorrect field name' type 'E'.
endif.

start-of-selection.
assign w_tab-&amp;gt;* to &amp;lt;fs&amp;gt;.
assign fs_tab-&amp;gt;* to &amp;lt;fs1&amp;gt;.

  select *
    from (p_table)
    into corresponding fields of
   table &amp;lt;fs&amp;gt; up to 10 rows.
   sort &amp;lt;fs&amp;gt; by (p_f1) ascending (p_f2) ascending (p_f3) ascending.

assign component p_f1 of structure &amp;lt;fs1&amp;gt; to &amp;lt;fs2&amp;gt;.
assign component p_f2 of structure &amp;lt;fs1&amp;gt; to &amp;lt;fs3&amp;gt;.
assign component p_f3 of structure &amp;lt;fs1&amp;gt; to &amp;lt;fs4&amp;gt;.


  loop at &amp;lt;fs&amp;gt; into &amp;lt;fs1&amp;gt;.
  write:/ &amp;lt;fs2&amp;gt;,
          &amp;lt;fs3&amp;gt;,
          &amp;lt;fs4&amp;gt;.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards and Best wishes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 08:06:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866816#M1476494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-06T08:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866817#M1476495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: itab TYPE STANDARD TABLE OF &amp;lt;&amp;lt;tablename&amp;gt;&amp;gt;, 
              wa LIKE LINE OF itab. 

DATA: fieldname(120) TYPE c, 
            fieldtext LIKE TABLE OF fieldname(120). 

START-OF-SELECTION. 
fieldname = ' ABCD  XXXX'. 
fieldname = ' EFGH '. 
 APPEND fieldname TO fieldtext. 

SELECT DISTINCT (fieldname) 
       INTO CORRESPONDING FIELDS OF TABLE itab 
            FROM &amp;lt;tablename&amp;gt;. 

IF sy-subrc EQ 0. 
  LOOP AT itab INTO wa. 
      WRITE: / wa-ABCD, wa-XXXX. 
       WRITE :/ wa-EFGH. 
  ENDLOOP. 
ENDIF&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 08:13:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866817#M1476495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-06T08:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866818#M1476496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Probably I wasn't clear. I'm sorry. The idead is as follows: I have an internal table and it have one field for ex. 'fld'. I have 3 rows with contents for ex.&lt;/P&gt;&lt;P&gt;1 - ClientID&lt;/P&gt;&lt;P&gt;2 - Name1&lt;/P&gt;&lt;P&gt;3 - Name2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd lie to create internal table dynamically with structure / fields / based on the contents of internal table mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 08:52:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866818#M1476496</guid>
      <dc:creator>stefan_kolev4</dc:creator>
      <dc:date>2010-05-06T08:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866819#M1476497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can do it this way.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first fill the fieldcatalog by those fieldnames giving the data type, fieldname and stuff... which ever are required by you....&lt;/P&gt;&lt;P&gt;and then pass this field catalog as mentioned below....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Creates the internal table dynamically with respect to the
* field catalog prepared in the above steps...
DATA: mr_tot_cap_res_tab TYPE REF TO data,
         mt_fcat TYPE lvc_t_fcat.
" fill the field catalog.... here..........
    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
      EXPORTING
        it_fieldcatalog = mt_fcat
      IMPORTING
        ep_table        = mr_tot_cap_res_tab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 08:59:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866819#M1476497</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-06T08:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866820#M1476498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please avoid &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method uses statement GENERATE SUBROUTINE POOL which is limited to just a couple of calls in one LUW. Furthermore it creates an (unwanted) database COMMIT because the generated code is stored in the database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this factory method to create a range table. Note: For every field you should use an existing DDIC Data element.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;METHOD FACTORY.
  DATA:
    lv_sign        TYPE tvarv_sign,
    lv_opti        TYPE tvarv_opti,
    lt_components  TYPE cl_abap_structdescr=&amp;gt;component_table,
    lo_range_descr TYPE REF TO cl_abap_structdescr,
    lo_tdescr      TYPE REF TO cl_abap_tabledescr.

  FIELD-SYMBOLS:
    &amp;lt;component&amp;gt;   TYPE LINE OF abap_component_tab,
    &amp;lt;range_tab&amp;gt;   TYPE STANDARD TABLE..
  APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( lv_sign ).
  &amp;lt;component&amp;gt;-name = 'SIGN'.
  APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( lv_opti ).
  &amp;lt;component&amp;gt;-name = 'OPTION'.
  APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( iv_any ).
  &amp;lt;component&amp;gt;-name = 'LOW'.
  APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( iv_any ).
  &amp;lt;component&amp;gt;-name = 'HIGH'.
  lo_range_descr   ?= cl_abap_structdescr=&amp;gt;create( lt_components ).
  lo_tdescr        = cl_abap_tabledescr=&amp;gt;create( lo_range_descr ).
  CREATE OBJECT ro_range.
  CREATE DATA ro_range-&amp;gt;mr_rangetab TYPE HANDLE lo_tdescr.
ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the table, you can not avoid using field-symbols. You may proceed like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS:
  &amp;amp;LT;itab&amp;amp;GT; TYPE TABLE.   
ASSIGN  ro_range-&amp;gt;mr_rangetab-&amp;gt;* to &amp;amp;LT;itab&amp;amp;GT;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then the internal table may be used.&lt;/P&gt;&lt;P&gt;Because the structure is not known at compile time, you can not access the fields in the usual way as &amp;amp;LT;rec&amp;amp;GT;-&amp;amp;LT;fieldname&amp;amp;GT;. To get access, use ASSIGN COMPONENT &amp;amp;LT;fieldname&amp;amp;GT; OF STRUCTURE &amp;amp;LT;rec&amp;amp;GT; to &amp;amp;LT;any&amp;amp;GT;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you get stuck that way, feel free to ask.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Clemens Li on May 6, 2010 12:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 10:44:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866820#M1476498</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-05-06T10:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866821#M1476499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, one addition that did not fit in the character limit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If field-symbols are new to you, it will cause some trouble at the beginning. Just remember that a field-symbol is assigned to a data object and then is used the same way as the data object itself, the field-symbol is a replacement of the name of the original data object - anything you do with the field-symbol is done with the data object it is assigned to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 10:45:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866821#M1476499</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-05-06T10:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866822#M1476500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for help ! Very simple and understandable, but I'd like to clarify one more thing !&lt;/P&gt;&lt;P&gt;Ok in your example itab consist what I need, but it consist many other fields. I'd like to have let's say 'final' internal table which should have only those fields, which I already selected and later to show that internal table using ALV.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 11:16:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866822#M1476500</guid>
      <dc:creator>stefan_kolev4</dc:creator>
      <dc:date>2010-05-06T11:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create internal table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866823#M1476501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some more code line where we create an itab with dynamic numer of columns (see the loop)&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
  &amp;lt;component&amp;gt;-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( lv_time ).
  &amp;lt;component&amp;gt;-name = mc_colname_prof_time.
* value columns
  lr_data = get_ref_2_t_column( ).
  ASSIGN lr_data-&amp;gt;* TO &amp;lt;table&amp;gt;.
  LOOP AT &amp;lt;table&amp;gt; ASSIGNING &amp;lt;any&amp;gt;.
    APPEND INITIAL LINE TO lt_components ASSIGNING &amp;lt;component&amp;gt;.
    &amp;lt;component&amp;gt;-type ?=
      cl_abap_datadescr=&amp;gt;describe_by_data( lv_prof_value ).
    &amp;lt;component&amp;gt;-name = get_colname_4_column( &amp;lt;any&amp;gt; ).
  ENDLOOP.
* description for single record
  lo_structdescr   ?= cl_abap_structdescr=&amp;gt;create( lt_components ).
* description for table
  lo_tdescr        = cl_abap_tabledescr=&amp;gt;create( lo_structdescr ).
* create table object
  CREATE DATA rr_table TYPE HANDLE lo_tdescr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Later we display it using SALV&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
    lr_alvtab       TYPE REF TO data.
    lr_alvtab = get_data( ).
    salv_display( lr_alvtab ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;METHOD salv_display.
* MO_SALV	Instance Attribute	Private	Type Ref To	CL_SALV_TABLE
  FIELD-SYMBOLS:
    &amp;lt;alvtab&amp;gt;       TYPE table.
  DATA:
    lo_container   TYPE REF TO cl_gui_container.
  lo_container ?= get_container( ).

  ASSIGN ir_table-&amp;gt;* TO &amp;lt;alvtab&amp;gt;.
  TRY.
      cl_salv_table=&amp;gt;factory(
       EXPORTING
         list_display    = if_salv_c_bool_sap=&amp;gt;false
         r_container     = lo_container
       IMPORTING
          r_salv_table   = mo_salv
        CHANGING
          t_table        = &amp;lt;alvtab&amp;gt; ).
    CATCH cx_salv_msg.                                  "#EC NO_HANDLER
  ENDTRY.
* set the columns headers according to selected function
  set_column_headers( ) .
  set_salv_functions( ).
  mo_salv-&amp;gt;display( ).
  set_layout_properties( ) .
ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try this way, see CL_SALV_TABLE blogs, Rich Heilman created good intro.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 12:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-internal-table-dynamically/m-p/6866823#M1476501</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-05-06T12:52:46Z</dc:date>
    </item>
  </channel>
</rss>

