<?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 table -- urgent in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968795#M397692</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shilpa,&lt;/P&gt;&lt;P&gt;Here is the code to dynamically create an Internal Table :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION zcreate_internal_table.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(I_TABNAME) TYPE  DD02L-TABNAME&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     REFERENCE(EP_TABLE) TYPE REF TO  DATA&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;  TYPE-POOLS : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA : lv_fcat       TYPE slis_t_fieldcat_alv,&lt;/P&gt;&lt;P&gt;             lt_fieldcat   TYPE lvc_t_fcat,&lt;/P&gt;&lt;P&gt;             ls_fieldcat  TYPE slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;             ls_fcat       TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;fs_table&amp;gt; TYPE table.&lt;/P&gt;&lt;P&gt;&lt;/P&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  = i_tabname&lt;/P&gt;&lt;P&gt;       CHANGING&lt;/P&gt;&lt;P&gt;            ct_fieldcat            = lv_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT lv_fcat INTO ls_fieldcat.&lt;/P&gt;&lt;P&gt;    MOVE-CORRESPONDING ls_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;You can add new fields for your dynamic table here. This can be done by &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;appending new entries to the Field Catalogue. After appneding the new entries &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the field catalogue, call the following method and create the new internal table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&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 it_fieldcatalog = lt_fieldcat&lt;/P&gt;&lt;P&gt;                     IMPORTING ep_table = ep_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Use the following statement after the calling of the above function to&lt;/P&gt;&lt;P&gt;*get the structure of the internal table of the structure similar to the&lt;/P&gt;&lt;P&gt;*passed table name :-&lt;/P&gt;&lt;P&gt; ASSIGN ep_table-&amp;gt;* to &amp;lt;fs_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The above solution creates a new internal table. &lt;/P&gt;&lt;P&gt;           Please reward points if you are satisfied with the solution.&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt;Also, i can help you with the code for your case, but i need a clear understanding of your requirements. Can you, please put your requirement in a step by step manner, if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Feb 2007 11:44:56 GMT</pubDate>
    <dc:creator>raviprakash</dc:creator>
    <dc:date>2007-02-19T11:44:56Z</dc:date>
    <item>
      <title>dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968787#M397684</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 want to create a dynamic internal table, my exact requirement is,&lt;/P&gt;&lt;P&gt;      on selection screen i have date field as select option, if some one enteres 1-05-2006 to 31-10-2006 then i have to display months from may to oct , i have a internal table where i have data for all months,also tell how to transfer data from this internal table to dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if some can post the code then that will be extremly helpfule.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:31:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968787#M397684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968788#M397685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi you can create dynamic internal tables using&lt;/P&gt;&lt;P&gt;CL_ALV_TABLE_CREATE&lt;/P&gt;&lt;P&gt;And for the above issue.&lt;/P&gt;&lt;P&gt;you can create a simple internal table and select the data using entires made by user.&lt;/P&gt;&lt;P&gt;you have specify start date and end date (range) in you select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oncwe the data is selected in simple internal table just sort it and display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;P&gt;Award helpful answers &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:34:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968788#M397685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968789#M397686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shilpa,&lt;/P&gt;&lt;P&gt;you can use field-symbol for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt; DATA:  dref TYPE REF to data.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_tname&amp;gt;, "type any.&lt;/P&gt;&lt;P&gt;                &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN itab TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref TYPE (&amp;lt;FS&amp;gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign dref-&amp;gt;* to &amp;lt;fs_tname&amp;gt; .&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;Deepak .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968789#M397686</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968790#M397687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;chk this link &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm" target="test_blank"&gt;http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:40:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968790#M397687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968791#M397688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sundeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                          Can u send a code , with example of dynamic internal table usage.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards&lt;/P&gt;&lt;P&gt;Bhaskar Rao.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:41:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968791#M397688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968792#M397689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shilpa,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the below thread..... for a sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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="797696"&gt;&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:41:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968792#M397689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968793#M397690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code to create the dynamic internal table is this  - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

