Scenario
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |