Use of RTTS To Solve GENERATE_SUBPOOL_DIR_FULL Exception For Dynamic Table Generation
We as a developers working in SAP Webdynpro FPM and Object oriented ALV have encountered an exception GENERATE_SUBPOOL_DIR_FULL while trying to use the API CL_ALV_TABLE_CREATE to generate dynamic tables which are required in our specific requirements. There is a limitation wherein the API will allow to generate dynamic internal tables for 36 times only after which it throws an exception GENERATE_SUBPOOL_DIR_FULL. The scenario which I encountered was in developing SAP FPM cockpit wherein we had create umpteen number of dynamic internal tables depeding upon selection criteria selected by end user in the cockpit. Hence in my case the end user used to get dump screen after trying to search multiple criteria. I struggled a lot and then later used the RTTS code to resolve the issue which I am sharing in my below document. Please note that I am not giving insight on RTTS as there are lots of documents in SCN which could be referred the best one is https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=42965 published by Marcelos Ramos. For more detail please refer to the same.
As briefly described in the Summary the main scenario where I encountered this issue was SAP FPM web dynpro component for search cockpit which had multiple search screens associated with it.
These multiple screens were used to fetch data from various CDS Hana views and then dynamic internal tables used to be generated depending upon the fields coming from CDS views which used to be binded to the result screen in the cockpit. As already specified I was initially using CL_SALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE which takes in as importing parameter as Field catalog data type(used for ALV grid class as well) and passes the dynamic parameter of Type reference to Data as output. But in our cockpit we have multiple save searches which resulted in umpteen calls to the API thus resulting in an exception GENERATE_SUBPOOL_DIR_FULL.
Hence to resolve the issue introduced the below code snippet which I have explained with comments preceding with ” please refer to them for further explaination:-
***Data Declaration FIELD-SYMBOLS : <lt_mbs_grp_sel> TYPE STANDARD TABLE, <l_dyn_table> TYPE STANDARD TABLE, <ls_table_2> TYPE any, <ls_val> TYPE any, <ls_val_i> TYPE any. DATA: l_element TYPE REF TO cl_abap_elemdescr, l_intlen TYPE i,l_dec type i, lt_Fcat TYPE lvc_t_fcat, lt_comp TYPE cl_abap_structdescr=>component_table, ls_comp LIKE LINE OF lt_comp, l_new_type TYPE REF TO cl_abap_structdescr, l_new_tab TYPE REF TO cl_abap_tabledescr, l_data TYPE REF TO data. ***prepare the Runtime Type identification structure to be used to generate table LOOP AT lt_fcat INTO DATA(ls_fcat). * Field name ls_comp-name = ls_fcat-fieldname. * Field Type l_intlen = ls_fcat-intlen. l_dec = ls_fcat-decimals. ls_comp-type = cl_abap_elemdescr=>get_by_kind(p_type_kind = ls_fcat-int typep_length = l_intlen p_decimals = l_dec ). ** Filling the component table APPEND ls_comp TO lt_comp. CLEAR: ls_comp. ENDLOOP. * 3. Create a New Type l_new_type = cl_abap_structdescr=>create( lt_comp ). * 4. New dynamic internal Table type l_new_tab = cl_abap_tabledescr=>create(p_line_type = l_new_type p_table_kind = cl_abap_tabledescr=>tablekind_std p_unique = abap_false ). *5. data to handle the new table type CREATE DATA l_data TYPE HANDLE l_new_tab. ** 6. New internal table in the fieldsymbols ASSIGN l_data->* TO <l_dyn_table>. CREATE DATA lt_table LIKE LINE OF <l_dyn_table>. ASSIGN lt_table->* TO <ls_table_2>.
The final dynamic table is <ls_table2> to be retrieved and used further in the application/program. Hope so It will save time and effort for fellow developers who might face this issue.
First of all I liked you blog. Nice job.
Second - just a suggestion. Instead of what you do / qualifications at the top of the blog, you could put them in your profile. I just skipped the paragraph and went on to read the blog. So it wasn't a big deal for me.
Keep it up!
Can you check your presentation? Links are not hyperlinks and code is not formatted.
Thanks for pointing out. Made the changes. Please check now.
Much better, thanks!
I just proposed a generic solution for replacing CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE with a similar custom method which uses RTTC instead of GENERATE SUBROUTINE POOL.