‎2009 Feb 03 12:43 PM
Hi everybody,
I have a problem with the generation of subrutine pool. I am calculating some formulas thar are in a table. What I am doing is to concatenate the operands and the operators and then I call this subrutine. The problem is that I need to call this much more times than 36 that is the limit.
What I read in the documentation is this: "This statement generates a temporary subroutine pool. The source code of the subroutine pool is taken from the internal table itab. The generated subroutine pool is stored internally in the current internal mode."
Does anybody know how to delete or clear this subrutine from the internal mode in order not to have the dump after the creation of 36 subrutine pools??
Thanks very much
‎2009 Feb 03 1:10 PM
Hi Alejandro,
Welcome on SCN.
I think you misunderstood a bit how subroutine pool works. Subroutinne pools consists of routines dynamically generated by developer. When you use GENERATE SUBROUTINE POOL statement system automatically generates program name for this subroutine pool and pass you back its name.
Now inside that you may write your own routines and call them any number of times you want.
Look at the below example:
PARAMETERS: n_calls TYPE i.
DATA: it_code TYPE TABLE OF string,
prog LIKE sy-repid.
APPEND: 'PROGRAM subpool.' TO it_code,
'FORM some_form USING n_time TYPE i.' TO it_code, "my routine in subroutine pool
'write: / ''Routine called'', n_time.' TO it_code,
'ENDFORM.' TO it_code.
GENERATE SUBROUTINE POOL it_code NAME prog. "after generation program name is stored in prog
IF sy-subrc = 0.
DO n_calls TIMES.
PERFORM ('SOME_FORM') IN PROGRAM (prog)
USING sy-index IF FOUND.
ENDDO.
ENDIF.
When you copy and paste it you will find out that you can call some_form n_times depending on user input on selection screen. You don't call entire subroutine pool n_times, just appropraite routine which was coded inside that subroutine pool.
I hope this is clear now. If not don't hesitate to ask.
Regards
Marcin
‎2009 Feb 03 1:10 PM
Hi Alejandro,
Welcome on SCN.
I think you misunderstood a bit how subroutine pool works. Subroutinne pools consists of routines dynamically generated by developer. When you use GENERATE SUBROUTINE POOL statement system automatically generates program name for this subroutine pool and pass you back its name.
Now inside that you may write your own routines and call them any number of times you want.
Look at the below example:
PARAMETERS: n_calls TYPE i.
DATA: it_code TYPE TABLE OF string,
prog LIKE sy-repid.
APPEND: 'PROGRAM subpool.' TO it_code,
'FORM some_form USING n_time TYPE i.' TO it_code, "my routine in subroutine pool
'write: / ''Routine called'', n_time.' TO it_code,
'ENDFORM.' TO it_code.
GENERATE SUBROUTINE POOL it_code NAME prog. "after generation program name is stored in prog
IF sy-subrc = 0.
DO n_calls TIMES.
PERFORM ('SOME_FORM') IN PROGRAM (prog)
USING sy-index IF FOUND.
ENDDO.
ENDIF.
When you copy and paste it you will find out that you can call some_form n_times depending on user input on selection screen. You don't call entire subroutine pool n_times, just appropraite routine which was coded inside that subroutine pool.
I hope this is clear now. If not don't hesitate to ask.
Regards
Marcin
‎2009 Feb 03 1:26 PM
Hi Marcin,
thanks very much for the reply. I got the idea, I am going to change it in order to see if it works because i am calling it from a FM, but I think it should work.
Thanks again,
Alejandro