parameter p_table type tabname.

field-symbols &amp;lt;tab&amp;gt; type table.
field-symbols &amp;lt;tab1&amp;gt; type any.


types: begin of itab,
      t_name type tabname,
      t_ref type ref to data,
      end of itab.

data itab1 type table of itab with non-unique key t_name.

perform fetch_data using p_table.
perform print_table using p_table.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  fetch_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_P_TABLE  text
*----------------------------------------------------------------------*
FORM fetch_data  USING P_TABLE1 type tabname.

data itab2 type itab.
itab2-t_name = p_table1.

create data itab2-t_ref type table of (itab2-t_name) .

assign itab2-t_ref-&amp;gt;* to &amp;lt;tab&amp;gt;.

append itab2 to itab1.

select * from (p_table1) up to 25 rows into corresponding fields of table &amp;lt;tab&amp;gt;.

ENDFORM.                    " fetch_data
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  print_table
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_P_TABLE  text
*----------------------------------------------------------------------*
FORM print_table  USING P_TABLE1 type tabname.

DATA t_ref1 TYPE REF TO data.
DATA itab2 TYPE itab.

FIELD-SYMBOLS &amp;lt;field&amp;gt; TYPE ANY.

READ TABLE itab1 INTO itab2 WITH KEY t_name = p_table1.

ASSIGN itab2-t_ref-&amp;gt;* TO &amp;lt;tab&amp;gt;.

CREATE DATA t_ref1 LIKE LINE OF &amp;lt;tab&amp;gt;.

ASSIGN t_ref1-&amp;gt;* TO &amp;lt;tab1&amp;gt;.

DO.
*READ TABLE &amp;lt;tab&amp;gt; ASSIGNING &amp;lt;tab1&amp;gt; INDEX 1.
READ TABLE &amp;lt;tab&amp;gt; ASSIGNING &amp;lt;tab1&amp;gt; INDEX SY-INDEX.
*WRITE:/ p_table1.
NEW-LINE.
IF sy-subrc &amp;lt;&amp;gt; 0.
EXIT.
ENDIF.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;tab1&amp;gt; TO &amp;lt;field&amp;gt;.
IF sy-subrc &amp;lt;&amp;gt; 0.
EXIT.
ENDIF.
WRITE: &amp;lt;field&amp;gt;,'    '.
ENDDO.
ENDDO.
ENDFORM.                    " print_table
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also u can use the below logic to find the month name from the dates in selection screen as follows  - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data : d1(8) value '20051215',
c1(2),
c2(10).
c1 = d1+3(2).

select ktx into x_ktx from T247 where spras = 'E'.

