Program Type and Program Execution

Concept

Program Types The various program types are distinguished by the way the global declaration part is constructed and in the possible processing blocks, plus the ability to define standalone SAP GUI screens (or dynpros).

  • Executable programs are introduced using the statement REPORT. With the exception of function modules, all types of processing blocks can be implemented here, in particular event blocks for selection screen events, reporting events, and list events. There are no restrictions here in relation to the global declaration part. Executable programs can have a separate user interface in the form of a dynpro or selection screen.

  • Global classes in the class library are introduced using the statement CLASS-POOL. Unlike local classes, which are defined in the global declaration part of a program and are only visible within this program, global classes are visible across the system. Only methods can be used as processing blocks. Local classes and interfaces with local visibility can be defined in the global declaration part of a global class. Global classes do not have a separate UI.

  • Global interfaces in the class library are introduced using the statement INTERFACEPOOL. The visibility levels of global and local interfaces are the same as in classes. Global interfaces do not implement any processing blocks and do not have a separate user interface.

  • Function groups are introduced using the statement FUNCTION-POOL. There are no restrictions in relation to the global declaration part. With the exception of event blocks for reporting events, all types of processing blocks can be implemented (usually function modules). Function groups can have a UI in the form of dynpros and selection screens.

  • Module pools and subroutine pools are introduced using the statement PROGRAM. There are no restrictions in relation to the global declaration part.

    • Module pools define standalone dynpros and usually implement the dialog modules associated with the dynpros as processing blocks. Function modules and event blocks for reporting events cannot be implemented.

    • Subroutine pools do not have user interfaces and usually implement subroutines. Function modules cannot be implemented here either.

  • Type groups are introduced using the statement TYPE-POOL. They are used to make cross-program definitions of data types and constants. No further definitions can be made in the global declaration part of type groups. Type groups do not implement any processing blocks and do not have a separate user interface. The use of type groups is no longer recommended in new development projects. Global classes and interfaces are now the best way to make cross-program definitions of types and constants.

As well as the standalone programs described above, include programs can also be included in other programs, using the statement INCLUDE. They do not need their own introductory program statement. They are used solely for the modularization of source code.

Executable programs, classes, and module pools are designed to be called directly. The other program types can only be accessed when their procedures are called. Executable programs are called using the statement SUBMIT. Once an executable program is started, its process flow is controlled by the ABAP runtime environment. This triggers a sequence of selection screen events, reporting events, and list events.

Module pools are called by transaction codes that are associated with a dynpro of the program. When the statements CALL TRANSACTION and LEAVE TO TRANSACTION are executed or a transaction code entered in SAPGUI, a dynpro is started that calls the dialog modules from the module pool as part of its flow logic.

Public methods in global classes can be called as part of the program using meth( ... ) or by being associated with a transaction code. When the transaction is called, the associated method is executed (in the case of instance methods, an object is created implicitly). Similarly, transaction codes can be bound to the methods of local classes.