13. Modularization Techniques Flashcards
When you declare a subroutine, you are identifying the_____ When you call a subroutine, you must specify the______
Formal parameters, Actual parameters
When using parameters, they must be passed to the subroutine using one of the following three methods.
Pass by value, Pass by value and result and Pass by reference
Pass by value-method
When the subroutine is called, a copy of the value of the data variable is passed to the formal parameter. The formal parameter has its own storage location (memory).
Pass by value and result-Method
In addition to the above, at the end of the subroutine, the value of the formal parameter is passed back to the actual parameter assigned to it.
Pass by reference-method
The formal parameters do not have a separate storage location. Instead, the address of the actual parameter is passed to the formal parameter. Changes to the value of the formal parameter are immediately reflected back in the actual parameters.
PERFORM statement
to call a subroutine.
FORM/ENDFORM statement
to define a subroutine.
USING keyword
allows you to specify the data variables to be passed as parameters.
CHANGING keyword
when specifying formal parameters to define a pass by value and result.
Local data
is any variable or structure that is defined within a subroutine.
use this option if you want the variable to be re-initialized with the default value every time it enters the subroutine.
DATA
use this option if you want the variable to remember what the value was the last time it was in the subroutine. It will not be re-initialized based on the definition.
STATICS
Function modules
are general purpose ABAP routines that can be called from any ABAP program. The benefit of function modules lies in their reusability, which saves developers from creating redundant code and increases programming efficiency.
Function builder
These function groups are collections of logically related functions that share common program context, such as global variables, at run time.
Parts of a function module
Administration, Interface, Documentation, Source code, Global data and main program
Administration-part of a function module
Attributes such as the function group and short text
are assigned
Interface-part of a function module
Parameters such as import/export and exceptions are defined.
Documentation-part of a function module
Maintain documentation of function module
Source code-part of a function module
Define actual ABAP code for function module
Global data-part of a function module
Define data available for all function modules belonging to the assigned function group
Main program-part of a function module
Program where all of the function modules of a function group are stored as well as the global data
Funtion groups
Are collections of logically related functions modules. Specification of a function group is required when creating a function module.
5 different interface parameters
• Import parameters • Changing parameters • Export parameters • Tables parameters Exceptions parameters
Import parameters
are those variables that will be imported from the
calling program.
Export parameters
are those variables that will be exported to the
calling program.
Changing parameters
are those variables that will be both imported from and exported to the calling program.
RAISE
use this version if you just want to set SY-SUBRC and let the calling program do the logic to interpret the importance and send a message or take any other action.
MESSAGE … RAISING
use this version if you want the function module to also capture specific message information that you can later access in your main program.
SE37
ABAP Function Builder
EXPORTING statement
to pass data from the calling program to the function module.
IMPORTING statement
to transfer data from the function module to the program.
TEST/EXECUTE statement
Test a function module
DESTINATION statement
tells the SAP System that the called function runs in a system other than the callers. is required for the remote call of a Function Module.