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

INCLUDE

Quick Reference

Syntax

INCLUDE incl [IF FOUND].

Addition:

... IF FOUND

Effect

The statement INCLUDE includes the include program 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 situation can be suppressed by specifying the addition IF FOUND.

Programming Guidelines

Notes

Addition

... IF FOUND

Effect

The addition 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.

Note

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.

Example

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 INCLUDE 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_docup02.
  INCLUDE labap_docup03.
  INCLUDE labap_docup04.

  INCLUDE labap_docut99.               " Unit tests