Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Calling and leaving program units →  Calling Processing Blocks →  Calling Procedures 

External Procedure Call

The following procedures of the same AS ABAP can be called externally:

  • Procedures which are intended for external calls:
  • Methods of global classes in class pools visible where called (that is, public methods in all programs), protected methods in subclasses, and private methods in friends of the classes.
  • Methods of local classes of other programs that are visible at the call position if a reference variable with a reference to an object of the class was passed to the calling program
  • Procedures which are not intended for external calls but can still be called externally (but should not be):

In the first external call of a procedure of the same AS ABAP, its master program is loaded into the internal session of the calling program if it has not yet been loaded. Except when loading class pools, the event LOAD-OF-PROGRAM is also triggered, which calls the program constructor program. External calls of subroutines and methods of local classes is not recommended and is critical, since the assignment of the loaded master program to a program group is usually not determined:

Furthermore, for external procedure calls, the possibility that properties of the calling and called programs may differ must be considered.

Other versions: 7.31 | 7.40 | 7.54

Programming Guideline

Only call suitable procedures externally


Note

Any subroutines and methods of local classes defined in an include program cannot be called externally by specifying the include program, since it cannot be generated as a standalone program. The procedures can only be called by specifying the name of the compilation unit if the include program itself is included in the compilation unit.


Example

External calls of the function module READ_SPFLI_INTO_TABLE and the method DISPLAY of the global class CL_DEMO_OUTPUT.

DATA itab TYPE spfli_tab. 

CALL FUNCTION 'READ_SPFLI_INTO_TABLE' 
  EXPORTING 
    id        = 'LH' 
  IMPORTING 
    itab      = itab 
  EXCEPTIONS 
    not_found = 1 
    OTHERS    = 2. 

IF sy-subrc = 0. 
  cl_demo_output=>display( itab ). 
ENDIF.

Continue

Program Groups in External Procedure Calls

Fixed Point Arithmetic in External Procedure Calls