Function Module
Function Module
ºO
The documentation describes the purpose of the function module, lists
the parameters for passing data to and from the module, and the
exceptions. It tells you how you can pass data to and from the function
module, and which errors it handles.
Function Modules
M M
M
Import parameters.
These must be supplied with data when you call the function module,
unless they are flagged as optional. You cannot change them in the
function module.
Export parameters.
These pass data from the function module back to the calling
program. Export parameters are always optional. You do not have to
receive them in your program.
Changing parameters.
These must be supplied with data when you call the function module,
unless they are flagged as optional. They can be changed in the function
module. The changed values are then returned to the calling program.
Function Modules
Tables parameters.
You use these to pass internal tables. They are treated like
CHANGING parameters. However, you can also pass internal
tables with other parameters if you specify the parameter type
appropriately.
Exceptions
Exceptions are used to handle errors that occur in function
modules. The calling program checks whether any errors have
occurred and then takes action accordingly.
First, create a Function Group ZXXX .
In E37(Function Builder)
ave
To Activate the Function Group, do the following steps
To Activate
elect main Program
Activate
Error
teps to Rectify Activation Error
º You can specify the name of the function module <module> either as a
literal or a variable. Each interface parameter <fi> is explicitly assigned
to an actual parameter <a i>. You can assign a return value <r i> to
each exception <e i>. The assignment always takes the form <interface
parameter> = <actual parameter>. The equals sign is not an
assignment operator in this context.
º You can use the Exceptions option to handle the exceptions of the
function module. If an exception <ei> is raised while the function
module is running, the system terminates the function module and
does not pass any values from the function module to the program. If
the <ei> is specified in the exception option, the calling program
handles the exception by assigning <ri> to Y-UBRC. <ri> must be a
numeric field.
Calling Function Modules
Example:
Calling Function Modules