Software Development Exam  >  Software Development Notes  >  Learn and Master SAP ABAP  >  SAP ABAP - Include Programs

SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development PDF Download

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.

SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development

Step 3 − Click 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:11

The document SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development is a part of the Software Development Course Learn and Master SAP ABAP.
All you need of Software Development at this link: Software Development
73 videos|68 docs

Top Courses for Software Development

73 videos|68 docs
Download as PDF
Explore Courses for Software Development exam

Top Courses for Software Development

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Important questions

,

Sample Paper

,

Extra Questions

,

Objective type Questions

,

Previous Year Questions with Solutions

,

study material

,

Viva Questions

,

shortcuts and tricks

,

Semester Notes

,

Exam

,

SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development

,

mock tests for examination

,

Summary

,

pdf

,

MCQs

,

practice quizzes

,

ppt

,

SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development

,

SAP ABAP - Include Programs | Learn and Master SAP ABAP - Software Development

,

Free

,

past year papers

,

video lectures

;