Entering content frameProcedures Locate the document in its SAP Library structure

Called procedures (subroutines, function modules, and methods) always run in the same internal session as the calling program.


This graphic is explained in the accompanying text

Subroutines

You call a subroutine using the

PERFORM <subr>[(<prog>)] ...

statement. If you omit the (<prog>) addition, the subroutine is called internally, that is, it belongs to the calling program and must not be loaded.

If you use the (<prog>) addition, the call is external, that is, the subroutine belongs to the program <prog>. When you call the subroutine, the entire program <prog> is loaded into the internal session of the calling program (if it has not been already). The loaded program belongs to the program group of the calling program. However, if the subroutine belongs to a function group, a new additional program group is created. The program group to which the external subroutine belongs determines the interface work areas and screens that it will use. However, this assignment can vary dynamically, so it is best to avoid using external subroutines.

Function Modules

You call function modules using the

CALL FUNCTION <func> ...

statement. Function module calls are external unless a function module is called by another procedure within the same function group. When you call a function module, its entire function group is loaded into the internal session of the calling program (unless it has already been loaded). Within the internal session, the function group forms an additional program group with its own interface work areas and screens. This means that function modules provide better encapsulation of data and screens than external subroutines.

Methods

You call a method using the

CALL METHOD [<ref>->|<class>=>]<meth> ...

statement. If you omit the <ref> or <class> part of the statement, the call is local within the same class. The class is not reloaded.

If you use <ref> or <class>, the method call applies to the method of the class specified through the object reference <ref> or the class name <class>. When you call the method, the entire class pool is loaded into the internal session of the calling program (unless it has already been loaded). The class pool forms an additional program group in the internal session, which does not share data and screens with the caller, and from which you cannot call external subroutines.

Leaving a Called Procedure

You can leave a procedure using the

EXIT.

or

CHECK <logexp>.

statement.

 

 

 

Leaving content frame