- SAP ABAP - Web Dynpro
- SAP ABAP - Business Add-Ins
- SAP ABAP - User Exits
- SAP ABAP - Customer Exits
- SAP ABAP - SAPscripts
- SAP ABAP - Smart Forms
- SAP ABAP - Dialog Programming
- SAP ABAP - Report Programming
- SAP ABAP - Object Events
- SAP ABAP - Interfaces
- SAP ABAP - Encapsulation
- SAP ABAP - Polymorphism
- SAP ABAP - Inheritance
- SAP ABAP - Classes
- SAP ABAP - Objects
- SAP ABAP - Object Orientation
- SAP ABAP - Deleting Internal Tables
- SAP ABAP - Reading Internal Tables
- SAP ABAP - Copying Internal Tables
- ABAP - Populating Internal Tables
- SAP ABAP - Creating Internal Tables
- SAP ABAP - Internal Tables
- SAP ABAP - Native SQL Overview
- SAP ABAP - Open SQL Overview
- SAP ABAP - Include Programs
- SAP ABAP - Function Modules
- SAP ABAP - Macros
- SAP ABAP - Subroutines
- SAP ABAP - Modularization
- SAP ABAP - Lock Objects
- SAP ABAP - Search Help
- SAP ABAP - Views
- SAP ABAP - Structures
- SAP ABAP - Tables
- SAP ABAP - Data Elements
- SAP ABAP - Domains
- SAP ABAP - Dictionary
- SAP ABAP - Exception Handling
- SAP ABAP - Formatting Data
- SAP ABAP - Date & Time
- SAP ABAP - Strings
- SAP ABAP - Decisions
- SAP ABAP - Loop Control
- SAP ABAP - Operators
- SAP ABAP - Constants & Literals
- SAP ABAP - Variables
- SAP ABAP - Data Types
- SAP ABAP - Basic Syntax
- SAP ABAP - Screen Navigation
- SAP ABAP - Environment
- SAP ABAP - Overview
- SAP ABAP - Home
SAP ABAP Useful Resources
- SAP ABAP - Discussion
- SAP ABAP - Useful Resources
- SAP ABAP - Quick Guide
- SAP ABAP - Questions Answers
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SAP ABAP - Include Programs
Include programs are global repository objects used to modularize the source code. They allow you to use the same source code in different programs. Include programs also allow you to manage complex programs in an orderly way. In order to use an include program in another program, we use the following syntax −
INCLUDE <program_name>.
INCLUDE statement has the same effect as copying the source code of the include program <program_name> into another program. As include program can’t run independently, it has to be built into other programs. You may also nest include programs.
Following are a couple of restrictions while writing the code for Include programs −
Include programs can t call themselves.
Include programs must contain complete statements.
Following are the steps to create and use an Include program −
Step 1 − Create the program (Z_TOBEINCLUDED) to be included in ABAP Editor. Code to be included in ABAP Editor is −
PROGRAM Z_TOBEINCLUDED. Write: / This program is started by: , SY-UNAME, / The Date is: , SY-DATUM, / Time is , SY-UZEIT.
Step 2 − Set the Type of the program to INCLUDE program, as shown in the following screenshot.
Step 3 − Cpck the ‘Save’ button and save the program in a package named ZINCL_PCKG.
Step 4 − Create another program where the program Z_TOBEINCLUDED has to be used. Here we have created another program named Z_INCLUDINGTEST and assigned the type for the program as Executable program.
Step 5 − The coding for Z_INCLUDINGTEST program includes the Z_TOBEINCLUDED program with the help of the INCLUDE statement as shown in the following code.
REPORT Z_INCLUDINGTEST. INCLUDE Z_TOBEINCLUDED.
Step 6 − Save, activate and execute the program.
The above code produces the following output −
This program is started by: SAPUSER The Date is: 06.10.2015 Time is 13:25:11Advertisements