SAP Tutorials Blog

All ABAP programs are modular in structure and made up of processing blocks.

Processing blocks that are called using the ABAP runtime system:
  • Event blocks
  • Dialog modules
Processing blocks that are called from ABAP programs:
  • Subroutines
  • Function modules
  • Methods
The processing blocks that you call from ABAP programs are called procedures.
As well as modularization in processing blocks, ABAP allows you to modularize source code by
placing ABAP statements either in local macros or global include programs.

Macros
If you want to reuse the same set of statements more than once in a program, you can include
them in a macro.
The following statement block defines a macro <macro>:
DEFINE <macro>.
<statements>
END-OF-DEFINITION
To use a macro, use the following form:
<macro> [<p1> <p2> ... <p9>].

Include Programs
Include programs are global R/3 Repository objects. They are solely for modularizing source
code, and have no parameter interface.
They have the following functions:
  • Library: Include programs allow you to use the same source code in different programs.For example, this can be useful if you have lengthy data declarations that you want touse in different programs.
  • Order. Include programs allow you to manage complex programs in an orderly way.Function groups and module pools use include programs to store parts of the programthat belong together. The ABAP Workbench supports you extensively when you createsuch complex programs by creating the include programs automatically and by assigning them unique names. A special include is the TOP include of a program. If you name it according to the naming convention, it is always included in program navigation and in the syntax check.
Procedures
Procedures contain a set of statements, and are called from other ABAP programs.
You define procedures in ABAP programs. When the program is generated, they remain as
standalone modules. You can call procedures in the program in which they are defined, or from external programs. Procedures have an interface for passing data, and can also contain local data.
  • Subroutines :Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.
  • Function Modules :Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.
  •  Methods: Methods describe the functions and behavior of classes and their instances in ABAPObjects. Methods must be defined in classes. When you call them, you must observe certain special rules of object-oriented programming.
Function Groups
Function groups are containers for function modules. You cannot execute a function group.
When you call an function module, the system loads the whole of its function group into the
internal session of the calling program (if it has not already been loaded). For further information, refer to Organization of External Procedure Calls



Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com