concatenate d1+6(2) x_ktx d1+0(4) into c2.
write c2.
or use FM - CONVERSION_EXIT_SDATE_OUTPUT

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:43:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968793#M397690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968794#M397691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gp_table      TYPE REF TO data.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;gt_table&amp;gt; TYPE table.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic intenal table to store the values&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 = gt_fieldcat&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      ep_table        = gp_table.&lt;/P&gt;&lt;P&gt;  ASSIGN gp_table-&amp;gt;* TO &amp;lt;gt_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM fill_int_table .&lt;/P&gt;&lt;P&gt;  DATA: l_col TYPE sy-index.&lt;/P&gt;&lt;P&gt;  DATA: ls_text(40) TYPE c.&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;ls_table&amp;gt;.&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;  ASSIGN LOCAL COPY OF INITIAL LINE OF &amp;lt;gt_table&amp;gt; TO &amp;lt;ls_table&amp;gt;.&lt;/P&gt;&lt;P&gt;  LOOP AT itabdown.&lt;/P&gt;&lt;P&gt;    LOOP AT itabdown-rslt INTO ls_text.&lt;/P&gt;&lt;P&gt;      l_col = l_col + 1.&lt;/P&gt;&lt;P&gt;      ASSIGN COMPONENT l_col OF STRUCTURE &amp;lt;ls_table&amp;gt; TO &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;      &amp;lt;l_field&amp;gt; = ls_text.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    APPEND &amp;lt;ls_table&amp;gt; TO &amp;lt;gt_table&amp;gt;.&lt;/P&gt;&lt;P&gt;    l_col = 0.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " fill_int_table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:44:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968794#M397691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968795#M397692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shilpa,&lt;/P&gt;&lt;P&gt;Here is the code to dynamically create an Internal Table :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION zcreate_internal_table.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(I_TABNAME) TYPE  DD02L-TABNAME&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     REFERENCE(EP_TABLE) TYPE REF TO  DATA&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;  TYPE-POOLS : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA : lv_fcat       TYPE slis_t_fieldcat_alv,&lt;/P&gt;&lt;P&gt;             lt_fieldcat   TYPE lvc_t_fcat,&lt;/P&gt;&lt;P&gt;             ls_fieldcat  TYPE slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;             ls_fcat       TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;fs_table&amp;gt; TYPE table.&lt;/P&gt;&lt;P&gt;&lt;/P&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  = i_tabname&lt;/P&gt;&lt;P&gt;       CHANGING&lt;/P&gt;&lt;P&gt;            ct_fieldcat            = lv_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT lv_fcat INTO ls_fieldcat.&lt;/P&gt;&lt;P&gt;    MOVE-CORRESPONDING ls_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;You can add new fields for your dynamic table here. This can be done by &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;appending new entries to the Field Catalogue. After appneding the new entries &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the field catalogue, call the following method and create the new internal table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&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 it_fieldcatalog = lt_fieldcat&lt;/P&gt;&lt;P&gt;                     IMPORTING ep_table = ep_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Use the following statement after the calling of the above function to&lt;/P&gt;&lt;P&gt;*get the structure of the internal table of the structure similar to the&lt;/P&gt;&lt;P&gt;*passed table name :-&lt;/P&gt;&lt;P&gt; ASSIGN ep_table-&amp;gt;* to &amp;lt;fs_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The above solution creates a new internal table. &lt;/P&gt;&lt;P&gt;           Please reward points if you are satisfied with the solution.&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt;Also, i can help you with the code for your case, but i need a clear understanding of your requirements. Can you, please put your requirement in a step by step manner, if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:44:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968795#M397692</guid>
      <dc:creator>raviprakash</dc:creator>
      <dc:date>2007-02-19T11:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968796#M397693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;SORT itab by date.
DESCRIBE LINES OF TABLE itab v_cnt.
READ TABLE itab WITH INDEX 1.
IF sy-subrc = 0.
v_month_start = itab-date+4(2).
ENDIF.
LOOP AT ITAB FROM v_cnt TO v_cnt. 
v_month_end  = itab-date+4(2).
CLEAR itab.
ENDLOOP.

CLEAR v_month.
v_month = v_month_start.
DO.
IF v_month &amp;lt;= v_month_end.
CASE v_month.
WHEN '01'.
  WRITE:/  'January'
WHEN '02'.
 WRITE:/  'February'.
WHEN '03'.
  WRITE:/  'March'.
......
ENDCASE.
v_month = v_month_start + 1.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this way u can write the header, then display the data from the itab only with in the date range by restricting in the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also refer this for ALV&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Assumption: Structure of the dynamic table should be known before hand.(At least in this program, I am not sure how to do it otherwise. Probably the FIELD-SYMBOL stud programmers can help us out).&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report  ytest.
data: lt_fieldcatalog type lvc_t_fcat.
data: ls_fieldcatalog type lvc_s_fcat.
field-symbols: &amp;lt;fs_data&amp;gt; type ref to data.
field-symbols: &amp;lt;fs_1&amp;gt;.
field-symbols: &amp;lt;fs_2&amp;gt; type any table.
field-symbols: &amp;lt;fs_3&amp;gt; type ypoll.


