2007 Jul 19 6:00 AM
Hi ,
I am using cl_alv_table_create=>create_dynamic_table to get an dynamic internal table. At 5th record , the program is dumping and giving error as
<b>'sub routine pool buffer is full'</b>.
Could you please suggest me to refresh this buffer .
Is there any Function module or method to refresh buffer area.
Thanking you,
Satya
2007 Jul 19 11:53 AM
Hi Naga,
There lies the problem. U can call this method only upto 21 times not more than that in one session. Even I too faced the same kind of situation. Then I arrived at a solution of storing the address of the new line type created with the same structure of the table. Like,
TYPES: BEGIN OF ty_stuff,
tdref TYPE REF TO data,
END OF ty_stuff.
DATA w_stuff TYPE ty_stuff.
DATA t_stuff TYPE TABLE OF ty_stuff.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat_fin[]
IMPORTING
ep_table = new_table.
IF sy-subrc EQ 0.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <fs_table>.
CREATE DATA w_stuff-tdref LIKE LINE OF <fs_table>.
"(w_stuff-tabname).
APPEND w_stuff TO t_stuff.
ENDIF.
So my table t_stuff will contain all the addresses of the table structures. Use that in this way:
READ TABLE t_stuff INDEX l_seg_tabix INTO w_stuff.
IF sy-subrc EQ 0.
ASSIGN w_stuff-tdref->* TO <l_line1>.
ENDIF.
Now <l_line1> will be of line type of the internal table that u want to create.
Anyways it depends on the requirements. I thought of sharing this, might be helpful in some way to u.
-SatyaPriya
2007 Jul 19 6:22 AM
Hi,
Can you please check the line size of that record. I hope there is a limit for that. If that limit exceeds, it throws dump.
-SatyaPriya
2007 Jul 19 7:40 AM
Hi,
Thanks for that.
But when I execute for the first time it is working fine .
When I execute for the second time i.e. with in same session
then it is giving dump.
So I do not think it is due to line limit.
I will show you the code where it is going for dump ,
catch system-exceptions generate_subpool_dir_full = 9.
generate subroutine pool lt_source name l_name
message l_message line l_line word l_word.
endcatch.
case sy-subrc.
when 0.
when 9.
raise generate_subpool_dir_full. <- this point is the cause of error
when others.
message x000(0k) with l_message l_line l_word.
endcase.
Thanking you,
Satya
2007 Jul 19 8:45 AM
Tell me one thing, how many times u r calling that create_dynamic_table method in ur program. I think max of 21 times u can call this method in one session.
-SatyaPriya
2007 Jul 19 11:19 AM
Hi,
This method we can call 36 times in a session. But is there any other method available for this.
Other wise can we refresh the session , so that count can be again starting from one.
Thanks,
Regards,
Satya
2007 Jul 19 11:53 AM
Hi Naga,
There lies the problem. U can call this method only upto 21 times not more than that in one session. Even I too faced the same kind of situation. Then I arrived at a solution of storing the address of the new line type created with the same structure of the table. Like,
TYPES: BEGIN OF ty_stuff,
tdref TYPE REF TO data,
END OF ty_stuff.
DATA w_stuff TYPE ty_stuff.
DATA t_stuff TYPE TABLE OF ty_stuff.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat_fin[]
IMPORTING
ep_table = new_table.
IF sy-subrc EQ 0.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <fs_table>.
CREATE DATA w_stuff-tdref LIKE LINE OF <fs_table>.
"(w_stuff-tabname).
APPEND w_stuff TO t_stuff.
ENDIF.
So my table t_stuff will contain all the addresses of the table structures. Use that in this way:
READ TABLE t_stuff INDEX l_seg_tabix INTO w_stuff.
IF sy-subrc EQ 0.
ASSIGN w_stuff-tdref->* TO <l_line1>.
ENDIF.
Now <l_line1> will be of line type of the internal table that u want to create.
Anyways it depends on the requirements. I thought of sharing this, might be helpful in some way to u.
-SatyaPriya
2007 Jul 19 12:10 PM
Hello,
Thanks for your answer . But I did not get how can we avoid dump as again I am calling this method for 36 times in the same session.
For each field catalog structure I need to call this method and I have 36 field catalogs with me.
Regards,
Satya
2007 Jul 19 4:53 PM
Hi,
You can't refresh the memory !
For each dynamic internal table a program is created in memory using "GENERATE SUBROUTINE POOL" and the limit is 36 times.
I had the same problem in the past and my solution was keep the internal tables in memory to use them later !
Can't you use the sintax CREATE DATA... as below ?
DATA: dref TYPE REF TO DATA.
TYPES: <type> TYPE <data>.
FIELD-SYMBOLS: <fs> TYPE ANY.
CREATE DATA dref TYPE <type>.
ASSIGN dref->* TO <fs>.
Or RTTS Classes ? See the link
Regards.
Marcelo Ramos
2008 Jul 20 4:03 PM
Hi,
I've recently come across the 36 subroutine limit myself and have solved it by skipping the CL_ALV_CREATE_TABLE class (copying it really) and instead of generating a new dynamic program for each table, I put ALL the dynamic tables required into one dynamic program. This does mean you have to have a unique identifier for each dynamic table rather than using LT_GENTAB, but it works a treat
Copy CL_ALV_TABLE_CREATE
create a new structure with TABNAME as first field & LVC_T_FCAT as second field
create new table type with this line type
copy the code from include LSKBHF06 form fb_table_create_string
change the code to loop around your table of tables, substituting LT_GENTAB for your TABNAME
change the class to have your own version of INTERNAL_RECEIVER (and the generated code for the subroutine, to include a parameter for the TABNAME identifier)
You'll need to change the return from the class to a table of table references as well (with your TABNAME as the identifier)
Doing this you will only generate one subroutine for all your tables and thus avoid the 36 subroutine limit.
Hope this helps
Reg