CALL FUNCTION
Variant 4
CALL FUNCTION func DESTINATION dest.
Additions
1. The same as with CALL FUNCTION func
2. ... EXCEPTIONS syst_except = rc MESSAGE mess
Effect
Executes the function module externally as a Remote
Function Call ( RFC ); dest can be a literal or a variable.
Depending on the specified destination, the function module is executed
in another R/3 or R/2 System. Externally callable function modules must
be flagged as such in the function library (of the target system).
Since each destination defines its own program context, further calls
to the same or different function modules with the same destination can
access the local memory (global data) of these function modules.
You can maintain existing destinations by selecting
Tools -> Administration -> Administration -> Network -> RFC
.
Notes
Special destinations:
-
The destination NONE refers to the calling system. Function
modules called with
CALL FUNCTION func DESTINATION 'NONE' ...
are executed in the system of the calling program, but in their own
program context.
-
You can use the destination BACK if the current program was
already called by RFC . The, BACK refers back to the
calling program:
CALL FUNCTION func DESTINATION 'BACK' ...
If the program is not called from a "remote" source, the exception
COMMUNICATION_FAILURE is triggered.
-
Each R/3 System has a standard name. This is formed from the host
name (e.g. SY-HOST ), the system name ( SY-SYSID ) and the
system nummer (two-character number assigned on installation of the
applications server).
You can use this name as a destination. For example, you can call the
function module func in the system C11 on the host sapxyz
with system number 00 as follows:
CALL FUNCTION func DESTINATION 'sapxyz_C11_00' ...
-
You can also use saprouter path names as destinations (see also
saprouter documentation).
Note
Parameter passing. When you pass data to an
externally called function module, there are some differences to the
normal function module call:
-
With table parameters, only the table itself is passed, not the
header line.
-
If one of the parameters of the interface of an externally called
function module is not specified when called, the import parameters are
set to their initial value. If no default value was given in the
interface definition, TABLES parameters are defined as an empty
table and unspecified export parameters are lost.
Note
Passing structured data objects. Since transport to
another system may require data conversion, the structure of field
strings and internal tables must be known to the runtime system when
the call is made. The structure of a field string or internal table is
not known if it was defined with
... LIKE structure ,
if the structure passed was passed to the subroutine with the explicit
addition STRUCTURE , or if it is a parameter of a function
module.
In these cases, external calls can result in a conversion error.
Note
C interface. You can call externally callable
function modules from C programs. It is also possible to store function
modules in a C program and call them via CALL FUNCTION ...
DESTINATION . For this purpose, SAP provides a C interface
.
Addition 2
... EXCEPTIONS syst_except = rc MESSAGE mess
Effect
Function module calls with the addition
DESTINATION can handle two special system exceptions:
SYSTEM_FAILURE
This is triggered if a system crash occurs on the receiving side.
COMMUNICATION_FAILURE
This is triggered if there is a connection or communication problem.
In both cases, you can use the optional addition
... MESSAGE mess
to receive a description of the error.
Note
Runtime errors
-
CALL_FUNCTION_DEST_TYPE :Destination type not allowed.
-
CALL_FUNCTION_NO_DEST :Destination does not exist.
-
CALL_FUNCTION_NO_LB_DEST :Destination (in 'Load Balancing'
mode) does not exist.
-
CALL_FUNCTION_TABINFO :Data error (info internal table) during
'Remote Function Call'.
Index
© SAP AG 1996