<?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 Declaring multiple dynamic internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537369#M1562075</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'm trying to use function REUSE_ALV_BLOCK_LIST_APPEND to show multiple ALV's on a page. I however need to run this function multiple times, each time with a different internal tables (the number of these tables is never the same). What is the best method to declare a varying amount of internal tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've searched the forum but couldn't find what I wanted. If you could point me to a link or in the right direction that would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
  EXPORTING
    it_fieldcat                = it_alvfc
    is_layout                  = gp_layout
    i_tabname                  = 'GT_GETDATA'
    it_events                  = gt_alv_event
  TABLES
    t_outtab                   = &amp;lt;dyn_table&amp;gt;
  EXCEPTIONS
    program_error              = 1
    maximum_of_appends_reached = 2
    OTHERS                     = 3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First run of FM: &amp;lt;dyn_table&amp;gt; refers to certain data&lt;/P&gt;&lt;P&gt;second run:  &amp;lt;dyn_table&amp;gt; refers to new data&lt;/P&gt;&lt;P&gt;third run &amp;lt;dyn_table&amp;gt; refers to different data again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Hin Lai on Dec 22, 2010 9:15 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Hin Lai on Dec 22, 2010 9:17 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Dec 2010 19:33:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-22T19:33:11Z</dc:date>
    <item>
      <title>Declaring multiple dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537369#M1562075</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'm trying to use function REUSE_ALV_BLOCK_LIST_APPEND to show multiple ALV's on a page. I however need to run this function multiple times, each time with a different internal tables (the number of these tables is never the same). What is the best method to declare a varying amount of internal tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've searched the forum but couldn't find what I wanted. If you could point me to a link or in the right direction that would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
  EXPORTING
    it_fieldcat                = it_alvfc
    is_layout                  = gp_layout
    i_tabname                  = 'GT_GETDATA'
    it_events                  = gt_alv_event
  TABLES
    t_outtab                   = &amp;lt;dyn_table&amp;gt;
  EXCEPTIONS
    program_error              = 1
    maximum_of_appends_reached = 2
    OTHERS                     = 3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First run of FM: &amp;lt;dyn_table&amp;gt; refers to certain data&lt;/P&gt;&lt;P&gt;second run:  &amp;lt;dyn_table&amp;gt; refers to new data&lt;/P&gt;&lt;P&gt;third run &amp;lt;dyn_table&amp;gt; refers to different data again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Hin Lai on Dec 22, 2010 9:15 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Hin Lai on Dec 22, 2010 9:17 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 19:33:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537369#M1562075</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-22T19:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring multiple dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537370#M1562076</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 would suggest you to follow as below.  Here you need to create dynamic internal table names in a pattern like &lt;/P&gt;&lt;P&gt;&amp;lt;dyn_table_1&amp;gt;, &amp;lt;dyn_table_2&amp;gt; and &amp;lt;dyn_table_3&amp;gt;.........etc. One more i didnpt check for syntax errors for below code.&lt;/P&gt;&lt;P&gt;I am pointing you to provide a possibility. I used this approach for condition type value search for any given codition type access sequense and context. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : L_TMPREF TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Determine how many table to show variable LV_NO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. DO LV_NO TIMES.&lt;/P&gt;&lt;P&gt;    concatenate '&amp;lt;dyn_table_' LV_NO '&amp;gt;' into LV_NAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CREATE DATA L_TMPREF LIKE (LV_NAME).&lt;/P&gt;&lt;P&gt;    ASSIGN L_TMPREF-&amp;gt;* TO &amp;lt;FS_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    it_fieldcat                = it_alvfc&lt;/P&gt;&lt;P&gt;    is_layout                  = gp_layout&lt;/P&gt;&lt;P&gt;    i_tabname                  = LV_NAME&lt;/P&gt;&lt;P&gt;    it_events                  = gt_alv_event&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    t_outtab                   = &amp;lt;FS_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    program_error              = 1&lt;/P&gt;&lt;P&gt;    maximum_of_appends_reached = 2&lt;/P&gt;&lt;P&gt;    OTHERS                     = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   ENDDO.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 21:58:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537370#M1562076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-22T21:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring multiple dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537371#M1562077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hin Lai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve that by using one temporary and one final FIELD-SYMBOL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose, you have fixed scenarios and countings of ITAB, then, you can make use of CASE-ENDCASE otherwise IF-ENDIF would be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, Just based on business condition, pass your ITAB in temporary Field-Symbol and finally assign those values in Final Field-Symbol within the Condition-Block made by IF / CASE. Do remember to flush the values out before assigning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This Final Field-Symbol can be passed in FM for ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's it. Hope this would serve your purpose.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Kumar Saurav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 05:59:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537371#M1562077</guid>
      <dc:creator>former_member186491</dc:creator>
      <dc:date>2010-12-23T05:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring multiple dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537372#M1562078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kumar Saurav: I dont have fixed scenarios, I am able to find out how many internal tables I will need to declare dynamically though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas: I've tried your idea and have come up with this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: lv_dyn_tab  TYPE string,
        l_tmpref    TYPE REF TO data.
  FIELD-SYMBOLS: &amp;lt;fs1&amp;gt;, &amp;lt;fs2&amp;gt;, &amp;lt;fs3&amp;gt;.

LOOP AT gt_getdata.

    ASSIGN COMPONENT  'BLNCE'  OF STRUCTURE &amp;lt;dyn_wa&amp;gt; TO &amp;lt;fs1&amp;gt;.
    &amp;lt;fs1&amp;gt; =  gt_getdata-blnce.

    ASSIGN COMPONENT  'BELNR'  OF STRUCTURE &amp;lt;dyn_wa&amp;gt; TO &amp;lt;fs2&amp;gt;.
    &amp;lt;fs2&amp;gt; =  gt_getdata-belnr.

*   Append to the dynamic internal table
    CONCATENATE '&amp;lt;dyn_table_' gv_grp_counter '&amp;gt;' INTO lv_dyn_tab.
    CREATE DATA l_tmpref LIKE lv_dyn_tab.
    APPEND &amp;lt;dyn_wa&amp;gt; TO l_tmpref.

  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem here is that I cannot append to l_tmpref since it is not an internal table. How can I get around this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other section of my code is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DO lv_no TIMES.

*   Create dynamic internal table and assign to FS
    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
      EXPORTING
        it_fieldcatalog = it_fldcat
      IMPORTING
        ep_table        = new_table.

    ASSIGN new_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.

*   Create dynamic work area and assign to FS
    CREATE DATA new_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
    ASSIGN new_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.

  ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How could I make this work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 18:47:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537372#M1562078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-23T18:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring multiple dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537373#M1562079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I  am still searching for an answer if anyone has any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jan 2011 14:01:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-multiple-dynamic-internal-tables/m-p/7537373#M1562079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-04T14:01:47Z</dc:date>
    </item>
  </channel>
</rss>

