When calling a function module using the RFC interface, the calling program must specify the parameters of the connection in the form of a destination. This destination defines the type of connection, the partner program, and the target system. You can manage it using transaction SM59, and it distinguishes between a variety of connections, such as TCP/IP or SAP connections. For a synchronous RFC, the destination must be specified explicitly. For asynchronous and transactional RFCs, a destination can be specified. If no destination has been specified the function module is called using the RFC interface in the same system. Depending on the type of execution, the following conditions apply:
· For synchronous and asynchronous calls, the values of the call parameters are transferred to the function module directly, whereas in the case of transactional calls, these are stored in the database temporarily until execution.
· For asynchronous calls, no connection to external systems is possible (TCP/IP connections in transaction SM59).
· For synchronous calls, the results of the called function are copied directly. For asynchronous calls, results can be received in callback routines by using the statement RECEIVE, whereas in the case of transactional calls, transferring results is not possible.
· The server of the called function module must be available for synchronous and asynchronous calls.
To be able to call a function module using the RFC interface, the function module in question must be flagged as being remote-capable in its properties, and for its interface parameter, only pass by value is allowed. Even for table parameters, a pass by value is performed implicitly. Within the system in which they are defined, remote-capable function modules can either be called using the RFC interface, or like normal function modules. The normal call is made using the statement CALL FUNCTION without using one of the additions DESTINATION, STARTING NEW TASK or IN BACKGROUND TASK. When making the call using the RFC interface, you must either specify the special destination "NONE" (see below), or you must perform an asynchronous or transactional RFC without specifying a destination.
All the possible destinations are stored in the database table RFCDES, whose content is managed using transaction SM59. When calling a function module remotely from an ABAP program, the destination is specified using addition DESTINATION of the statement CALL FUNCTION, in the form of a key value in column RFCDEST of database table RFCDES. The relevant rows of the database table contain all parameters defined in transaction SM59 that are used for communicating with the external system.
There are two predefined destinationen that do not have to be entered using transaction SM59:
· Destination "NONE" has the effect that the function module is started on the same application server as the calling program, however through the RFC interface and in its own RFC context. This destination is possible for all types of call.
· Destination "BACK" can be used in a function module that is called remotely, and links back to the caller. You can only specify this 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. For a synchronous callback, the relevant function group is loaded into the internal session of the calling program, if it is not yet available there. The existint RFC connection is used for this callback.
As well as the destinations created in transaction SM59 and the two predefined destinations, you can also specify destinations directly, in the form "hostname_sysid_sysnr". Here, "hostname" refers to the name of the application server, "sysid" is the name of an SAP system, and "sysnr" is the system number, as is displayed using transaction SM51, for example.
No comments:
Post a Comment