Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: what is the subroutine pool

Former Member
0 Kudos

Hi,

I want to know how to create subroutine pool.

Regards,

p.krishna prasad

6 REPLIES 6

Former Member
0 Kudos

Hi,

I suppose that this is a program with subroutines inside ( FORM ... ENDFORM ).

"Contain parts of programs (FORM routines) that can be called

using external PERFORM statements."

PERFORM form IN PROGRAM prog.

Svetlin

Message was edited by: Svetlin Rusev

Former Member
0 Kudos

Former Member
0 Kudos

Hi

Subroutine pool is a type of program where you write the definitions of your subroutines.

Form …………

…………….

…….

Endform.

N number of subroutines can be written in subroutine pool and can be used by any program. So, it makes the subroutines global (may be used by any number of programs).

A subroutine pool can be created from SE38 with Attribute ‘TYPE’: Subroutine pool. You can not execute this type of program. Its subroutines can be used by other program’s Perform statements

Regards

Ashish

Former Member
0 Kudos

In other words: We also call such programs as type 'S'.

You cannot start a type S program using a transaction code or by entering the program name. Instead, they are containers for subroutines, which you can call externally from other ABAP programs. They cannot contain screens.

Regards

Ashish

Former Member
0 Kudos

Hi,

SE38 - > enter name of the subroutine pool - > create - > select type as subroutine pool.

This one have collection of subroutines.

Cheers,

Sasi

Former Member
0 Kudos

The subroutine pool is a routine that is created while a program is working.

So the code of subroutine isn't directly wrote in the program, but it must be wrote in an internal table.

For example:

DATA: TEXT(6) VALUE 'HELLO!', NAME LIKE SY-REPID.

DATA TCODE(1000) OCCURS 100 WITH HEADER LINE.

TCODE = 'REPORT MY_REPORT.'.

APPEND TCODE.

TCODE = 'FORM MY_FORM.'.

APPEND TCODE.

TCODE = 'DATA: TEXT(6) VALUE ''HELLO!''.'.

APPEND TCODE.

TCODE = 'WRITE TEXT.'.

APPEND TCODE.

TCODE = 'ENDFORM. " MY_FORM'.

APPEND TCODE.

GENERATE SUBROUTINE POOL TCODE NAME NAME.

IF SY-SUBRC = 0.

PERFORM MY_FORM IN PROGRAM (NAME).

ENDIF.