01-13-2005 10:25 AM
Hi everyone,
I'm trying to create dynamic tables but I get the exception GENERATE_SUBPOOL_DIR_FULL after a while. I read some topics here and found out that after 36 creation the exception was supposed to appear and that there were no way to avoid it.
I then tried to implement some solutions I read, but none worked, or I wasn't able to use them:
- I first tried to used the 'SUBMIT' solution, creating the table in a separated program. The problem is then, that I cannot get the table back to the main function.
- I also tried to use the statement:
create data it_content like table of line
but the compiler rejects it.
- eventually I tried to use CL_ABAP_TABLEDESCR without success.
Could you please give me an other possibility or explain me how to make those I tried being successfull. Thanks in advance.
Richard Dominé
P.S.: I'm working under SAP46C
01-13-2005 11:31 AM
Hi Richard,
In 4.6C, if you want to access a dynamically created internal table, then you can only access it within the internal mode that creates the table.
So, if you use SUBMIT to create a dynamic internal table via class CL_ALV_TABLE_CREATE, then you can only manipulate that internal table within the program submitted.
For example:
>> REPORT main.
>> ...
>> SUBMIT subreport AND RETURN
>> WITH param1 = ...
>>>> REPORT subreport.
>>>> ...
>>>> CALL METHOD CL_ALV_TABLE_CREATE=>...
>>>> * Process dynamic internal table
>> * Return from subreport
>> * Dynamic internal table no longer exists
If you need to pass data from the main report to the sub-report, then you can use the selection-screen parameters of the sub-report.
If the data to be passed in is more complex, or you want to get data back, then use EXPORT ... TO MEMORY ID ... and IMPORT ... FROM MEMORY ID ...
Good luck.
Scott
01-13-2005 11:47 AM
Hi Scott,
thanks for your answer. Nevertheless I still have problem because I do reaaly need to give the table back to the main program. I did try through import and export, but the point is that I wasn't able to have a receiving field in the main program: I tried to import the created table in a symbol field (because the type is dynamic) but it doesn't work. How can I import the table in the main program without knowing in advance the type of the table (I have to create a variable to receive this table, but I don't know how...).
Thanks
Richard
01-13-2005 12:35 PM
You should export both the fieldcatalog of the table and the table itself.
Then from fieldcatalog, create the table and import it.
FIELD-SYMBOLS: <gt_table> TYPE table.
DATA:
GT_FIELDCAT TYPE LVC_T_FCAT,
GP_TABLE TYPE REF TO DATA.
import GT_FIELDCAT from memory id 'XYZ'.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GT_FIELDCAT
IMPORTING
EP_TABLE = GP_TABLE .
ASSIGN GP_TABLE->* TO <GT_TABLE>.
IMPORT <gt_table> FROM MEMORY ID 'XYZ'.
-
If it helps please give points.
01-13-2005 12:37 PM
sorry the same answer submitted twice.
Message was edited by: Fuat Ulugay
01-13-2005 12:45 PM
Hi Richard,
You might need to, but this still doesn't make it possible :p.
When you return from the sub-report, the memory allocated during the submit is released. Therefore you can never get the dynamic internal table reference into the main program.
You might like to investigate creating an XML string that represents the data of the dynamic internal table. Though without knowing what you need to do with the data afterwards, it's hard to know whether that is acceptable.
Another solution, depending on your scenario, might be to create the dynamic internal table in the main program and then restart the work process every so often to avoid hitting the 36 generation limit.
Undoubtedly, if you took this path, you would need to pass data to the restarted work process. You can do this with the statements EXPORT/IMPORT/DELETE ... SHARED BUFFER.
Scott
01-13-2005 12:49 PM
Thanks for your answer Fuat but the point is that I want to avoid using the method <i>CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
</i> in the main program, otherwise I will get the exception...
To give more details about what I did:
<b><u>Sub program</u></b>
.....
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GT_FIELDCAT
IMPORTING
EP_TABLE = GP_TABLE .
ASSIGN GP_TABLE->* TO <GT_TABLE>.
EXPORT <GT_TABLE> TO MEMORY ID 'XYZ'.
<b><u>Main program</u></b>
SUBMIT SUB_PROGRAM
WITH...
IMPORT <GT_TABLE> FROM MEMORY ID 'XYZ'.
the problem is that I cannot import in a field symbol which has not been assigned yet. But what could I assign this field-symbol with? Or where could I import the table in if not in a field-symbol?
Thanks
Richard
01-13-2005 12:50 PM
Actually I withdraw my tongue-in-cheek comment. Fuat's response looks correct, though I haven't tested, that you could technically get the data back.
However, it doesn't solve the problem, because you end up creating a dynamic table in the main program, which was the problem you were trying to avoid in the first place.
Scott
01-13-2005 1:04 PM
than use a subroutine with tables parameter.
PERFORM form IN PROGRAM subprogram
tables
<gt_table>.
-
If it helps please give points.
01-13-2005 1:47 PM
I fail to see how a subroutine in which to do the table creation could help, as this will be called within the same internal mode as the calling (main) program. Hence the 36 limit will still be hit.
Scott
01-13-2005 1:52 PM
01-13-2005 1:56 PM
that you cannot generate more than 36 temporary sub-pools (GENERATE ...) within an internal mode. Class CL_ALV_TABLE_CREATE uses this syntax.
01-17-2005 7:52 AM
Hi,
Please try the following let me know if it is working for you.
Create a new report program and create the dynamic internal table in that program after creating it try to pass it to the main program using a subroutine or a function module call. And store the internal table globally in the main program.
Ex.
REPORT Main.
Data: GBL_data xxxxxxxx.
SUBMIT subpgm AND RETURN.
perform get_internaltable CHANGING t_itab.
FORM put_internaltable USING t_itab TYPE TABLE.
GBL_data = t_itab.
ENDFORM.
REPORT Subpgm.
Call the method to create to the internal table and
pass it to the main program.
perform put_internaltable IN PROGRAM main
USING t_itab.
Please let me know if it is working for you..
Naren
I am sorry I tried this method, its not working...
Naren
Message was edited by: Narendran Muthukumaran