Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program structure →  Modularization Statements →  Source Code Modules →  Include Programs 

INCLUDE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


INCLUDE incl [IF FOUND]. 

Effect

The statement INCLUDE includes the include program incl at this position in the source code. In syntax checks and when the programs is generated by ABAP Compiler, 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, a syntax error is produced. This error message can be suppressed by specifying the addition IF FOUND.

Programming Guidelines


Notes

  • The statement INCLUDE is the only statement that can be used instead of a statement that introduces a program at 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. 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 in ABAP Workbench's Object Navigator, the INCLUDE programs bound by a program are executed as the program's subnodes.

Example

These lines show the master program of the function group ABAP_DOCU. This function group displays the keyword documentation on the Application Server ABAP. It only contains INCLUDE statements which 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_docup02.
  INCLUDE labap_docup03.
  INCLUDE labap_docup04.

  INCLUDE labap_docut99.               " Unit tests