Saturday

ABAP Modularization

ABAP Modularization

ABAP Programs are modular in structure and made up of different processing blocks.


Processing Blocks divided into two parts:

- Called from outside a program by the ABAP runtime system. (Modularization in Source
Code)
o Macros
o Include programs


- Called by ABAP statements in ABAP programs.
o Subroutines
o Functional Modules
o Methods




Source Code Modularization:
In source code modularization you place a sequence of ABAP statements in a module. Then instead of placing all statements in your main program you just call the module. It helps to avoid repeating the same statements. They are not used to modularize tasks or functions. Procedures used for this purpose.

ABAP contains two types of source code modules :
1. MACROS
2. INCLUDES


1. MACROS :
Through Macro you can reuse same set of statements more then once in a program. Macros can be useful in for long calculations or complex WRITE statements. You can use Macros within a program in which it is defined, and it can only be called in lines of program following its definition.
Syntax
Define .
Statements …
End-of-Definition .


Statement can contain up to nine place holders (&1, &2,&3…..&9).

Macros do not belong to the definition part of the program. This means that the DEFINE...ENDOF-DEFINITION block is not interpreted before the processing blocks in the program. At the same time, however, macros are not operational statements that are executed within a processing block at runtime. When the program is generated, macro definitions are not taken into account at the point at which they are defined.

2. INCLUDES
Include programs are global R/3 objects and are solely for modularizing source code and have no parameter interface.

Include programs have two functions:
- Library
Include program allows you to use same source code in different programs.

- Order
Include program allows you to manage complex program in an orderly way. Function Groups and Module Pools use include program to store parts of the program that belongs together. Special include is the TOP include of a program.

Include Programs can not call themselves.
Include Program must contain complete statements.