Reusability Concepts means Modularization Techniques
List of Reusability Concepts are
- Includes
- Functions or Function Modules
- Routines or Form Routines or Sub Routines
- Macros
- Field Symbols
To Includes Programming type Include.
To Functions Programming type Function Group.
To Routines Programming type Sub Routine Pool.
Include, Function Group, Sub Routine Pool are not possible to execute directly. These Programming types can be executed base on executable Program.
INCLUDES:
Include is a Keyword to call an Include Program within an Include Program and Even to call include program in executable program.
FUNCTIONS:
Function can be defined in programming type Function Group.
Function Group is collection of Function Modules.
In One Function Group upto 99 Functions can be defined.
Functions are 2 types
1. Normal Function : can be called within SAP Systems only.
2. Remote Enable (RFC) : can be called within SAP Systems and even across SAP Systems.
Naming Conventions for Function modules are
Z_VXYZ, Z_MXYZ, Z_BXYZ, Z_PXYZ
here Z means user defined
XYZ means optional means any letters
V - Stands for Sales and Distribution.
M - Stands for Materials Management
B - Stands for Finance and Controlling
P - Stands for HR
ROUTINES:
Sub Routines defined in executable that called in that executable and even called in different executable.
Syntax:
Defining Sub Routines
Form SUB
-
-
-
EndForm
Calling Sub Routines
Perform SUB
Sub Routines are of two types
1. Internal Sub Routines
2. External Sub Routines
Internal Sub Routines means Form and Perform can exist with in a Program.
External Sub Routines means Form and Perform can exist in two different Programs.
Passing Parameters in Sub Routines:
Sap Key Words are
-> Using & Changing
If Parameters Passed while Defining Those are Formal Parameters.
If Parameters Passed while Calling Those ate Actual Parameters.
MACRO:
Macro designed based on Place Holders Concept.
In One Macro upto 9 Place Holders can be Customized.
Macro's Can be used Frequently in HR ABAP.
For HR ABAP SAP Provided 65 Predefined Macro's Those are available in Table TRMAC.
Syntax:
Define Macro
-
-
End-of-definition.
FIELD SYMBOLS:
Field Symbols are like Pointers Concept in C-Language means Field Symbols can Follows Call-by-Reference. These Concepts can be used frequently in HR ABAP.