<?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 Dynamic Internal table Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786497#M1309170</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;                     My program is using this method frequently.But after few executions it is throwing excpetion of generate_subpool_dir_full . Since i am catching these exception so that error dump is gone but the result which should come in table t_newtable is not coming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gone through this method and found that upto 36 times,this method can be used.But my program can go upto any limit. I am really badly stuck at this point. Please help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = t_fldcat
    IMPORTING
      ep_table                  = t_newtable
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2009 09:56:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-01T09:56:15Z</dc:date>
    <item>
      <title>Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786497#M1309170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;                     My program is using this method frequently.But after few executions it is throwing excpetion of generate_subpool_dir_full . Since i am catching these exception so that error dump is gone but the result which should come in table t_newtable is not coming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gone through this method and found that upto 36 times,this method can be used.But my program can go upto any limit. I am really badly stuck at this point. Please help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = t_fldcat
    IMPORTING
      ep_table                  = t_newtable
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 09:56:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786497#M1309170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T09:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786498#M1309171</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;get try clearing the table before the method.&lt;/P&gt;&lt;P&gt;(or free the memory for table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Atul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 10:01:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786498#M1309171</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T10:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786499#M1309172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the Function module returns the same result everytime then u can do as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the following code create one more dummy internal table it_dummy which is of same type as t_newtable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = t_fldcat
    IMPORTING
      ep_table                  = it_dummy 
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

if it_dummy is not initial. 
 t_newtable[] = it_dummy[].
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sajid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 10:07:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786499#M1309172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T10:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786500#M1309173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the Function module returns the same result everytime then u can do as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the following code create one more dummy internal table it_dummy which is of same type as t_newtable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = t_fldcat
    IMPORTING
      ep_table                  = it_dummy 
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

if it_dummy is not initial. 
 t_newtable[] = it_dummy[].
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sajid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 10:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786500#M1309173</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T10:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786501#M1309174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Atul,&lt;/P&gt;&lt;P&gt;              I am clearing the table before the method.&lt;/P&gt;&lt;P&gt;i am writing this  'clear t_newtable' before the method execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 10:09:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786501#M1309174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T10:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786502#M1309175</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;You will not be able to generate table this way more that 36 times. This is beacuse internally this method create &lt;EM&gt;subroutine pool&lt;/EM&gt; and here is the restriction as in the system you can create 36 of such at max in one session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there is other way around, using real dynamic programming and achieving the same - RTTS.&lt;/P&gt;&lt;P&gt;Look at this code, it generates table and returns reference to it at the end. I placed it in loop to prove that you can create it any number of times.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPE-POOLS: abap.

DATA: gs_comp TYPE abap_componentdescr,
      gt_comp TYPE abap_component_tab.

"data references
DATA: r_type_struct TYPE REF TO cl_abap_structdescr,
      r_type_table  TYPE REF TO cl_abap_tabledescr,
      r_data_tab    TYPE REF TO data,
      r_data_str    TYPE REF TO data.

" 1. ------------ first create components of strcture
gs_comp-name = 'PERNR'.
gs_comp-type ?= cl_abap_elemdescr=&amp;gt;describe_by_name( 'PERSNO' ).
APPEND gs_comp TO gt_comp.

gs_comp-name = 'KOSTL'.
gs_comp-type ?= cl_abap_elemdescr=&amp;gt;describe_by_name( 'KOSTL' ).
APPEND gs_comp TO gt_comp.

gs_comp-name = 'BEGDA'.
gs_comp-type ?= cl_abap_elemdescr=&amp;gt;describe_by_name( 'BEGDA' ).
APPEND gs_comp TO gt_comp.

" 2. ------------- then create structure type based on these components
TRY.
    r_type_struct = cl_abap_structdescr=&amp;gt;create(
                              p_components = gt_comp ).
  CATCH cx_sy_struct_creation .
ENDTRY.

" 3. ------------- create table type
TRY.
    r_type_table = cl_abap_tabledescr=&amp;gt;create( r_type_struct ).

  CATCH cx_sy_table_creation .
ENDTRY.

" 4. -------------- create table based on RTTS types
DO 100 TIMES.
  CREATE DATA: r_data_tab TYPE HANDLE r_type_table,
               r_data_str TYPE HANDLE r_type_struct.
  WRITE: / 'table created ', sy-index, 'times'.
ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After that you can work with &lt;STRONG&gt;r_data_tab&lt;/STRONG&gt; as dynamic table (reference to it) and &lt;STRONG&gt;r_data_str&lt;/STRONG&gt; as work area for that table (reference).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 10:35:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786502#M1309175</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-07-01T10:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786503#M1309176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;                  Thanks for the reply..I am using SAP 4.7 and i think this approach is not permissible in it.Please suggest some approach which can be used in 4.7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 11:09:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786503#M1309176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-01T11:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786504#M1309177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, there is another way, but gives some restrictions. You need to create an RFC enabled function module. Inside, place your code&lt;/P&gt;&lt;P&gt;to create dynamic table, then call that FM using addtion STARTING NEW TASK.&lt;/P&gt;&lt;P&gt;- go to SE37 -&amp;gt; create FM -&amp;gt; in &lt;EM&gt;Attributes&lt;/EM&gt; tab select &lt;EM&gt;Remote Enabled Module&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;- go to &lt;EM&gt;Import&lt;/EM&gt; tab -&amp;gt; type in &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FIELDCAT	TYPE	LVC_T_FCAT   "we will pass field catalog each time here
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;also select &lt;STRONG&gt;Pass value&lt;/STRONG&gt; as no references can be passed in RFC module&lt;/P&gt;&lt;P&gt;- in &lt;EM&gt;Changing&lt;/EM&gt; tab&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SUBRC	TYPE	I "and select 'Pass Value' - this one will notify the result of the call
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;- in &lt;EM&gt;Source code&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  data: r_newtab type ref to data.

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
   EXPORTING
      it_fieldcatalog           = FIELDCAT
    IMPORTING
      ep_table                  = r_newtab
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.
    subrc = sy-subrc.

   "here unfortunatelly must go your coding which handles R_NEWTAB, you can't pass it back to the calling program
   "as references are not allowed as parameters
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;- in ABAP program write&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: it_fieldcat TYPE lvc_t_fcat,
      r_newtab TYPE REF TO data.

DATA: rest TYPE i,
      subrc LIKE sy-subrc.

DATA: task(8) TYPE c.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name = 'SFLIGHT'
  CHANGING
    ct_fieldcat      = it_fieldcat.

DO 250 TIMES.
  rest = sy-index MOD 36.

  IF rest = 0.
    task = task + 1.
  ENDIF.

  CALL FUNCTION 'ZTEST_NEW_TASK' STARTING NEW TASK task
    EXPORTING
      fieldcat = it_fieldcat
    CHANGING
      subrc    = subrc.
  IF subrc = 0.
    WRITE: / 'Table created ', sy-index, 'times, in task ', task.
  ENDIF.
ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This way you call FM starting new task (new session) each time it raises 36 times (max per internal session). &lt;/P&gt;&lt;P&gt;That should work in 4.7, works fine in ECC 5.0, but strong disadvange is as I said, restrcition to do the coding inside FM, because you can't pass &lt;/P&gt;&lt;P&gt;reference back to the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 13:39:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/5786504#M1309177</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-07-01T13:39:52Z</dc:date>
    </item>
  </channel>
</rss>

