<?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 Populating Internal Table whose name is determined dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748442#M1113705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a peculiar requirement for splitting the data retrieved in sets of 10000 records. For e.g., if there are say 21000 records from the Database. I populate 3 internal tables: 2 tables with 10000 entries each &amp;amp; 1 table with 1000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you guys suggest something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: All the internal tables have the same structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2008 10:27:29 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2008-11-14T10:27:29Z</dc:date>
    <item>
      <title>Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748442#M1113705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a peculiar requirement for splitting the data retrieved in sets of 10000 records. For e.g., if there are say 21000 records from the Database. I populate 3 internal tables: 2 tables with 10000 entries each &amp;amp; 1 table with 1000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you guys suggest something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: All the internal tables have the same structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 10:27:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748442#M1113705</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2008-11-14T10:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748443#M1113706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;let ITAB be the main table with 21000 recored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB.&lt;/P&gt;&lt;P&gt;if sy-tabix &amp;lt; 10000.&lt;/P&gt;&lt;P&gt;append itab to itab1.&lt;/P&gt;&lt;P&gt;elseif sy-tabix &amp;gt; 10000 and sy-tabix &amp;lt;= 20000.&lt;/P&gt;&lt;P&gt;append itab to itab2.&lt;/P&gt;&lt;P&gt;elseif sy-tabix &amp;gt; 20000.&lt;/P&gt;&lt;P&gt;append itab to itab3.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 10:30:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748443#M1113706</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-14T10:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748444#M1113707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see that i have said 21000 is an example. The main internal table may contain any amount of data. I think we can decide the no of internal tables @ run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 10:34:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748444#M1113707</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2008-11-14T10:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748445#M1113708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have a look at this code....&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: dref TYPE REF TO data,
      dref1 TYPE REF TO data,
      BEGIN OF tab_store OCCURS 0,         "&amp;lt;----table to store all ur final tables....
        no TYPE i,
        tab TYPE REF TO data,
      END OF tab_store,
      tabix type sy-tabix,
      no TYPE i.

FIELD-SYMBOLS: &amp;lt;tab&amp;gt; TYPE STANDARD TABLE,
               &amp;lt;fs&amp;gt; LIKE LINE OF tab_store.


  CREATE DATA dref1 LIKE LINE OF tab_store.
  ASSIGN dref1-&amp;gt;* TO &amp;lt;fs&amp;gt;.

  LOOP AT it_final INTO wa_final.                "&amp;lt;----breaking up ur final table
    APPEND wa_final TO it_final1.
    tabix = tabix + 1.
    IF tabix = 10000.                      "Checking tabix for 10000 records
      no = no + 1.
      CREATE DATA dref TYPE STANDARD TABLE OF t_final.               "Creating small tables
      ASSIGN dref-&amp;gt;* TO &amp;lt;tab&amp;gt;.
      APPEND LINES OF it_final1 TO &amp;lt;tab&amp;gt;.             "Copying ur small tables....
      &amp;lt;fs&amp;gt;-tab = dref.                  "Storing u small tables....
      &amp;lt;fs&amp;gt;-no = no.
      APPEND &amp;lt;fs&amp;gt; TO tab_store.        "&amp;lt;------All final tables in this table....
      CLEAR tabix.
    ENDAT.
    CLEAR:wa_final,
           tabix.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 10:42:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748445#M1113708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-14T10:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748446#M1113709</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;First get all the Data into a Single Internal Table itab...Then use Describe Statement and if the Table Rows are more that 10000, then declare one more table there only and Transfer the Records from 10001 to 20000, and so on for the records after 20000, if exists....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select *&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-dbcnt &amp;gt; 10000 and  sy-dbcnt &amp;lt;= 20000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: itab1 like standard table of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab from 10001 to 20000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab to itab1.&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;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-dbcnt &amp;gt; 10000 and  sy-dbcnt &amp;gt; 20000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: itab2 like standard table of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab from 20001 to sy-dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab to itab3.&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;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 10:57:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748446#M1113709</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-14T10:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748447#M1113710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hello Guys,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; I have a peculiar requirement for splitting the data retrieved in sets of 10000 records. For e.g., if there are say 21000 records from the Database. I populate 3 internal tables: 2 tables with 10000 entries each &amp;amp; 1 table with 1000 records.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Can you guys suggest something?&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; PS: All the internal tables have the same structure&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Rgds,&lt;/P&gt;&lt;P&gt;&amp;gt; Suhas&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Suhas, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a code that will exactly do what you have asked for:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Data Declarations.....................................................
