Executes the function module from an external source (as a
Remote Function Call or RFC); dest can be a literal or a
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 Builder (of the
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
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
You can use the destination BACK if the current program was
already called by RFC. Then, BACK refers back to the
CALL FUNCTION func DESTINATION 'BACK' ...
If the program is not called from a "remote" source, the exception
COMMUNICATION_FAILURE is triggered.
Each SAP system has a standard name. This is formed from the
host name (e.g. SY-HOST), the system name (
SY-SYSID) and the system number (a two-digit number
assigned on installation of the application 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
CALL FUNCTION func DESTINATION 'sapxyz_C11_00' ...
You can also use SAProuter path names as destinations (see also
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
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.
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
... LIKE structure,
if the structure was passed to the subroutine with the explicit
addition STRUCTURE, or if it is a parameter of a function
In these cases, external calls can result in a conversion
If an error occurs in the target system, the details are passed
to the calling system (SY-MSGNO, SY-MSGID, SY-MSGTY and
You can call external function modules from C programs. It is also
possible to store function modules in a C program and call them
with CALL FUNCTION ... DESTINATION . For this purpose, SAP provides
a C interface.
If the instance profile parameter 'auth/rfc_authority_check' is set
(to 1), the system automatically performs an RFC authorization
check. The authorization check refers to the relevant function
group for the function module to be called. If no authorization is
found, a runtime error occurs. You can check the authorization in
advance with the function module AUTHORITY_CHECK_RFC.
Note that there is a database commit after
every Remote Function Call (RFC). Consequently, you may
not use RFCs between SQL statements that open and close a database
cursor (example: SELECT...ENDSELECT).
Function module calls with the addition DESTINATION can handle
two special system exceptions:
This is triggered if a system crash occurs on the receiving
This is triggered if there is a connection or communication
In both cases, you can use the optional addition
... MESSAGE mess
to receive a description of the error.
In principle, you should always handle these
two system exceptions when the function module is called.
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'.
CALL_BACK_ENTRY_NOT_FOUND: The called function module has not
been released for 'Remote Function Call'.
CALL_FUNCTION_FIELD_NOT_FOUND: The receiving side does not
recognize the function parameter.
RFC_NO_AUTHORITY: No RFC authorization for user.
DATA: INFO LIKE RFCSI, "Importing parameter
MSG_TEXT(80) TYPE C. "Message text
* Synchronous call to function module RFC_SYSTEM_INFO
CALL FUNCTION 'RFC_SYSTEM_INFO'
RFCSI_EXPORT = INFO
COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT.
IF SY-SUBRC NE 0.
Data received for unknown CPI-C connection.
Destination type not allowed.
Specified destination does not exist.
Specified destination (in load distribution mode) does not
Data error (internal table info) in a Remote Function Call.
The function module has not been released for RFC.
The function parameter passed was not recognized by the
The user has no RFC authorization.
No authorization to log on as a Trusted System . The error
code has the following meaning:
0) Valid security key but incorrect logon data.
1) Calling system is not a Trusted System or
security key is invalid.
2) User either has no RFC authorization (authorization
object S_RFCACL), or you tried to log on using
one of the protected users 'DDIC' or 'SAP*'.
3) The timestamp of the logon data is invalid.
Comminication type is missing (I for internal connection, 3 for
R/3) Executing an asynchronous RFC
The function module is not flagged as remotely callable.
An error occurred during the remote function call. This was logged
in the calling system.
The login data for the user is incomplete.
Logon attempt in the form of an internal call to a target system is
RFC from external program without valid user ID
Logon attempt to the target system without valid user ID
RFC without valid user ID is only permitted when calling system
No memory for the table you want to import.
Only with asynchronous RFC: task name already in use.
Only with asynchronous RFC: Specified task is is already open.
Error reading the SNC information for the destination.