Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Converting Dynamic Field Catelog into Dynamic Internal Table

Former Member
0 Likes
992

Hi ABAP Experts,

I have a program that uses method: CREATE_DYNAMIC_TABLE, but it is giving run time error when the dynamic table creation exceeds 36 times. I need to create dynamic internal table about 5000 times (For different customer) so as to create 5000 different files (Customer Specific). Since my program is short dumping with Exception condition "GENERATE_SUBPOOL_DIR_FULL" raised, I think I need to have a different approach due to the limitation with this method. I am not sure how to proceed further. I did search through SDN but not getting the right help. I am new to this dynamic programing and appreciate your help.

My Current Program:

data: it_tab type ref to data.
data: it_line type ref to data.

field-symbols: <lt_cnpr> type standard table,
                            <ls_cnpr> type any.

    call method cl_alv_table_create=>create_dynamic_table
    exporting
      it_fieldcatalog = tab_fieldcat
    importing
      ep_table        = it_tab.

  assign it_tab->* to <lt_cnpr>.
  create data it_line like line of <lt_cnpr>.
  assign it_line->* to <ls_cnpr>.

I have the FIELD CATALOG that needs to be converted into an internal table within a loop for about 5000 times. Can you please suggest me with a suitable solution? Appreciate if you could provide me with some sample code for quick help.

Thanks

Kannan

.

7 REPLIES 7
Read only

philipdavy
Contributor
0 Likes
946

Hello Kannan,

The subroutine pool has a generation limit of 36 which is also applied when you call

cl_alv_table_create=> create_dynamic_table. You have to use RTTS. For a good understanding of the RTTS concept, you can refer the below links.

http://scn.sap.com/thread/1725739

http://zevolving.com/2008/09/dynamic-internal-table-creation/

Regards,

Philip.

Read only

0 Likes
946

Hi Philip,

Thanks for your reply.

I did go through the 2nd link, which is good but not much helpful to my situation. 1st link is not working.

Steps to Create Dynamic ITAB

To create a dynamic internal table, we need to:

  1. 1. Gather all the Components
  2. 2. Generate a Type from these components
  3. 3. Generate a Table Type from this created type
  4. 4. Create a Data reference of this Table Type
  5. 5. Assign this data reference to the Field-Symbol of table type. This Field-symbol will act as our dynamic internal table.

I think I have the challenge to gather all the Components from the Field Catalog. I have the field Catalog already build dynamically. From this field catalog i need to build the dynamic internal table. I have all the fields and its attributes in the field catalog.

I would need some help on how to translate the field catalog into a dynamic type. Can you please provide me with some sample code? Appreciate your help.

Thanks,

Kannan.

Read only

0 Likes
946

HI,

Is the structure of all 5000 internal tables same ? If  yes, then why dont you try to use the same internal table instead of creating it so many times.

Regards,

Kartik

Read only

0 Likes
946

Hi Kartik,

It may be 5000 or 50,000, in fact i never know how many different table in an execution that is determined by the selection criteria and sap data. The structure is likely to be different for every other table. Do you have any idea how to create a dynamic internal table from the field catalog I already have created.

Thanks,

Kannan

Read only

philipdavy
Contributor
0 Likes
946
Read only

Former Member
0 Likes
946

Hi Kannan,

           Obviously you have a memory overflow problem here. Though I had created dynamic tables before, never have I come across a situation wherein I have to build tables more than 36 times in a loop. To get around this problem can you please try to deallocate the memory space used up for your dynamic table using the FREE statement i.e. just before your ENDLOOP statement, use the FREE it_tab statement to remove the created table from memory so that the next LOOP pass would start with a new table in memory.

Thanks & Regards,

Sarath.

Read only

0 Likes
946

Hi,

FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE.

DATA: dy_table TYPE REF TO data,

   Unassaign <dyn_table>.

   * Create dynamic internal table structure

   CREATE DATA dy_table TYPE TABLE OF (p_table).

   ASSIGN dy_table->* TO <dyn_table>.

* p_table required Table name

Use Above code for creating  internal table

Regards,

satish sudani