The information about the target system of an RFC call is stored in the RFC destination.
The attributes 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 specified after
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.
The documented function module RFC_MODIFY_R3_DESTINATION edits static destinations managed in transaction SM59.
In cases whether it is not enough to use the static destinations managed using transaction SM59,
the associated attributes can be grouped as 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
and interpreted as a destination by the runtime environment. 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 must only be created using the class CL_DYNAMIC_DESTINATION and must never be added to programs from external sources. Further methods in the class make it possible to
- invalidate a dynamic destination created the current session,
- check whether a destination added from an external source is a dynamic destination,
- invalidate any dynamic destinations added from external sources.
There are two predefined destinations that do not have to be entered using transaction SM59:
- The destination "NONE"" dictates that the function module starts on the same AS Instance as the calling program, but using the RFC interface and in a separate RFC context for the current user. This destination is possible for all execution modes.
- Destination "BACK" can be used in a function module that is called remotely, and links back to the caller. This can only be specified in function modules that have been called synchronously. Destination "BACK" can be used to call each remote-capable function module of the calling system in all three execution types. In synchronous callbacks, the associated relevant function group is loaded into the internal session of the calling program, if it does not yet exist there. The existent RFC connection is used for this callback.
- If the predefined destination "NONE" is used, no logon data or password must be specified when the user session is opened. If an RFC is performed for the current AS Instance using a destination defined in the transaction SM59, the settings on the application server dictate whether logon data needs to be specified or not.
- The logon data (user name, client, and logon language) for an RFC session with the destination "NONE" is taken implicitly from the calling session. The
text environment language of the calling session must be used for the
logon language (and
not the logon language of the session). The text environment language can be set using the statement
SET LOCALE LANGUAGE.
AS Instances as Destinations
Alongside destinations from 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, as display, for example, in SM51.
The only systems that an be reached like this are the current systems or systems connected using a trust relationship. For the current system, the logon data of the current user is used. For other systems, a logon is necessary.
A detailed description of the RFC destination can be found in under: RFC documentation on SAP Help Portal.