170 likes | 275 Views
ABAP Include & Function. Northern Arizona University College of Business. Include Programs & Function Modules. Include program. An include program is designed to be used by other programs. It is not complete by itself. The program is included into another program via the Include statement.
E N D
ABAP Include & Function Northern Arizona University College of Business
Include program • An include program is designed to be used by other programs. • It is not complete by itself. • The program is included into another program via the Include statement. • The Include program is known as the Included program.
Include program • The program that includes the Include program is known as the including program. Including Include
Include program *** INCLUDE ZXXX . Write: / ‘This is an Include program’ .
Including program Program ZXXX_PGXX . Include ZXXX . Rest of the program .
Creating an Include program • ABAP Editor (SE38). • Create the program (Z-----). • Create as type I (Include program). • Under attributes. • A type I program cannot contain partial or incomplete statements.
Function Groups • A Function Group is a control program for Function Modules. • A Function Group is external to an ABAP program.
Defining a Function Group • Use the Function Builder (SE37) to build a Function Group. • A Function Group is identified by a four-character identifier (function group ID). • ZXXX • A short description must be supplied
Function Modules • A Function Module is a sub program that performs a particular function. • A Function Module is external to an ABAP program. A Function Module must be subordinate to a Function Group. • Use the Function Builder (SE37) to build a Function Module.
Function Modules • A Function Module name is between 3 and 30 characters. • Zwhatever
Function Modules • A Function Module can have parameters imported into the module. • A Function Module can have parameters exported from the module. • The parameters are passed by value (does not change the source field).
Defining a Function ModuleImport Parameters • Parameter Name • Internal reference of the parameter • Type • Enter TYPE • Reference Type • Data type (C, D, F, I, N, P, T, X) • Default Value
Defining a Function ModuleExport Parameters • Parameter Name • Internal reference of the parameter • Type • Enter TYPE • Reference Type • Data type (C, D, F, I, N, P, T, X)
Defining a Function ModuleSource Code FUNCTION ZXXX_DEMO1. *”----------------------------------- *”*”Local interface: *” IMPORTING *” Reference(p1) TYPE I DEFAULT 0 *” Reference(p2) TYPE I DEFAULT 0 *” EXPORTING *” Reference(p3) TYPE I DEFAULT 0 *”-----------------------------------
Defining a Function ModuleSource Code p3 = p1 + p2 . ENDFUNCTION.
Calling a Function Module Call Function ‘ZXXX_DEMO1’ Exporting p1 = P_Value1 p2 = P_Value2 Importing p3 = W_Result .