Calling RFC Function Modules in ABAP
Calling RFC Function Modules in ABAP
Introduction
You can use the CALL FUNCTION statement to call remote functions, just as you would
call local function modules. However, you must include an additional DESTINATION
clause to define where the function should run:
DESTINATION Dest
EXPORTING F1 = a1
F2 = a2
IMPORTING F3 = a3
CHANGING F4 = a4
TABLES t1 = ITAB
EXCEPTIONS …
The remotefunction field can either be a literal or a variable. The field Dest can be either
a literal or a variable: its value is a logical destination (for example, "hw1071_53")
known to the local SAP System. You can define logical destinations in table RFCDES
using transaction SM59, or using the following menu path: Tools Administration
Administration Network RFC Destinations.
TABLES parameters
The actual table is transferred, but not the table header. If a table parameter is not
specified, an empty table is used in the called function.
The RFC uses a delta managing mechanism to minimize network load during parameter
and result passing. Internal ABAP tables can be used as parameters for function module
calls. When a function module is called locally, a parameter tables is transferred “by
reference". This means that you do not have to create a new local copy. RFC does not
support transfer “by reference”. Therefore, the entire table must be transferred back and
forth between the RFC client and the RFC server. When the RFC server receives the table
entries, it creates a local copy of the internal table. Then only delta information is
returned to the RFC client. This information is not returned to the RFC client every time a
table operation occurs, however; instead, all collected delta information is passed on at
once when the function returns to the client.
The first time a table is passed, it is given an object-ID and registered as a "virtual global
table" in the calling system. This registration is kept alive as long as call-backs are
possible between calling and called systems. Thus, if multiple call-backs occur, the
change-log can be passed back and forth to update the local copy, but the table itself need
only be copied once (the first time).
The Unicode system being called reacts to conversion errors depending on the profile
parameters
rfc/cp_convert/ignore_error
rfc/cp_convert/ignore_error
You can specify the replacement character using its UTF-16 character number; the default
character therefore has the value 0023, and the character ‘~’ would have the value 007E,
for example. You can find a list of the Unicode character numbers at
http://www.unicode.org
Default: Ignore errors and replace characters that cannot be converted with the character
‘#’.
The system making the call receives the exception COMMUNICATION_FAILURE with
the message connection closed.
In the calling system, the reaction to conversion errors can be configured separately for
each destination.
See transaction SM59 Defining Remote Destinations.
For the system being called, a conversion error is not visible. The calling Unicode system
identifies errors in the input data before it triggers an action on the called page; the
calling Unicode system only identifies errors in the output data if the called context has
already been disconnected.
As a remote call
As a local call
The CALL FUNCTION statement and the parameter handling is different for both cases
(this is explained in more detail under Parameter Handling in Remote Calls).
Remote Call:
DESTINATION
‘NONE’
EXPORTING F1 = a1
F2 = a2
TABLES t1 = ITAB
EXCEPTIONS ...
Local Call:
This is a local call, even though the function module is registered as remote. The module
does not run in a separate roll area, and is essentially like a normal function call.
Parameter transfer is handled as for normal function modules. In particular, if the call
leaves some EXPORTING parameters unspecified, it terminates abnormally.
EXPORTING F1 = a1
F2 = a2
TABLES t1 = ITAB
EXCEPTIONS ...
You can also call a function for parallel processing within the same system. For more
details, see Parallel Processing with Aynchronous RFCs.
Calling Remote Functions
You can trigger this call-back mechanism by using the special destination name “BACK”.
If this name is specified in an RFC call on the system acting as the server, the system uses
the same RFC connection that was established when the server received the first call.
Once an RFC connection is established, it is maintained until it is either explicitly closed
or until the calling program terminates. During a call-back, the system will always
attempt to use existing RFC connections before establishing a new one.
In the diagram, remote function B of System B invokes remote function A in the calling
System A.
CALL FUNCTION - RFC (RFC Variants)
Synchronous RFC
Asynchronous RFC
Transactional RFC
3. CALL FUNCTION func IN BACKGROUND TASK
[DESTINATION dest]
parameter_list
[AS SEPARATE UNIT].
Effect
Exceptions
Cause: Missing communication type (I for internal connection, 3 for ABAP) when
executing an asynchronous RFC
Runtime error: CALL_FUNCTION_DESTINATION_NO_T
Cause: The specified destination (in load distribution mode) does not exist.
Runtime error: CALL_FUNCTION_NO_LB_DEST
Cause: The function module being called is not flagged as being "remotely" callable.
Runtime error: CALL_FUNCTION_NOT_REMOTE
Cause: While executing an RFC, an error occurred that has been logged in the calling
system.
Runtime error: CALL_FUNCTION_REMOTE_ERROR
Cause: Logon data for the user is incomplete.
Runtime error: CALL_FUNCTION_SIGNON_INCOMPL
Cause: Logon attempt in the form of an internal call in a target system not allowed
Runtime error: CALL_FUNCTION_SIGNON_INTRUDER
Cause: RFC without valid user ID only allowed when calling a system function
module. The meaning of the error codes is the same as for
CALL_FUNCTION_SINGLE_LOGIN_REJ.
Runtime error: CALL_FUNCTION_SYSCALL_ONLY
Cause: Data error (info internal table) during a 'Remote Function Call'.
Runtime error: CALL_FUNCTION_TABINFO
Cause: For asynchronous RFC only: task name is already being used.
Runtime error: CALL_FUNCTION_TASK_IN_USE
Cause: For asynchronous RFC only: the specified task is already open.
Runtime error: CALL_FUNCTION_TASK_YET_OPEN
Cause: No RFC authorization
Runtime error: CALL_FUNCTION_NO_AUTH
Effect
Synchronous call of a remote-capable function module specified in func using the RFC
interface. With the addition DESTINATION, the destination is specified in dest.
Character-type data objects are expected for func and dest. The calling program is
continued using the statement CALL FUNCTION, if the remotely called function has
finished.
Syntax
... [EXPORTING p1 = a1 ... pn = an]
[IMPORTING p1 = a1 p2 = a2 ...]
[CHANGING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...]
[EXCEPTIONS exc1 = n1 exc2 = n2 ... [MESSAGE mess]
[OTHERS = n_others]].
Effect
These additions are used to assign actual parameters to the formal parameters of the
function module, and return values to exceptions that are not class-based. The additions
have the same meanings as for the general function module call, the only differences
being that, with the addition TABLES, only tables with flat character types can be
transferred, and that if a header line exists, it is not transferred. The additions
EXPORTING, IMPORTING and CHANGING allow you to transfer tables that have deep
character types, deep structures, and strings.
For EXCEPTIONS, you can also specify an optional addition MESSAGE for the special
exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE. If one of these
exceptions occurs, the first line of the corresponding short dump is entered in the field
mess, which must be flat and of character-type.
Transferring tables using the addition TABLES is considerably faster than using the
other additions, since a binary format is used internally instead of an XML format.
SYSTEM_FAILURE
This exception reports all failures and system problems on the remote machine.
COMMUNICATION_FAILURE
This exception is raised when a connection or communications failure occurs. It does not
report system problems (for example, abnormal termination) that occur on the remote
machine.
In the function modules that you call, you should use exceptions for any error reporting,
and not the MESSAGE keyword.
CALL FUNCTION Remotefunction
DESTINATION Dest
EXPORTING...
IMPORTING...
TABLES...
EXCEPTIONS
The system sets the message variable (msg) to the system message. You can then display
the message or log it in a file. You should not try to interpret message text in your
program.
You can use MESSAGE only with the two system exceptions described here.
The called function module is executed exactly once in the RFC server system. The
remote system need not be available at the time when the RFC client program is
executing a tRFC. The tRFC component stores the called RFC function together with the
corresponding data in the database of the SAP system, including a unique transaction
identifier (TID).
If a call is sent, and the receiving system is down, the call remains in the local queue until
a later time. The calling dialog program can proceed without waiting to see whether or
not the remote call was successful. If the receiving system does not become active within
a certain amount of time, the call is scheduled to run in batch.
The system logs the remote call request in the database tables ARFCSSTATE and
ARFCSDATA with all of its parameter values. You can display the log file using
transaction SM58. When the calling program reaches a COMMIT WORK, the remote
call is forwarded to the requested system for execution.
All tRFCs with a single destination that occur between one COMMIT WORK and the
next belong to a single logical unit of work (LUW). For more information on LUWs,
TIDs and on checking the status of transactional calls, see Transactional Integrity of
tRFCs.
Transactional RFC requests are transferred, with parameter data in byte-stream form,
using TCP/IP or X400.
As an example, you can use transactional RFCs for specific types of update procedures.
Some complex dialogs require that several related database tables be updated during
different phases within a transaction. If the update functions needed are located on a
remote machine, and if it is not essential that the table changes be carried out
immediately before continuing the dialog, you can use transactional RFC calls. Instead of
having to wait for each separate update procedure to be completed, the user can proceed
to the end of the transaction without delay. Transactional RFC processing ensures that all
the planned updates are carried out when the program reaches the COMMIT WORK
statement.
Function modules that are to be called transactionally, cannot have any EXPORT
parameters in the definition, since an IMPORTING parameter in the calling program
leads to a syntax error.
Note also that you cannot make asynchronous calls to functions that perform call-backs.
If the remote system is unavailable, the SAP System schedules the report RSARFCSE for
background processing with the relevant transaction ID as variant. This report, which
forwards asynchronous calls for execution, is called repeatedly until it succeeds in
connecting with the desired system.
When scheduled in batch, RSARFCSE runs automatically at set intervals (the default is
every fifteen minutes, for up to 30 attempts). You can customize this interval and the
length of time the program should go on trying. To do this, use the extension programs
SABP0000 and SABP0003 (or see the SAP Extension Concept and CALL CUSTOMER-
FUNCTION).
If the system is not reachable within the specified amount of time, the system stops
calling RSARFCSE, and the status CPICERR is written to the ARFCSDATA table.
Within another specified time (the default is eight days), the corresponding entry in the
ARFCSSTATE table is deleted (this limit can also be customized). (It is still possible to
start such entries in transaction SM59 manually.)
Addition:
Effect
Transactional call of a remote-capable function module specified in func using the RFC
interface. You can use the addition DESTINATION to specify an individual destination in
dest. If the destination has not been specified, the destination NONE is used implicitly.
Character-type data objects are expected for func and dest.
When the transactional call is made, the name of the called function, together with the
destination and the actual parameters given in parameter list, are registered for the current
SAP LUW in the database tables ARFCSSTATE and ARFCSDATA of the current SAP
system under a unique transaction ID (abbreviated as TID, stored in a structure of type
ARFCTID from the ABAP Dictionary, view using transaction SM58). Following this
registration, the program making the call is continued by way of the statement CALL
FUNCTION.
When executing the COMMIT WORK statement, the function modules registered for
the current SAP LUW are started in the sequence in which they were registered. The
statement ROLLBACK WORKdeletes all previous registrations of the current SAP
LUW.
If the specified destination is not available for COMMIT WORK, an executable called
RSARFCSE is started in the background. This attempts to start the functional modules
registered for an SAP LUW in their destination, every 15 minutes up to a total of 30
times. You can make changes to these parameters using transaction SM59. If the
destination does not become available within the given time, this is noted in the database
table ARFCSDATA as a CPICERR entry. By default, this entry in database table
ARFCSSTATE is deleted after 8 days.
Addition
Effect
When using the addition AS SEPARATE UNIT, the relevant function module is executed
in a separate context, a context in which the global data of the function group is not
influenced by previous calls. Each function module that is registered with the addition AS
SEPARATE UNIT is given a separate transaction ID. Without the addition AS
SEPARATE UNIT, the usual description is applicable for the context of the called
function modules. What this means is that, when using the same destination for multiple
calls of function modules belonging to the same function group, the global data of this
function group is accessed collectively.
The transactional RFC (tRFC) is suitable for realizing LUWs in distributed environments
(a typical application is ALE). Here it must be noted that although executing the function
modules within a transaction ID is predefined, the sequence of the LUWs on the RFC
servers does not necessarily correspond to the sequence of SAP LUWs in the RFC client.
To achieve a serialization on the RFC servers as well, the tRFC can be enhanced to
queued RFC (qRFC). For this, you can call function module
TRFC_SET_QUEUE_NAME before a transactional RFC.
Syntax
... [EXPORTING p1 = a1 p2 = a2... ]
[TABLES t1 = itab1 t2 = itab2 ...] ... .
Effect
These additions are used to assign actual parameters to the formal parameters of the
function module. The significance of the additions is the same as for synchronous RFC
with the exception that no values can be copied with IMPORTING and CHANGING, and
no return values can be allocated to exceptions that are not class-based.
Transactional Integrity of tRFCs
Transactional RFCs receive there name from the fact that the associated remote function
call mechanism guarantees transactional integrity for all calls made with the IN
BACKGROUND TASKsuffix. As with database updates, LUWs (logical units of work)
are created for calls that are scheduled to run in background tasks. All tRFCs with a
single destination that occur between one COMMIT WORK and the next belong to a
single LUW. Within a given LUW, all calls:
run as a single transaction: they are either committed or rolled back as a unit.
LUWs are identified by transaction IDs that are unique world-wide. The transaction ID
can be determined from an ABAP program by calling function module
ID_OF_BACKGROUNDTASK. (You must call this function after the first asynchronous
CALL, and before the related COMMIT WORK.)
Because the RFC is like a transaction, database operations are either all executed or, if a
function module terminates, all rolled back. If an LUW runs successfully, you cannot
execute it again. In some cases, it may be necessary to program the roll back of an LUW,
(for example, because a table is locked). To do this, you call the function module
RESTART_OF_BACKGROUNDTASK which performs a rollback and ensures that the
LUW is executed again later.
Normally, the LUW is executed immediately after COMMIT WORK in the specified
target system. However, you can also define a certain time at which you want the
execution to be made. To do this, call the function module
START_OF_BACKGROUNDTASK from within the affected LUW after the first
CALL... IN BACKGROUND TASK and before COMMIT WORK.
Checking the Status of Transactional Calls
All transactional RFCs are stored in the tables ARFCSSTATE and ARFCSDATA. Here,
each LUW is identified by a unique ID. When a COMMIT WORK is made, the calls
belonging to this ID are executed in the target system. The system function module
ARFC_DEST_SHIP transports the data to the target system and the function module
ARFC_EXECUTE executes the stored function calls. If an error or an exception occurs
during one of the calls, all the database operations started by the preceding calls are rolled
back and an appropriate error message is written to the file ARFCSSTATE.
There are two methods for checking on the status of a transaction ID:
Once you have identified the ID of the LUW, you can use the function module
STATUS_OF_BACKGROUNDTASK to determine the status of the transactional RFC.
EXCEPTIONS = 01
COMMUNICTATION
RECORDED = 02
(ARFC is scheduled)
ROLLBACK = 03
Online
Call transaction SM58 (Tools Administration Monitoring Transactional RFC).
This tool lists only those transactonal RFCs that could not be carried out successfully or
that had to be planned as batch jobs. The list includes the LUW ID and an error message.
Error messages displayed in SM58 are taken from the target system. To display the text of
the message, double-click on the message.
Transaction SM58 also lets you control your transactional RFC at various stages. If the
call ends abnormally during the sending process, you may need to use the Rollback LUW
function to manually rollback the LUW before attempting a resend. If the target system
was unavailable, you can use the Backgr.job function to display the batch job created for
your call. Execute funct. module lets you restart the call after the occurrence of a
temporary error (such as a syntax error).
RFC API
Whereas the first version of the RFC, the synchronous RFC, (sRFC) required both
systems involved to be active in order to produce a synchronous communication, the
subsequent generations of RFC had a greater range of features at their disposal (such as
serialization, guarantee for one-time-only execution, and that the receiver system does
not have to be available). These features were further enhanced through the queued RFC
with inbound/outbound queue.
Communication between applications within an SAP system and also with a remote
system can basically be achieved using the Remote Function Call (RFC). Here, the
following scenarios are possible:
The following communication model shows what these communication scenarios may
look like in reality. The actual sending process is still done by the tRFC (transactional
Remote Function Call). Inbound and outbound queues are added to the tRFC, leaving us
with a qRFC (queued Remote Function Call). The sender system is also called the client
system, while the target system corresponds to the server system.
This scenario is appropriate is the data being sent is independent of each other. A calling
application (or client) in system 1 uses a tRFC connection to a called application (or
server) in system 2. In this scenario, data is transferred by tRFC, meaning that each
function module sent to the target system is guaranteed to be executed one time only. You
cannot define the sequence in which the function modules are executed, nor the time of
execution. If an error occurs during the transfer, a batch job is scheduled, which sends the
function module again after 15 minutes.
In this scenario, as well as an outbound queue in the sender system (client), there is also
an inbound queue in the target system (server). If a qRFC with inbound queue exists, this
always means that an outbound queue exists in the sender system. This guarantees the
sequence and efficiently controls the resources in the client system and server system.
The inbound queue only processes as many function modules as the system resources in
the target system (server) at that time allow. This prevents a server being blocked by a
client. A scenario with inbound queue in the server system is not possible, since the
outbound queue is needed in the client system, in order to guarantee the sequence and to
prevent individual applications from blocking all work processes in the client system.
To help you decide which communication type you should use in your system landscape
for your requirements, the advantages of the three communication types are listed below:
1. ...
1. 1. tRFC: for independent function modules only
2. 2. qRFC with outbound queue: guarantees that independent function modules
are sent one after each other and one time only (serialization). Suitable for
communication with non-SAP servers.
3. 3. qRFC with inbound queue: in addition to the outbound queue in the client
system, an inbound queue makes sure that only as many function modules are
processed in the target system (server) as the current resources allow. Client and
server system must be SAP systems. One work process is used for each inbound
queue.
4. 4.
To view the entire qRFC directory tree, choose Synchronize from the upper left part
of the screen. You can then navigate through the entire qRFC documentation.
When the caller starts an asynchronous RFC, the called server must be available to
accept the request.
The parameters of asynchronous RFCs are not logged to the database, but sent directly to
the server.
Asynchronous RFCs allow the user to carry on an interactive dialog with the remote
system.
The calling program can receive results from the asynchronous RFC.
You can use asynchronous remote function calls whenever you need to establish
communication with a remote system, but do not want to wait for the function’s result
before continuing processing. Asynchronous RFCs can also be sent to the same system.
In this case, the system opens a new session (or window). You can then switch back and
for between the calling dialog and the called session
DESTINATION ...
EXPORTING...
TABLES ...
EXCEPTIONS...
TABLES
EXPORTING
passes values of fields and field strings from the calling program to the
function module. In the function module, the corresponding formal
parameters are defined as import parameters.
EXCEPTIONS
IMPORTING
TABLES
EXCEPTIONS
The addition KEEPING TASK prevents an asynchronous connection from being closed
after receiving the results of the processing. The relevant remote context (roll area) is
kept for re-use until the caller terminates the connection.
RECEIVE
WAIT UNTIL
RFC Example
The remotely called function module can, for example, display a new screen using CALL
SCREEN, allowing the user to enter a dialog that connects him or her directly to the
remote system:
Client System
DESTINATION Dest
Server System
FUNCTION Remotefunction.
ENDFUNCTION.
If you do not specify a destination, the asynchronous RFC mechanism starts a new
session within the calling system.
Once the called function is completed, the next dialog step in the calling program (such
as AT USER-COMMAND) guides the system into the FORM routine that checks for
results. This FORM routine consists of a special syntax and must be called with a using
parameter that refers to the name of the task:
Client System
DESTINATION Dest
...
IMPORTING F1 = a1
ENDFORM.
* Exception handling
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE MSG
IF SY-SUBRC = 0.
ELSE.
WRITE MSG
ENDIF.
...
AT USER-COMMAND.
IF SY-UCOMM = ‘OKCD’.
IF MSG = SPACE.
ELSE.
WRITE MSG.
ENDIF.
ENDIF.
...
EXCEPTIONS
ENDFORM.
Keeping the Remote Context
KEEPING TASK
...
ENDFORM.
The relevant remote context (roll area) is kept until the caller terminates the connection.
If you specify the same task name, you can re-use the remote context and roll area.
If the remote function module performs interactive tasks such as processing lists or
dynpros, screens are displayed until the calling program terminates. If the remote call is
made in debugging mode, this mode is visible until the caller dialog is terminated.
You should use the addition KEEPING TASK only if you want to re-use the current
remote context for a subsequent asynchronous call.
Keeping a remote context increases storage load and decreases performance due to
additional roll area management in the system.
Before you implement parallel processing, make sure that your application and your SAP
system meet these requirements:
The data processing task that is to be carried out in parallel must be logically independent
of other instances of the task. That is, the task can be carried out without reference to
other records from the same data set that are also being processed in parallel, and the task
is not dependent upon the results of others of the parallel operations. For example,
parallel processing is not suitable for data that must be sequentially processed or in which
the processing of one data item is dependent upon the processing of another item of the
data.
ABAP requirements:
The function module that you call must be marked as externally callable. This
attribute is specified in the Remote function call supported field in the function
module definition (transaction SE37).
The called function module may not include a function call to the destination
“BACK.”
The calling program should not change to a new internal session after making
an asynchronous RFC call. That is, you should not use SUBMIT or CALL
TRANSACTION in such a report after using CALL FUNCTION STARTING
NEW TASK.
You cannot use the CALL FUNCTION STARTING NEW TASK
DESTINATION IN GROUP keyword to start external programs.
System resources:
In order to process tasks from parallel jobs, a server in your SAP system must have at
least 3 dialog work processes. It must also meet the workload criteria of the parallel
processing system: Dispatcher queue less than 10% full, at least one dialog work process
free for processing tasks from the parallel job.
You can implement parallel processing in your applications by using the following
function modules and ABAP keywords:
check that the parallel processing group that you have specified is correct.
find out how many work processes are available so that you can more
efficiently size the packets of data that are to be processed in your data.
With this ABAP statement, you are telling the SAP system to process function module
calls in parallel. Typically, you’ll place this keyword in a loop in which you divide up the
data that is to be processed into work packets. You can pass the data that is to be
processed in the form of an internal table (EXPORT, TABLE arguments). The keyword
implements parallel processing by dispatching asynchronous RFC calls to the servers that
are available in the RFC server group specified for the processing.
Note that your RFC calls with CALL FUNCTION are processed in work processes of
type DIALOG. The DIALOG limit on processing of one dialog step (by default 300
seconds, system profile parameter rdisp/max_wprun_time) applies to these RFC calls.
Keep this limit in mind when you divide up data for parallel processing calls.
Call immediately after the CALL FUNCTION keyword to get the name of the server on
which the parallel processing task will be run.
Excludes a particular server from further use for processing parallel processing tasks. Use
in conjunction with SPBT_GET_PP_DESTINATION if you determine that a particular
server is not available for parallel processing (for example, COMMUNICATION
FAILURE exception if a server becomes unavailable).
Required if you wish to wait for all of the asynchronous parallel tasks created with CALL
FUNCTION to return. This is normally a requirement for orderly background processing.
May be used only if the CALL FUNCTION includes the PERFORMING ON RETURN
addition.
Required if you wish to receive the results of the processing of an asynchronous RFC.
RECEIVE retrieves IMPORT and TABLE parameters as well as messages and return
codes.
You use the following destination additions to perform parallel execution of function
modules (asynchronous calls) in the SAP system:
The addition first determines the amount of resources (work processes) currently
available (i.e. in all servers or in a group of application servers, comparable with login
servers). The resources available for executing asynchronous calls on each application
server depends on the current system load.
The applications developer is responsible for the availability of RFC groups in the
production system (i.e. the customer's system). For details on how to maintain the RFC
groups, see Maintaining Group Destinations For Load Distribution.
First, the system determines the length of the dispatcher queue for the relevant
application server. If it is greater than 10% of the overall length, the server makes no
resources available. If it is smaller, the system makes available the current number of free
dialog processes minus 2 (as a reserve instance for other purposes, e.g. for logon to the
system or administration programs). Thus, one application server must have at least 3
dialog processes if RFC parallel processing is taken into account.
You are recommended (for performance and other reasons) to use an RFC
group with sufficient resources for parallel processing of asynchronous
calls
Additions:
Effect
Asynchronous call of a remote-capable function module specified in func using the RFC
interface. You can use the addition DESTINATION to specify a single destination in
dest, or to specify a group of application servers by using IN GROUP. The latter
supports parallel processing of multiple function modules. The calling program is
continued using the statement CALL FUNCTION, as soon as the remotely called
function has been started in the target system, without having to wait for its processing to
be finished. You can use PERFORMING and CALLINGto specify callback routines for
copying results when the remotely called function is finished. Character-type data objects
are expected for func and dest.
If the destination has not been specified, the destination NONE is used implicitly. When
the destination NONE is used, a new main session is opened for the current user session.
The asynchronous RFC does not support communication with external systems or
programs written in other programming languages.
A character-type data object must be specified for task, one which contains for the
remotely called function module a freely definable task ID that has a maximum eight
digits. This task ID must be unique for each call, and is handed to the callback routines
for identifying the function. Each task ID defines a separate RFC connection with its own
context, meaning that, in the case of repeated function module calls of the same task ID,
the global data of the relevant function group can be accessed, if the connection still
exists.
In dialog processing, note that the maximum number of six main sessions cannot be
exceeded, else an error message is displayed.
Addition 1
Effect
For group, you must specify a data object of the type RZLLI_APCL from the ABAP
Dictionary, one that is either initial, or one that includes the name of an RFC server group
created in transaction RZ12. When specifying DEFAULT, or if group is initial, all
application servers that are currently available in the current SAP system are used as a
group. Only one RFC server group may be used within a program. During the first
asynchronous RFC using the addition IN GROUP, the specified RFC server group is
initialized. For each asynchronous RFC where the group is specified, the most suitable
application server is determined automatically, and the called function module is
executed on this.
If the function module cannot be executed on any application server, due to not enough
resources being currently available, this leads to the predefined exception
RESOURCE_FAILURE, to which a return value can be assigned, in addition to the
remaining RFC exceptions. For this exception, the addition MESSAGE is not permitted.
The parallel processing of function modules using the addition IN GROUP makes
optimum use of the resources available, and is preferred to self-programmed parallel
processing with destinations that are specified explicitly.
An application server that is used as part of an RFC server group for parallel
processing must have at least three dialog work processes, of which one is currently free.
Other resources such as requests in the queue, number of system logons and so on, are
also taken into account, and are not allowed to exceed certain limit values.
To ensure that only those application servers that have enough resources are
accessed, we recommend that you work with explicitly defined RFC server groups
instead of working with the addition DEFAULT.
The function modules of the function group SPBT provide service functions for
parallel processing, for example, initialization of RFC server groups, determining the
used destination, or temporarily removing an application server from an RFC server
group.
Addition 2
Effect
You can use this addition to specify either a subprogram subr or, as of Release 6.20, a
method meth as a callback routine, which is executed after the asynchronously called
function module has finished. For subr, you have to directly specify a subprogram of the
same program. For meth, you can enter the same details as for the general method call.
The specified subprogram subr can have exactly one SING parameter of type clike only.
The method meth must be public, and can have only one non-optional input parameter
p_task of type clike. When the RFC interface is called, this parameter is supplied with
the task ID of the remotely called function that was specified in the call in task. The
results of the remote function can be received in the subprogram subr or method meth
using the statement RECEIVE. In the callback routine, no statements can be executed
that cause the program run to terminate or end an SAP LUW. Statements for list output
are not executed.
Prerequisite for executing a callback routine is that, after the remote function has ended,
the calling program is still internally available. It is then executed the next time the work
process is changed. If the program has ended, or if it is part of a call sequence in the
stack, then the callback routine is not executed. The statement WAIT can be used to stop
the program execution until certain or all callback routines have been executed.
Syntax
These additions are used to assign actual parameters to the formal parameters of the
function module, and return values to exceptions that are not class-based. These additions
have the same meaning as for the synchronous RFC. The only exception is that no values
can be copied with IMPORTING and CHANGING.
RECEIVE
RECEIVE
Syntax
Addition:
Effect
This statement can be used in a callback routine specified for the asynchronous RFC, in
order to receive output parameters of an asynchronously called function func in the
parameter list parameter list, and to assign return values to exceptions.
If a function module is started multiple times in a row using asynchronous RFC, the
execuction sequence is not fixed, instead it depends in the system availability.
Addition
With the addition KEEPING TASK, the asynchronous RFC connection is retained, as is
the context of the called function module along with it. When a new call is made with the
same task ID, the same global data of the function group is addressed. Without the
addition KEEPING TASK, an asynchronous RFC connection is finished after the remote
function is executed or the results are copied.
You must only use the addition KEEPING TASK if the context of the called function
module is required for other function calls.
RECEIVE - parameter_list
Syntax
... [IMPORTING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...]
[EXCEPTIONS exc1 = n1 exc2 = n2 ... [MESSAGE mess]
[OTHERS = n_others]].
Effect
With these additions, the defined formal parameters of the function module specified in
func are transferred to the actual parameters of the callback routine in the calling
program , and return values are assigned to non-class-based exceptions. The meaning of
the additions is the same as for a synchronous RFC. In particular, the special exceptions
SYSTEM_FAILURE and COMMUNICATION_FAILURE can be assigned return values.
If no exceptions occur, RECEIVE sets the contents of sy-subrc to 0.
WAIT UNTIL
WAIT UNTIL
Syntax
Addition:
Effect
This variant of the statement WAIT is only intended to be used after an asynchronous
RFC with callback routines. It interrupts the program execution for as long as the result
of the logical expression log_exp is false. Any logical expression can be specified for
log_exp.
If the result of log_exp is false, the program waits until a callback routine of a function
that was previously called asynchronously has been executed, and then checks the logical
expression again. If the result of the logical expression is true, or if the callback routines
of all functions that were previously called asynchronously have been executed, then the
program execution continues with the statement following WAIT.
Addition
Effect
System Fields
sy-
subrc Meaning
0 The logical condition log_exp was fulfilled.
4 No asynchronous function calls exist.
Maximum time exceeded while specifying the addition
8
UP TO.
The statement WAIT causes a switch in the work process, which is linked to the
rollout and rollin of all loaded programs. For this reason, the time given in sec must not
be less than one second, to avoid burdening the system with too many work process
switches.
Each time the statement WAIT is used, a database commit is performed. For this
reason, WAIT must not be used between Open SQL statements that open or close a
database cursor.
There is also one variant of the statement WAIT that can be used independently of
the asynchronous RFC.
Exceptions
Exceptions that cannot be processed
Cause: Undefined state of the statement WAIT
Runtime error: WAIT_ILLEGAL_CONTROL_BLOCK
Cause: Negative time entry for sec.
Runtime error: WAIT_ILLEGAL_TIME_LIMIT
RFC Example
RFC Example
Parallel, asynchronous processing of the function module RFC_SYSTEM_INFO using
asynchronous Remote Function Calls. Ten calls are made, each occurring in separate
work processes due to them having different task IDs name. In the callback routine
rfc_info, the completed function modules are counted, and information about the target
system is received.
Through using the addition GROUP DEFAULT, the execution is distributed across all
application servers of the current system. If no more free work processes are available
after at least one successful call, the execution of the program is stopped until all function
modules started up to that point have been completed. This stoppage is limited to a
maximum of 5 seconds.
After all function modules have been started, the system waits until all callback routines
have been executed. After that, the internal table task_list filled there is output. The
output shows the sequence in which the individual tasks completed, and on which
application server each of them was executed.
DO 10 TIMES.
indx = sy-index.
CONCATENATE 'Task' indx INTO name.
CALL FUNCTION 'RFC_SYSTEM_INFO'
STARTING NEW TASK name
DESTINATION IN GROUP DEFAULT
PERFORMING rfc_info ON END OF TASK
EXCEPTIONS
system_failure = 1 MESSAGE mess
communication_failure = 2 MESSAGE mess
resource_failure = 3.
CASE sy-subrc.
WHEN 0.
snd_jobs = snd_jobs + 1.
WHEN 1 OR 2.
MESSAGE mess TYPE 'I'.
WHEN 3.
IF snd_jobs >= 1 AND
exc_flag = 0.
exc_flag = 1.
WAIT UNTIL rcv_jobs > = snd_jobs
UP TO 5 SECONDS.
ENDIF.
IF sy-subrc = 0.
exc_flag = 0.
ELSE.
MESSAGE 'Resource failure' TYPE 'I'.
ENDIF.
WHEN OTHERS.
MESSAGE 'Other error' TYPE 'I'.
ENDCASE.
ENDDO.
Programming Help
Debugging Remote Function Modules
If required, you can find more detailed information about function modules under:
Function Builder
To view the entire directory tree of the function module documentation, choose
Synchronize from the upper left part of the screen. You can then navigate through the
entire function module documentation.
2. ...
5. 1. Write the code for the function module.
For guidelines for creating function modules in the Application Server ABAP Repository,
see: Function Builder
In the function module Administration screen (transaction code SE37), set the field Can
be called via Remote Function Call. Registering a module as remote causes an RFC stub
to be generated for it.
7. 3.
Define the destination of the RFC server in the RFC client system that calls the remote
function.
Either you or your system administrator can maintain the RFCDES table using
transaction SM59 (Tools Administration, Administration Network RFC
destinations). For more detailed information, see Maintaining Remote Destinations.
You can then use this destination in your programs to call the function module.
Programming Tips
Programming Tips
The following sections describe some points to remember when you write a remote
function module.
Declaring Parameters
For normal (non-remote) function modules, if a parameter is not defined like an ABAP
Dictionary field, it takes the data type of the actual parameter used at run-time. A remote
function module, however, does not have this information available. As a result, all
parameter fields for a remote function module must be defined as reference fields, that is,
like ABAP Dictionary fields. (This applies to IMPORT, EXPORT, CHANGING and
TABLES parameters.)
For character structures or fields, the caller's parameters need not be as long as expected
by the called program. When incoming parameters are shorter, RFC simply pads them
with blanks. This means that the ABAP Dictionary definition of character parameters
need not be exactly the same on the calling and called sides. (However, the caller's
parameters may not be longer than expected on the called side).
Writing for Transactional Execution
There are two restrictions on writing remote functions that are to be called
transactionally:
Exceptions
You can trigger exceptions in a remote function just as you would in a locally called
function.
A remote function can call other remote functions, just like an ordinary function module.
In particular, it can use the call-back feature to call function modules running in the
system of the original caller.
For more detailed information about callbacks between SAP systems, see Calling Remote
Functions Back.
With remote calls, the ABAP debugger (including the debugging interface) runs on the
local system. Data values and other run information for the remote function are passed in
from the remote system.
Destination Types
Remote destinations are stored in the table RFCDES. The table RFCDES describes
logical destinations for remote function calls (RFCs). You cannot maintain the table
RFCDES directly.
Displaying Destinations
The initial screen shows a tree which that allows you to select different connection types
(such as partner systems or partner programs). For more information, see Destination
Types.
To find a destination, choose Find and enter your selection criteria. A list of suitable
entries is displayed. You can display all the available information for each entry.
Creating Destinations
On the initial screen for destinations, the connection types and all existing destinations
are displayed in a tree structure.
To create a new RFC destination, choose Create. A new screen is displayed with empty
fields in which you make entries.
If you are creating a remote destination, you can enter one particular application server,
or a group of servers to distribute system load.
On the initial screen for destinations (transaction SM59), the connection types and all
existing destinations are displayed in a tree structure.
Testing Destinations
To test a destination, choose the required function from the Test menu.
Destination Types
Each destination has a connection-type field (Connection type) that indicates the system
connection type:
Type 2 entries indicate R/2 systems. No further specification is required. When you create
a type 2 entry, therefore, you only need to specify the host name. All communications
information is already stored in the background info table in the SAP Gateway host. If
you want, you can also specify logon information.
You can specify an application server from the ABAP message server. The application
server is then determined according to the load-balancing process. This applies to RFCs
between two ABAP systems and to RFCs between an ABAP system and an external
system.
Type I entries indicate ABAP systems connected to the same data base as the current
system. These entries are pre-defined and cannot be modified. The entry names are the
same as those used in the SAP Message Server (transaction SM51)
○ hs0010=host name
○ K11=system name (database name)
○ 24=TCP-service name
Type X entries indicate systems where device drivers in ABAP have been specially
installed. When you create a type X entry, you need to specify the name of the ABAP
device driver.
● TCP/IP Connections (Type T)
Type T destinations are connections to external programs that use the RFC library to
receive RFCs. The activation type can be either Start or Registration.
If it is Start, you need to specify the host name and the path name of the program that you
want to start.
The communication method depends on how you select the program location:
○ Explicit host
In this case, the program is started either by the default gateway for the system or
by the explicitly specified gateway (gwrd) via remote shell.
Ensure that the computer with the gateway process can access the specified
computer by entering /etc/ping <host name>.
If you want to start a program on another computer using the remote shell, the
target system must meet certain conditions.
The user ID of the gateway process must exist, and the user’s directory
must contain a file called .rhosts.
The file .rhosts must contain the name of the calling computer.
To check this, log on to the computer containing the gateway process with the
appropriate user ID and enter the command remsh <host name> <program name>.
The <host name> and <program name> must be the same as in SM59 . (If you
call an RFC server program without any parameters, the RfcAccept call always
returns an error code (RFC_HANDLE_NULL), and the program terminates
immediately.)
○ Application Server
When choosing Application server and specifying your program, you can start the
program from the SAP application server.
First, ensure that the program can be accessed from the SAP application server
and that the SAP application server has the authorization to start the program.
To check this, log on with the user ID of the SAP application server (e.g.
c11adm). If possible, change to the working directory of the SAP application
server (/usr/sap/.../D.../work) and try to start the RFC server program manually
from there. (If you call an RFC server program without any parameters, the
RfcAccept call always returns an error code (RFC_HANDLE_NULL), and the
program terminates immediately.)
○ Front-End Workstation
When choosing Front-end workstation and specifying your program, you can start
the program from the SAPGUI.
Ensure that you can access the program with SAPGUI.
Ensure that SAPGUI has the authorization to start the program.
To check this, simply call the RFC server program in your environment.
The function call can also be transactional (CALL FUNCTION... IN
BACKGROUND TASK DESTINATION...).
If the activation type is Registration, you have to identify a registered RFC program.
With an SAP gateway, you can register an RFC server program under this ID and then
wait for RFC calls from other SAP Systems.
● Type M
Type M entries are asynchronous RFC connections to ABAP systems via CMC (protocol
X.400).
● Type S
Select the connection you require. You can choose from the following logon procedures:
● No logon. The server program does not require you to enter a user or password.
● Basic Authentication. The server program requires you to enter a user and
password. Basic Authentication is a standard HTTP authentication method. When the
user logs on to the target system, a user ID and a password are provided for
authentication. This information is then transmitted across the HTTP connection to the
server, in the form of a base64 encoded string in a header variable.
● SSL Client Certificate. If you use client certificates for the authentication,
the client authentication is performed using the Secure Sockets Layer (SSL) protocol. In
this instance, you also have to select the SSL client PSE of the Application Server, which
contains the certificate that is to be used for the authentication. The target system must
treat the system that issues the client certificate of the SAP NW AS as a “trusted” system.
●
On the Logon/Security tab page, you can also activate SSL, so that HTTPS is used
as a protocol (you must then make sure that the correct port is set under Technical
Settings). To define which type of SSL client is used, call the security transaction
STRUST. ( Getting Started with the Trust Manager, Trust Manager).
Here you have a variety of options for authentication in the target system.
The settings on the Technical Settings and Special Options tab pages are
identical to those of connection type G. On the Logon/Security tab page, connection
type H has additional logon processes compared to connection type G. As with the
external server, you can (de)activate SSL and specify an authorization.
As the destination system is an SAP System, you can set the client and language for the
logon as well as the user name and password. If you check Current User, you have
to specify the password again.
The options available for the authentication are Basic Authentication, SAP
Standard, SAP Trusted System and SSL Client Certificate.
● SAP Standard: This method uses a logon like the RFC logon processes. Here, the RFC
Single Sign-On procedures within a system also apply. The same SAP user (client,
language, and user name) is used for logon.
● SAP Trusted System: Trusted RFC logon to another SAP system (see: Trusted System:
Trust Relationships Between SAP Systems).
● SSL Client Certificate: Using the SSL protocol, the logon can be made using client
certificates.
The resources available on each application server depends on the current system load.
3. .
4.
8. 1. Call transaction SM59.
9. 2. From the RFC destination overview screen, choose RFC RFC groups.
the names of any RFC groups that have already been defined
a list of the instances (host, system and instance number) in your SAP system
the current status (active or not) of each server.
10. 3. To define an RFC group, choose Edit Create. Enter a server group name
and an instance in the dialog window.
To add instances to an existing group, double click the group name and enter a new
instance in the dialog window.
By creating duplicate entries, you can assign a server to more than one group. In this
case, jobs that use the group will compete for free work processes on the shared server(s).
Usage examples:
You could use groups to allow different parallel-processed jobs to run at the same time
without competing for the same servers. In this case, the different groups used by the jobs
would specify different servers.
You could also use groups to separate processing from servers on which dialog users are
active. In this case, the group used for processing would name servers other than those in
the logon groups for users.
Here you specify whether the RFC destination is a Unicode system or a non-Unicode
(MDMP) system. A pushbutton gets this information from the target system.
Character Conversion
The RFC terminates when conversion errors occur, or continues despite conversion
errors, whereby non-convertible characters are replaced with replacement characters.
The RFC replaces non-convertible characters with the replacement character ‘#’.
The RFC replaces non-convertible characters with another character that you can
choose.
The RFC uses a preconfigured assignment of text languages to code pages if:
A non-Unicode system calls a function in a Unicode system and does not make
known its assignment list; this is true for systems with kernel older than Release 6.20,
Patch level 375. More recent systems transmit their assignment list to the called Unicode
system, meaning that the preconfiguration is not required.
The following table shows this assignment; the called system uses the transport code
page specified by the caller, to determine whether the data involved is EBCDIC data or
not.
If a calling SAP system is known to the called system as a trusted system, no password
must be supplied.
The calling SAP system must be registered with the called SAP system as a trusted
system. The called system is called the trusting system.
Trust relationships between SAP systems have the following advantages:
Using this feature, you can create a virtual SAP system consisting of various SAP
systems that are called remotely. Remote logon data are checked in the trusting system.
The trust relationship is not mutual, which means, it applies to one direction only. To
establish a mutual trust relationship between two partner systems, you must define each
of the two as trusted systems in its respective partner system.
For additional security, you can make use of SAP’s SNC interface (Secure Network
Communications) for third-party security systems such as Kerberos and SECUDE.
11. 1. If you want to define an SAP system as a trusted system, you must first
create a logical destination that allows a trusted system relationship.
12. 2. From the RFC destination overview screen (transaction SM59), choose
RFC Trusted systems or enter transaction code SMT1.
13. 3. If trusted systems have already been defined, they are displayed in a
hierarchy tree. To display existing trusted systems, expand the nodes in the hierarchy
tree.
14. 4. To create a trusted system, click the Create icon.
15. 5. In the dialog window, enter the destination for the remote system. To
change a destination, see Changing Trusted Destinations below.
16. 6. All the necessary information such as application server name and
security key is supplied automatically.
17. 7. If you want to restrict the validity period of the logon data, enter an end
date in the Validity period field.
18. 8. If you want take over the transaction code of the calling program into the
called system, mark the appropriate checkbox.
19. 9. Only then will an authorization check be performed in the called system
for the transaction code (field RFC_TCODE of the S_RFCACL authorization object,
see Logon Authorization Checks in the Trusting System below).
As you delete a trusted system relationship, the logon screen of the relevant system is
displayed, if no valid logon data are provided. You must log on to that system to complete
the deletion.
You can change existing destinations for each system from the trusted system
maintenance screen (RFC Trusted systems, transaction code SMT1) by clicking on the
Maintain destination pushbutton.
In trusted systems, destinations for trusting systems are automatically created. These
destinations are used when you display trusting systems via RFC Trusting systems
(transaction code SMT2).
To prevent others from making changes to your trusted destination, mark the checkbox
Destination not changeable in the Attributes section. To make the destination changeable
again, double-click the checkbox.
Note that destinations must be kept consistent. For this reason, you are not allowed to
change the ID of the target system, the system number, or the destination name.
In a trusted system, you can obtain a list of all trusting systems. Choose RFC Trusting
systems to display the list of trusting systems.
Click on the name of a trusting system to display the application servers of that system.
The application server names contain the suffix _TRUSTED.
Double-clicking the name of an application server displays a dialog box, in which you
can enter the transaction that you want to execute in the trusting system. You can also
specify whether the transaction is to be executed in the same session, or in a new one.
The logon data used for logging on to a trusting system undergo an authorization check.
The data provided by the trusted system is checked for system name, client, user name,
and other optional data. These data must match the field values of authorization object
S_RFCACL.
The system administrator can check a user’s logon data using the function module
AUTHORITY_CHECK_TRUSTED_SYSTEM.
To test a trusted system, you can perform the authorization checks for the current server
and the trusting system. To do this, choose the menu entry. If no valid logon data are
supplied, the logon screen of the trusted systems appears. You should log on to the
system. If your test is not successful, read the section Troubleshooting in
Trusted/Trusting Systems below.
After creating a trusted system, you have to test the destination. To do this, log on to the
trusted system using remote login.
Alternatively, you can also perform an authorization check for the trusted server. To do
this, select the respective function from the test menu.
If your login attempt fails, you will receive the following message: No authorization to
log in as trusted system (error code = <0|1|2|3>). Note that the special users DDIC and
SAP* must not be used.
Invalid login data (user ID and client) for the trusting system
Solution: Create the user ID for the client in the trusting system.
No trusted system entry exists for the calling system, or the security key for the
system is invalid.
The user does not have a trusted system authorization (object S_RFCACL).
Solution: Check the clock settings on both the client and server host and the
expiration date of the login data. (Note that the default expiration period 00:00:00 means
no limit.)
You can check whether correct login information has been provided for the trusted
system in the trusting system by means of the function module
AUTHORITY_CHECK_TRUSTED_SYSTEM.
If all your tests are successful and you still don’t get access to the trusting system, refresh
the relevant database by choosing Environment Mass changes Reset all buffers
from the user maintenance screen.
To find out the cause of an error, activate the trace flag on the destination details screen,
reproduce the error and read the information provided with the error ID
CALL_FUNCTION_SINGLE_LOGIN_REJ in the short dump created in the called
system (the trusting system).
For more detailed information and practical tips for trusted/trusting relationships, see:
If a calling SAP system is known to the called system as a trusted system, no password
must be supplied.
The calling SAP system must be registered with the called SAP system as a trusted
system. The called system is called the trusting system.
Using this feature, you can create a virtual SAP system consisting of various SAP
systems that are called remotely. Remote logon data are checked in the trusting system.
The trust relationship is not mutual, which means, it applies to one direction only. To
establish a mutual trust relationship between two partner systems, you must define each
of the two as trusted systems in its respective partner system.
For additional security, you can make use of SAP’s SNC interface (Secure Network
Communications) for third-party security systems such as Kerberos and SECUDE.
20. 1. If you want to define an SAP system as a trusted system, you must first
create a logical destination that allows a trusted system relationship.
21. 2. From the RFC destination overview screen (transaction SM59), choose
RFC Trusted systems or enter transaction code SMT1.
22. 3. If trusted systems have already been defined, they are displayed in a
hierarchy tree. To display existing trusted systems, expand the nodes in the hierarchy
tree.
23. 4. To create a trusted system, click the Create icon.
24. 5. In the dialog window, enter the destination for the remote system. To
change a destination, see Changing Trusted Destinations below.
25. 6. All the necessary information such as application server name and
security key is supplied automatically.
26. 7. If you want to restrict the validity period of the logon data, enter an end
date in the Validity period field.
27. 8. If you want take over the transaction code of the calling program into the
called system, mark the appropriate checkbox.
28. 9. Only then will an authorization check be performed in the called system
for the transaction code (field RFC_TCODE of the S_RFCACL authorization object,
see Logon Authorization Checks in the Trusting System below).
As you delete a trusted system relationship, the logon screen of the relevant system is
displayed, if no valid logon data are provided. You must log on to that system to complete
the deletion.
You can change existing destinations for each system from the trusted system
maintenance screen (RFC Trusted systems, transaction code SMT1) by clicking on the
Maintain destination pushbutton.
In trusted systems, destinations for trusting systems are automatically created. These
destinations are used when you display trusting systems via RFC Trusting systems
(transaction code SMT2).
To prevent others from making changes to your trusted destination, mark the checkbox
Destination not changeable in the Attributes section. To make the destination changeable
again, double-click the checkbox.
Note that destinations must be kept consistent. For this reason, you are not allowed to
change the ID of the target system, the system number, or the destination name.
In a trusted system, you can obtain a list of all trusting systems. Choose RFC Trusting
systems to display the list of trusting systems.
Click on the name of a trusting system to display the application servers of that system.
The application server names contain the suffix _TRUSTED.
Double-clicking the name of an application server displays a dialog box, in which you
can enter the transaction that you want to execute in the trusting system. You can also
specify whether the transaction is to be executed in the same session, or in a new one.
The logon data used for logging on to a trusting system undergo an authorization check.
The data provided by the trusted system is checked for system name, client, user name,
and other optional data. These data must match the field values of authorization object
S_RFCACL.
The system administrator can check a user’s logon data using the function module
AUTHORITY_CHECK_TRUSTED_SYSTEM.
Error return codes are explained in the Troubleshooting section below.
To test a trusted system, you can perform the authorization checks for the current server
and the trusting system. To do this, choose the menu entry. If no valid logon data are
supplied, the logon screen of the trusted systems appears. You should log on to the
system. If your test is not successful, read the section Troubleshooting in
Trusted/Trusting Systems below.
After creating a trusted system, you have to test the destination. To do this, log on to the
trusted system using remote login.
Alternatively, you can also perform an authorization check for the trusted server. To do
this, select the respective function from the test menu.
If your login attempt fails, you will receive the following message: No authorization to
log in as trusted system (error code = <0|1|2|3>). Note that the special users DDIC and
SAP* must not be used.
Invalid login data (user ID and client) for the trusting system
Solution: Create the user ID for the client in the trusting system.
No trusted system entry exists for the calling system, or the security key for the
system is invalid.
The user does not have a trusted system authorization (object S_RFCACL).
Solution: Check the clock settings on both the client and server host and the
expiration date of the login data. (Note that the default expiration period 00:00:00 means
no limit.)
You can check whether correct login information has been provided for the trusted
system in the trusting system by means of the function module
AUTHORITY_CHECK_TRUSTED_SYSTEM.
If all your tests are successful and you still don’t get access to the trusting system, refresh
the relevant database by choosing Environment Mass changes Reset all buffers
from the user maintenance screen.
To find out the cause of an error, activate the trace flag on the destination details screen,
reproduce the error and read the information provided with the error ID
CALL_FUNCTION_SINGLE_LOGIN_REJ in the short dump created in the called
system (the trusting system).
For more detailed information and practical tips for trusted/trusting relationships, see:
Solution
Log on to the trusting system S00 (server). Here, create a destination for the trusted
system C00 (client) using transaction SM59 (for example, C00_SYSTEM). It is
important that the option 'Trusted System' is not set to active for this destination (Security
Option Trusted System = No).
logon data in this destination, as someone could use a remote login to misuse this
defined here. This destination must only be used for creating and deleting the
trusted/trusting relationship and not for any other purpose. It must therefore be named
correspondingly.
Call transaction SMT1 (or SM59 and then transaction menu RFC Trusted
Systems).
Choose Create. Enter the destination of the client system (in the example,
C00_SYSTEM) in the dialog box. After confirming this, an RFC logon to the client
system occurs, and the necessary information is exchanged between the systems (S00 <->
C00).
(in the example, C00_SYSTEM), an RFC logon screen is displayed for the
When a trusted relationship has been successfully built, the trusted entry for the client
system (C00) is displayed. If you want to restrict the validity of the logon data for the
client system, enter a timeframe in the corresponding field. The default value (00:00:00)
means that the validity is unrestricted.
In the scenario where the same user and client are used, you can use the menu option
Entry to perform authorization checks: These checks first attempt to reach the client using
the logon data specified in the definition destination (in the example, C00_SYSTEM),
and then try to log back on to the server system with the same logon data, using a trusted
RFC. Choosing the menu option Current Server forces the return path to occur on the
current application server, and choosing menu option Trusting System induces load
balancing, meaning that the logon takes place on any application server in the server
system.
If different users or clients are used for the trusted scenario, you must create an RFC
destination on the client side, and perform an authorization check for the specified logon
data, setting the flag for "Trusted System" to "Yes".
You can now use the configured trusted/trusting relationship to create RFC destinations
in the trusted system (client), which are for the trusting system (server), by using
transaction SM59 and the ‘Trusted System’ flag. The result of this is that, when such
destinations are used for the RFC logon to the trusting system, no password is sent.
A prerequisite for successfully using a trusted/trusting relationship is that the user being
used has the corresponding authorization object S_RFCACL in the trusting server
system. If you want to create a suitable authorization for different
clients and users, note that you have to enter the caller data (caller client and caller user)
of the caller system (in our example from system C00) into the S_RFCACL fields
RFC_CLIENT and RFC_USER. For example, if user U_1 under client M_1 in caller
system C00 wants to work as user U_2 with client M_2 in the called system S00 under a
trusted relationship, then the user (U_2, M_2) in the system S00 must have authorization
ZRFCACL_XXX, which has the following settings:
RFC_SYSID : C00
RFC_CLIENT: M_1
RFC_USER : U_1
RFC_TCODE : *
RFC_INFO : *
ACTVT : 16
The following steps describe how you can enter the above settings for server system S00:
If the same user is always used in the client system and server system for a
trusted/trusting relationship (meaning that U_1 = U_2), the authorization
Z_RFCACL_XXX can also be defined as follows:
RFC_SYSID : C00
RFC_CLIENT: M_1
RFC_TCODE : *
RFC_INFO : *
ACTVT : 16
Setting the authorization field RFC_EQUSER to 'Y' is the same as setting the field
RFC_USER = SY-UNAME for the logged user in the caller system (here, system
C00).
After you have maintained the authorization Z_RFCACL_XXX, you must create an
authorization profile as follows, and link it to the authorization
Z_RFCACL_XXX:
Call SU02 and in the field "Manually edit authorization profiles", enter Z_<C00>
as the authorization profile. Choose "Create work area for profiles" and then
create a new profile. Enter S_RFCACL as the object, and Z_RFCACL_XXX as
the authorization.
You now have to assign the authorization profile you have just created to the
trusted/trusting user. To do this, enter the profile Z_<C00> on the tab page Profile in
transaction SU01.
You can check the authorizations for the logged on users in the current system in
advance, by using the function module AUTHORITY_CHECK_TRUSTED_SYSTEM.
As of Release 40B, for security reasons, the authorization profile SAP_ALL does not
contain an authorization for S_RFCACL.
Authorization errors that occur while using an RFC destination which has the 'Trusted
Systems' flag set to ‘Yes’ are documented with the following messages:
SAP*.
Solution:
Provide the user with the corresponding authorization or avoid using the protected users
DDIC and SAP*. Authorization errors that occur while using an RFC destination which
has the ‘Trusted Systems’ flag set to ‘Yes’ are documented with the following messages:
system.
SAP*.
Solution: Check the system time on the client host and server
validity.)
The trusting transaction SMT2 (or SM59 RFC Trusting Systems) constructs a list of
all trusting systems that have been established for this trusted system. Here, a logon and
authorization check for the current user and client is performed, using the destination
TRUSTING_SYSTEM@S00 that has been automatically created.
This basically corresponds to transaction SM51, if you use Remote Login to perform a
logon on a different application server.
To perform a logon as a different user or client, you have to create a new RFC destination
with a trusted option set.
If the host name contains the character '_' (as in "my_host"), then the generation of the
related trusting system destination may lead to incorrect settings. This problem can be
corrected by implementing Support Package SAPKB46D09 (see below). For earlier
releases, the changes required to correct the problem can be made manually.
Continue with:
An application can make calculations and collect data simultaneously by using the
various types of asynchronous RFCs. This can also happen indirectly, as with the
outbound or inbound queue in qRFC. Every RFC request occupies a dialog work process
on the application server on which the RFC is executed.
The possible configurations of the SAP System are described below.
Integration
Note that RFC calls with CALL FUNCTION are processed in DIALOG work processes.
Therefore, the DIALOG limitation for processing a dialog step (default: 300 seconds,
system profile parameter rdisp/max_wprun_time) also applies to these RFC calls.
Remember to take this limitation into consideration when you are dividing up your data
packets for parallel processing.
The configuration options described here are valid for the following RFC types.
You can use this RFC type to program parallel RFC calls. The resources are checked and
assigned as far as the set quotas allow.
With this ABAP command, you are telling the SAP system to process function module
calls in parallel. The command implements parallel processing by sending asynchronous
RFC calls to the appropriate servers. These are servers in the RFC server group Group
Name specified as being available for processing requests. The group name DEFAULT
means that all available application servers are being used.
If you are using the inbound queue, the inbound scheduler takes over the processing of
the inbound queue. You have to register the queue names to be processed using the
inbound scheduler. To do this, use transaction SMQR.
The inbound scheduler then checks the resources and executes parallel RFCs, if resources
are available. If no resources are available, the scheduler waits until resources become
available.
For more information, see Monitor Transactional RFC and Queued RFC.
The transactional RFC and the qRFC use the resource check. The associated ABAP
language elements for both RFC types is:
This ABAP command flags the function module remote function for asynchronous
processing. The module is not executed immediately. The data transferred with
EXPORTING or TABLES is placed in a database table. A COMMIT WORK then
triggers the function module. There are various cases:
● The data is updated. If tRFC/qRFC has been triggered within the update, these are
executed in parallel after the V1 update (within the update). If the tRFC/qRFC call is
registered in the scheduler, the scheduler is simply triggered within the update. The
execution of tRFC/qRFC takes place outside the update through the scheduler.
● The data is not updated. Then the tRFC/qRFC function modules started within the
application LUW are executed in parallel as far as possible. If local system resources are
exhausted, the tRFC/qRFC is serialized so as not to further increase resource utilization.
This however is not the case if the tRFC/qRFC function modules are processed in batch.
If the tRFC/qRFC have been started in batch, they are always processed in parallel as in
the update process, regardless of the system resource utilization.
No resource checks are run with RFC calls from the update process or batch,
since these must always be processed in parallel to avoid deadlocks. Here
Additional Information
Details about using and programming RFCs can be found in the RFC documentation:
Features
● Describes which resources are relevant for the use of parallel RFCs, and how you can
monitor the available resources system-wide.
● Describes how resources are checked in the system and explains the difference
between local and remote checks (on a different server).
Constraints
Note that the techniques for monitoring and controlling resources described in this
document only apply to the RFC types mentioned above.
Even if you have correctly configured the quotas, your system may still become flooded
with RFCs if these are not of the correct types (such as synchronous RFCs, qRFC,
asynchronous RFCs without the added DESTINATION IN GROUP …).
Known problems, their causes and solutions are described in the following section:
You can see a user overview in transaction SM04. For more information, see Display
and Manage User Sessions.
The communication table contains an entry for every CPIC communication for all parties
involved. The table can contain a maximum of rdisp/max_comm_entries entries.
rdisp/rfc_max_comm_entries
You can see a server overview in transaction SM51. For more information, see
Overview of SAP Application Servers.
When the server is started, it has rdisp/wp_no_diadialog work processes. This number
can, however, be changed while the server is running. One way to do this is to use
operation mode switching. You can find out the current number of processes in the
Process Overview (transaction SM50; see also Display and Control Work Processes).
Of the dialog work processes, the dispatcher keeps rdisp/rfc_min_wait_dia_wp free for
“genuine” dialog requests (not RFC).
The same parameters are used to control the number of plug-in requests (HTTP or SMTP
requests coming from the ICM) that can be processed at the same time. See ICM
Parameters.
The dispatcher checks whether it has free resources for each RFC request it receives. If it
has, it assigns the request to a dialog work process, otherwise it puts the request in the
dispatcher queue. You can control the detail level of this check using parameter
rdisp/rfc_check.
Transaction SARFC is used to monitor the resources on all servers in the SAP system.
This is described in the section Monitoring RFC Resources on the Application Server.
Monitoring RFC Resources on the Application
Server
Use
You can monitor the RFC resources on all application servers and thus find out the load
incurred by parallel RFCs on a server.
You can also dynamically change the various quotas on all servers. For procedure for
doing this is described in the section Dynamically Configuring RFC Quotas.
Procedure
You then see a list of all SAP servers with information for each server, stating whether
resources for asynchronous RFCs are available at the time you executed the transaction
(text Resources ok) . If no resources are available, a short text explaining the reason is
displayed.
Note that this list only represents the situation at the exact moment that you executed the
transaction. Choose Refresh to update the display.
This is a list of the possible results of the resource check with return values and
meanings.
The other return values indicate that the server currently has no available resources for
asynchronous RFCs.
The server may have no resources for one of the following reasons:
The server is not running.
In these cases, the text appears on a red background. You can find out the exact cause of
the problem (for example, where exactly the incorrect configuration is located) by briefly
activating and deactivating the trace for the server (see below). See the dispatcher trace
file dev_disp of the server for the required information.
The individual return values are described below. Each value has a text (appears on a
yellow background).
3: The quota for the RFC communication channels is too small. Increase the parameter
rdisp/rfc_max_comm_entries or change the value dynamically.
5: The local queue for asynchronous RFC responses is full. This queue retains the
responses to asynchronous RFCs until they are sent back to the caller. You can increase
the size of the queue by increasing the value of the parameter rdisp/max_arq.
6: The quota for a dialog work process occupied by an RFC user is too small. Increase the
size of the parameter rdisp/rfc_max_own_used_wp or change the value
dynamically.
8: The quota for the RFC requests in the dialog queue is too small. Increase the size of the
parameter rdisp/rfc_max_queue or change the value
dynamically.
9: the quota for the RFC requests in the dialog queue (rdisp/rfc_max_queue) has reached
its maximum.
10: An error occurred when the request queue length was being determined.
11: The quota for RFC logons to the server is too small. Increase the size of the value of
the parameter rdisp/rfc_max_login.
12: the quota for RFC logons to the server (rdisp/rfc_max_login) has reached its
maximum.
13: The quota for “own” RFC logons to the server is too small. Increase the size of the
parameter rdisp/rfc_max_own_login or change the value dynamically.
14: the quota for own RFC logons to the server (rdisp/rfc_max_own_login) has reached
its maximum.
15: The server has been deactivated and cannot process any requests.
19: The server has just been started and is in the initialization
phase.
Choose Goto Activate Trace. The system then writes the detailed result of the check to
the trace file of the dispatcher on the server in question. To read the file, you have to log
on to the server in question. To do this, open transaction SM51, double-click on the
server name, then choose Process Trace Dispatcher Display File).
It may make sense to do this if, for example, a server constantly has too few resources,
and you want to find out the exact cause.
Section System Configuration for Parallel RFCs describes how to configure your system.