AS ABAP Release 758, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP - Programming Language → Data Interfaces and Communication Interfaces → Remote Function Call (RFC) → RFC - Overview →RFC - Destination
The information about the target system of an RFC call is specified by the RFC destination.
Static Destinations
The properties of destinations are defined statically and managed in AS ABAP using the transaction SM59. Every destination managed in transaction SM59 has a unique name that can be used to specify the destination after the addition DESTINATION in RFC. For every destination, a connection type, the partner program, and the target system are defined in transaction SM59. Logon data and further connection options can also be defined in the destination.
Hint
The documented function module RFC_MODIFY_R3_DESTINATION processes static destinations managed in transaction SM59.
Dynamic Destinations
In cases where it is not sufficient to use the static destinations managed using transaction SM59, the associated properties can be combined to form a dynamic destination. This is done using the class CL_DYNAMIC_DESTINATION. Its method CREATE_RFC_DESTINATION creates a text field that can be specified in the current internal session in RFC after the addition DESTINATION and is interpreted as a destination by the runtime framework. A destination from transaction SM59 can also be used as a template and modified accordingly. The validity of the new destination is not checked until it is used for an RFC.
A dynamic destination has the characters %% as a prefix. These dynamic destinations should now only be created using the class CL_DYNAMIC_DESTINATION and must never be copied to programs from outside. Further methods in the class make it possible to
Executable Example
Predefined Destinations
There are three predefined destinations that do not have to be maintained using transaction SM59:
With destination NONE the function module starts in the same AS instance as the calling program, but using the RFC interface and in a separate RFC session for the current user. This destination is possible for all execution modes.
Destination SELF works as NONE but uses the RFC protocol fast serialization.
Destination BACK can be used in a function module that is called remotely and refers back to the caller. This specification is only possible in function modules that were called synchronously. The destination BACK can be used to call any remote-capable function module of the calling system in all three execution types. In synchronous callbacks, the associated relevant function pool is loaded into the internal session of the calling program, if it does not yet exist there. The existing RFC connection is used for the callback.
Hints
AS instances as Destinations
In addition to the destinations created in transaction SM59, the dynamic destinations, and the two predefined destinations, destinations can also be specified directly using the name of an AS instance, as returned by the method GET_INSTANCE_NAME of the system class CL_ABAP_SYST. This name has the form hostname_sysid_instnr. Here, hostname is the name of the host computer of the AS instance, sysid is the name of the AS ABAP, and instnr is the instance number of the AS instance, for example as displayed using transaction SM51.
The only systems that can be reached like this are the current systems or systems connected by a trust relationship. For the current system, the logon data of the current user is used. For other systems, a logon is necessary.
Hint
This specification can also be composed dynamically without posing a security risk.
More Information
For a detailed description of the RFC destination, see the documentation RFC in SAP Help Portal.