INCLUDE incl [IF FOUND].
INCLUDE includes the
incl in this position in the source code. In syntax checks and when the program is generated
by ABAP Compiler, the statement is replaced by the source code of the include program. The included
INCLUDE program must consist of full statements.
If the specified include program does not exist, the syntax of the program is incorrect and cannot be executed. This error message can be suppressed by specifying the addition
INCLUDEis the only statement that can be used instead of a statement that introduces a program in the first position of a program. The requirement is that, after the include program is resolved, a statement that introduces a program is located at the beginning of the including program.
- ABAP Workbench supports the automatic creation of include programs for specific program parts, such as the top include for global declarative statements. It is advisable to always use the naming conventions proposed by ABAP Workbench. The top include can contain only declarative statements and is respected when individual include programs of a program are compiled.
In Repository Browser
(a part of Object Navigator in ABAP Workbench), the
INCLUDEprograms bound by a program are executed as the subnodes of the program.
... IF FOUND
IF FOUND dictates that the specified
include program can
be included only if it exists. If the include program does not exist, the
INCLUDE statement is ignored and no syntax error occurs here.
If the addition
IF FOUND is specified, it is recommended that the including
program not be dependent on the source code of the include program. Otherwise, the include program may have correct syntax in systems where it exists but incorrect syntax in other systems.
These lines show the master
program of the function group ABAP_DOCU. This function group displays the keyword documentation
on Application Server ABAP. It only contains
statements that embed the actual source code.
labap_docutop itself is made up of include programs for the individual declarations (global data and class declarations local to the program).
*& Function Group SAPLABAP_DOCU
INCLUDE labap_docutop. " Global Declarations
INCLUDE labap_docue00. " Load of Program
INCLUDE labap_docuuxx. " Function Modules
INCLUDE labap_docuo01. " PBO Modules
INCLUDE labap_docui01. " PAI Modules
INCLUDE labap_docue01. " Handling of Runtime-Events
INCLUDE labap_docup01. " Class implementations
INCLUDE labap_docut99. " Unit tests