TYPES: BEGIN OF tt_dref,
        dref        TYPE REF TO data,
       END OF tt_dref.

DATA: gt_dref       TYPE TABLE OF tt_dref,
      gs_dref       TYPE tt_dref,
      gt_tab        TYPE TABLE OF {DATABASE},
      gt_tab_temp   TYPE TABLE OF {DATABASE},
      gv_count      TYPE i,
      gs_tab        LIKE LINE OF gt_tab.

CONSTANTS: gc_limit TYPE i VALUE '10000'.

FIELD-SYMBOLS &amp;lt;gfs_tab&amp;gt; TYPE table.
* End of Data Declarations..............................................


SELECT * FROM hrp{DATABASE} INTO TABLE gt_tab.

*Loop at the bigger table and break it into smaller blocks
*specified by the GC_LIMIT constant.
LOOP AT gt_tab INTO gs_tab.

  APPEND gs_tab TO gt_tab_temp.
  ADD 1 TO gv_count.

  IF gv_count EQ gc_limit.

    CREATE DATA gs_dref-dref TYPE STANDARD TABLE OF ('{DATABASE}').
    APPEND gs_dref TO gt_dref.
    ASSIGN gs_dref-dref-&amp;gt;* TO &amp;lt;gfs_tab&amp;gt;.
    &amp;lt;gfs_tab&amp;gt; = gt_tab_temp.

    CLEAR: gv_count, gt_tab_temp, gs_dref.

  ENDIF.

ENDLOOP.

*Check whether the Data Reference table has the values
*for each of the packages.
LOOP AT gt_dref INTO gs_dref.

  ASSIGN gs_dref-dref-&amp;gt;* TO &amp;lt;gfs_tab&amp;gt;.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Replace &lt;SPAN __jive_macro_name="DATABASE"&gt;&lt;/SPAN&gt; by the name of your database which has 21000 entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 13:48:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748447#M1113710</guid>
      <dc:creator>raviprakash</dc:creator>
      <dc:date>2008-11-14T13:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Internal Table whose name is determined dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748448#M1113711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas Saha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Here is the explanation to my reply to your post. Since we need to create the internal tables dynamically at the runtime, we would require an array(table) which can keep the pointers to the respective internal tables created dynamically. Thus in the first part of the report, i declare my own type to keep the pointers to the dynmic internal tables:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF tt_dref,
        dref        TYPE REF TO data,
       END OF tt_dref.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since in SE38 editor environment we cannot create nested structures for internal tables unlike in SE11(for dictionary tables), we can achieve this using the "Data Reference" variables. So whenever we create a new table and fill it, we save the pointer to it in our "Data Reference" table, in this case "gt_dref ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later when we require to retrieve the information out of this "Data Reference" table, we loop at it and then get the values in a Field Symbol, by using the syntax ASSIGN gs_dref-dref-&amp;gt;* TO &amp;lt;gfs_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus we had to create a Field Symbol of type Table for the same. Let me know incase you require any assistance in understanding the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2008 14:01:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-internal-table-whose-name-is-determined-dynamically/m-p/4748448#M1113711</guid>
      <dc:creator>raviprakash</dc:creator>
      <dc:date>2008-11-14T14:01:21Z</dc:date>
    </item>
  </channel>
</rss>