data: lt_data type ref to data.

assign lt_data to &amp;lt;fs_data&amp;gt;.

ls_fieldcatalog-fieldname = 'MANDT'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'POLLID'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'TEAM'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'INITIATOR'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'DESCRIPTION'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'APPROVED'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'INITIATED_DATE'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'END_DATE'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.

ls_fieldcatalog-fieldname = 'WINNER'.
ls_fieldcatalog-tabname   = 'LT_TAB'.
append ls_fieldcatalog to lt_fieldcatalog.


call method cl_alv_table_create=&amp;gt;create_dynamic_table
  exporting
    it_fieldcatalog           = lt_fieldcatalog
  importing
    ep_table                  = &amp;lt;fs_data&amp;gt;
  exceptions
    generate_subpool_dir_full = 1
    others                    = 2
        .
if sy-subrc &amp;lt;&amp;gt; 0.
endif.

assign &amp;lt;fs_data&amp;gt;-&amp;gt;* to &amp;lt;fs_1&amp;gt;.
assign &amp;lt;fs_1&amp;gt; to &amp;lt;fs_2&amp;gt;.

loop at &amp;lt;fs_2&amp;gt; assigning &amp;lt;fs_3&amp;gt;.
  write: &amp;lt;fs_3&amp;gt;-pollid.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Judith Jessie Selvi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:45:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968796#M397693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T11:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968797#M397694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://www.saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm" target="test_blank"&gt;http://www.saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 11:50:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968797#M397694</guid>
      <dc:creator>SantoshKallem</dc:creator>
      <dc:date>2007-02-19T11:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968798#M397695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Ravi,&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    Thanxs for reply, but still i am not geting how to use it for my requirement, being new to field symbols.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt; If possible please help me with my code, my requirement is, I am having an simple internal table in which i have all the data and i am using this internal table for alv display and i have provided an download button for alv, when user clicks on donload button, an excel file gets downloaded which has all the columns of internal table irrespective of the what user have entered on selection screen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 13:30:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968798#M397695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T13:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968799#M397696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so you just want to make a selection from a single table and present that in an alv ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why have you programmed a download button. standard alv layout already provides a download button to excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I guess there is some confusement since you ask for dynamic tables which is quite different from just making an selection for a period.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you just look at se16n and give you're tablename you can already do what you need and want I guess  ? right ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 14:19:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968799#M397696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968800#M397697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the Rtti, i.e. the classes and subclasses of cl_abap_typedescr. From release 6.40 on you have the method 'create', i.e. if you use the method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cl_abap_tabledescr=&amp;gt;create &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can create dynamically an internal table. Search in &lt;A href="http://help.sap.com/" target="test_blank"&gt;http://help.sap.com/&lt;/A&gt; for 'RTTI'  or 'cl_abap_typedescr' in order to get more detailed information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 20:30:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968800#M397697</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T20:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968801#M397698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;he Shilpa how are you doing, it takes quite long for you to reply to a request posted as urgent ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 14:09:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968801#M397698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T14:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table -- urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968802#M397699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shilpa,&lt;/P&gt;&lt;P&gt;  Here is the algorithm for creating dynamic internal 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;Example:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the content of itab will be fields of the new table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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; &lt;/P&gt;&lt;P&gt;    MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    APPEND ls_fcat TO lt_fieldcat.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &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; &lt;/P&gt;&lt;P&gt;                     IMPORTING ep_table = t_output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once you create the table then you can just transfer the data from one table to another&lt;/P&gt;&lt;P&gt;INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO itab2 [INDEX idx3]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;checkf1 for insert statement&lt;/P&gt;&lt;P&gt;hope this helps.&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>Mon, 26 Feb 2007 14:24:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-urgent/m-p/1968802#M397699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T14:24:45Z</dc:date>
    </item>
  </channel>
</rss>

