cancel
Showing results for 
Search instead for 
Did you mean: 

rfc

Former Member
0 Kudos

How many types of RFCs are there?

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Purpose

Communication between applications of different systems in the SAP environment includes connections between SAP systems as well as between SAP systems and non-SAP systems. Remote Function Call (RFC) is the standard SAP interface for communication between SAP systems. The RFC calls a function to be executed in a remote system.

Synchronous RFC

The first version of RFC is synchronous RFC (sRFC). This type of RFC executes the function call based on synchronous communication, which means that the systems involved must both be available at the time the call is made.

Transactional RFC (tRFC)

Transactional RFC (tRFC, also originally known as asynchronous RFC) is an asynchronous communication method that executes the called function module in the RFC server only once. 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 SAP database under a unique transaction ID (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.

tRFC is always used if a function is executed as a Logical Unit of Work (LUW). Within a LUW, all calls are

· executed in the order in which they are called

· executed in the same program context in the target system

· run as a single transaction: they are either committed or rolled back as a unit.

Implementation of tRFC is recommended if you want to guarantee that the transactional order of the calls is preserved.

Disadvantages of tRFC

· tRFC processes all LUWs independent of one another. Due to the amount of activated tRFC processes, this procedure can reduce performance significantly in both the send and the target systems.

· In addition, the sequence of LUWs defined in the application cannot be kept. Therefore, there is no guarantee that the transactions are executed in the sequence dictated by the application. The only guarantee is that all LUWs are transferred sooner or later.

Queued RFC (qRFC)

To guarantee that multiple LUWs are processed in the order specified by the application, tRFC can be serialized using queues (inbound and outbound queues). This type of RFC is called queued RFC (qRFC).

qRFC is therefore an extension of tRFC. It transfers an LUW (transaction) only if it has no predecessors (in reference to the sequence defined in different application programs) in the participating queues.

Implementation of qRFC is recommended if you want to guarantee that several transactions are processed in a predefined order.

Reward Points if uesful.

Former Member
0 Kudos

Hi

Hope this will help you.

R F C 3 TYPES OF RFC'S

SYNCHRONOUS R F C:

With synchronous RFC, processing stops in the calling program until the called remote function is processed and its output is returned. Then in the calling program, the processing continues after the call.

The statement CALL FUNCTION ... DESTINATION enables you to call remote ABAP function modules or C routines in external server programs.

When you call a function in this way, always include handling for the standard exceptions COMMUNICATION_FAILURE and SYSTEM_FAILURE.

The exception COMMUNICATION_FAILURE is resolved by the system if the specified destination in the sideinfo table RFCDES is not maintained, or if the connection to the remote system cannot be established.

The exception SYSTEM_FAILURE is resolved if the function module or C routine that you want to start in the remote system is not available.

The connection to a remote destination remains intact for as long as the context of the calling program remains active. The function groups addressed in the remote destination remain active for as long as the calling program itself remains active (this is the same as with local calls). This means that if you call two function modules from the same function group one after the other, they can both access the same global data of the function group.

Each function module called using synchronous RFC forms its own logical unit of work (LUW) (exception:

You can debug function modules called remotely in R/3 - R/3 connections.

If a remotely-called function module uses dialogs (for example, CALL SCREEN,

CALL TRANSACTION or lists), they are executed in the session of the caller (and are fully functional).

Note that RFC dialogs in background processing lead to a program termination with the exception SYSTEM_FAILURE (but you can use RFC within background processing).

ASYNCHRONOUS RFC :

In an asynchronous Remote Function Call, the called remote function is started and then continues processing on its own immediately in the calling program. Remote function processing is separate from the calling program. The function output can be received later in the program.

Asynchronous RFC is intended for parallel processing of processes.

With the addition STARTING NEW TASK you can call a remote function module asynchronously. You can use any task name.

The function module that you call is executed in its own work process.

You can also use aRFC in background processing. Note, however, that even here, each aRFC call occupies a dialog work process.

In the sideinfo table RFCDES, you can set the number of aRFC calls for each destination using the aRFC options. After these aRFC calls an automatic load check is performed on the target server. If resource bottlenecks are detected, the system waits for a short time for the next aRFC call,

meant for the same remote system, and the client program is rolled out of its work process. It can then receive results from previous aRFC calls.

During the call, you may not specify an IMPORTING addition since the call does not wait for the end of the function module. Here, you can only handle the two system exceptions, COMMUNICATION_FAILURE and SYSTEM_FAILURE for the same reason. The function module output must be received and the function module-specific exceptions must be handled later on in a different place. (See following slides)

Receiving the function module output and handling the function module-specific exceptions are optional, however.

A program can receive output (parameters and exceptions) from a function module that is running asynchronously.

To implement this, when you call use the addition "PERFORMING ON END OF TASK", where the specified subroutine must exist in your program, and through which the output of the function module is received using command "RECEIVE RESULTS FROM FUNCTION . .". When the function module ends, the subroutine is called automatically.

The subroutine must also have a formal parameter with any name you choose. When the subroutine is called, it receives the accompanying task name. This parameter lets you see which aRFC call just ended, and you can receive the relevant

output using the RECEIVE RESULTS FROM FUNCTION command.

The subroutine may not contain any statements that interrupt the program execution (such as CALL SCREEN, SUBMIT, COMMIT WORK, WAIT, RFCs, W or I messages). WRITE statements in this subroutine specially defined for aRFC have no effect.

The subroutine can only be executed automatically if the calling program is in rollout status. -> "WAIT UNTIL" statements (see next slide).

The addition KEEPING TASK with the RECEIVE statement causes the function group context that was loaded remotely to wait until the calling program has ended. This lets you use the old remote context with later aRFC calls with the same task name.

The language element WAIT UNTIL with the addition PERFORMING is only useful with aRFC, and otherwise has no effects.

When the WAIT UNTIL statement is executed, the conditions specified are checked.

If it is fulfilled, the program processing continues directly after the WAIT UNTIL statement.

Otherwise the system waits in rollout status for the output from the aRFCs. If the aRFC output is now returned, the form routine specified during the call is executed and is sent back to the WAIT UNTIL statement.

This check/wait procedure repeats until the WAIT conditions are fulfilled, or until there are no more open RFC calls.

Note that the WAIT UNTIL statement sets the SY-SUBRC. Therefore, store the SY-SUBRC value (set in the form routine by exceptions-handling in RECEIVE RESULTS) in its own global variable before leaving the form routine, if you need this value again later (after WAIT UNTIL).

aRFC is particularly suited for implementing parallel processing in several R/3 Systems.

You can also use aRFC within the same SAP R/3 System, for example, to move some of the processing load to an application server specially used for this.

Enter the RFC destination that refers to the corresponding application server. (You can find this under Internal connections in Transaction SM59.)

You can also use aRFC locally within the same application server to implement parallel processing in several work processes.

Here you do not need to specify a destination.

Note, however, that several work processes will be occupied by your program at the same time.

LOAD BALANCING USING RFC GROUPS:

You can divided the application servers for an SAP R/3 System into different RFC groups using Transaction SM59.

When calling a function module within this R/3 System, you can specify one of the defined RFC groups using the addition DESTINATION IN GROUP , which selects the server that has the lowest load in order to execute the function module.

Instead of specifying a specific RFC group, you can also enter the word DEFAULT. The server is selected from all the application servers of the R/3 System.

If all the servers of the specified group are overloaded (see next slide), the exception RESOURCE_FAILURE is triggered.

Note that:

- You have to specify the addition DESTINATION IN GROUP after STARTING NEW TASK as opposed to the DESTINATION addition.

- You can only use this addition within the current SAP R/3 System (you cannot have additional DESTINATION entries).

For each server in the specified RFC group, the system checks if the application server has:

- a dispatcher queue load of < 5%, and

- at least 3 free dialog work processes

The server is considered as not being overloaded only if both of these conditions are met.

If you have called a function module asynchronously and it contains dialogs, the relevant screens are displayed in an additional (new external session) window on the calling side.

When you program, limit the number of external sessions for each dialog user to 6. If the calling dialog user already has 6 external sessions open, the exception SYSTEM_FAILURE is triggered.

TRANSACTIONAL RFC:

Whereas with synchronous and asynchronous RFC each call makes up a single logical unit of work (LUW) in the remote system, you can use transactional RFC to bundle several remote functions into one LUW (with an automatic rollback mechanism in case of error).

You can use tRFC with the addition IN BACKGROUND TASK, which you must place before the DESTINATION entry. If you specify a COMMIT WORK statement, you bundle all the previously transmitted tRFCs in one LUW.

tRFCs are also called asynchronously. Unlike aRFC, the output from the called function module cannot be received.

-> No IMPORTING . . . / PERFORMING . . . ON END OF TASK when calling;

-> No RECEIVE RESULTS FROM FUNCTION . . .

In the source system, you can use the administration transaction SM58 that lets you display and modify tRFC-LUWs.

EXECUTION:

tRFC calls are first stored in the local tRFC tables ARFCSSTATE and ARFCSDATA. The execution status of the LUWs is logged in table ARFCSSTATE, while ARFCSDATA contains the input data for the tRFCs.

If you do not want to execute a remote LUW immediately, rather trigger it at a later time, call the function module START_OF_BACKGROUNDTASK before the COMMIT WORK statement locally. Here, you must enter the date and time of execution.

The COMMIT WORK statement automatically schedules an immediate job or a job set for a later start time to remotely call the LUW. In the job execution, the relevant data is read from the tRFC tables, and the corresponding tRFCs are transmitted. If the remote LUW is executed successfully, the accompanying entries are deleted from the tRFC tables. If an error occurs, an automatic repeat mechanism, or rollback mechanism is activated (see next slide).

If the update is triggered locally because of the COMMIT WORK statement, the tRFCs are only executed when the local update is successfully completed.

WHEN ERROR COMES:

If a connection cannot be made to the partner, this is logged in the tRFC status table ARFCSSTATE (which you can see by using Transaction SM58), and the job is rescheduled. You can set in the destination the number of times the system repeats the effort to connect, and the time intervals, by using the tRFC options. The default is a maximum 30 times with a 15 minute interval.

If, after a tRFC-LUW is successfully executed in the partner system in one of the function modules, the program terminates with an A/X-message (MESSAGE A/X...) or triggers an exception (RAISE...),

- all the changes made in the current LUW are automatically rolled back in the remote system, and

- the remote program termination is logged in the tRFC status table ARFCSSTATE (viewable using SM58) in the source system.

The entries relevant to the LUW remain in the tRFC tables and the execution job is not rescheduled. In this case, you can find the remote error using Transaction SM58, and you have to correct the problem in the remote system. Afterward you must trigger the remote execution again also in Transaction SM58.

If you want to cancel and roll back this remote execution from a remote function module of a tRFC-LUW, but you also want to reschedule the job in the source system (for example, because a master record that is to be processed is locked and the LUW must be executed again), call the function module RESTART_OF_BACKGROUNDTASK in the remote function module instead of MESSAGE A... or RAISE...

Please reward if help.

Former Member
0 Kudos

Hi chaitanya,

there are mainly 3 types of rfc they are:

Synchronous RFC – The calling program continues the execution only after the called function is complete.

Asynchronous RFC - The calling program continues the execution without waiting for return from the called function.

Eg: CALL FUNCTION ‘remotefunction’ STARTING NEW TASK ‘taskname’.

Transactional RFC - The called function module is executed exactly once in the RFC server system.Each function call is seen as a transaction in the target system. Transactional RFCs use the suffix IN BACKGROUND TASK .

Eg : CALL FUNCTION ‘remotefunction’ IN BACKGROUND TASK

Reward if useful.

thanks

swaroop

Former Member
0 Kudos

hi chaitnaya,

Purpose

Communication between applications of different systems in the SAP environment includes connections between SAP systems as well as between SAP systems and non-SAP systems. Remote Function Call (RFC) is the standard SAP interface for communication between SAP systems. The RFC calls a function to be executed in a remote system.

Synchronous RFC

The first version of RFC is synchronous RFC (sRFC). This type of RFC executes the function call based on synchronous communication, which means that the systems involved must both be available at the time the call is made.

Transactional RFC (tRFC)

Transactional RFC (tRFC, also originally known as asynchronous RFC) is an asynchronous communication method that executes the called function module in the RFC server only once. 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 SAP database under a unique transaction ID (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.

tRFC is always used if a function is executed as a Logical Unit of Work (LUW). Within a LUW, all calls are

· executed in the order in which they are called

· executed in the same program context in the target system

· run as a single transaction: they are either committed or rolled back as a unit.

Implementation of tRFC is recommended if you want to guarantee that the transactional order of the calls is preserved.

Disadvantages of tRFC

· tRFC processes all LUWs independent of one another. Due to the amount of activated tRFC processes, this procedure can reduce performance significantly in both the send and the target systems.

· In addition, the sequence of LUWs defined in the application cannot be kept. Therefore, there is no guarantee that the transactions are executed in the sequence dictated by the application. The only guarantee is that all LUWs are transferred sooner or later.

Queued RFC (qRFC)

To guarantee that multiple LUWs are processed in the order specified by the application, tRFC can be serialized using queues (inbound and outbound queues). This type of RFC is called queued RFC (qRFC).

qRFC is therefore an extension of tRFC. It transfers an LUW (transaction) only if it has no predecessors (in reference to the sequence defined in different application programs) in the participating queues.

Implementation of qRFC is recommended if you want to guarantee that several transactions are processed in a predefined order.

The other RFC's are: Parallel RFC

Asynchronous RFC.

Reward if useful.

Thankyou,

Regards.

Former Member
0 Kudos

There are 5 types of RFCs

Synchrnous RFCs

Asynchronous RFCs

Transactional RFCs

Queue RFCs

Parallel RFCs

Regards.

Former Member
0 Kudos

Chaitanya,

Hi,

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE2/BCFESDE2.pdf

TRFC:

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 R/3

database, 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.

Transactional RFCs use the suffix IN BACKGROUND TASK.

QRFC:

The characteristics of qRFC with send queue are:

Queued RFC with send queue enforces a serialization on the side of the send system. The

target system has no information about the serialization in the send system. This allows

communication with any R/3 target system as of Release 3.0.

qRFC with send queue is an enhancement of tRFC. It transfers an LUW (transaction) only if

it has no predecessors (in reference to the sequence defined in different application

programs) in the participating queues. In addition, after executing a qRFC transaction, the

system tries to start all waiting qRFC transactions automatically according to the sequence.

For queue administration, the system needs a queue name and a queue counter for each

qRFC transaction. Each tRFC call to be serialized is assigned to a queue name that can be

determined by the application. The application passes the queue name with the call of

function module TRFC_SET_QUEUE_NAME. This function module is called immediately

before each tRFC call to be serialized. See also Programming Serialization Page 28.

A queue name is a text of up to 24 bytes length. You can choose any text, but you must not

use * (asterisk).

ARFC:

Asynchronous remote function calls (aRFCs) are similar to transactional RFCs, in that the user

does not have to wait for their completion before continuing the calling dialog. There are three

characteristics, however, that distinguish asynchronous RFCs from transactional RFCs:

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) and allows you to switch back and forth between the calling

dialog and the called session.

To start a remote function call asynchronously, use the following syntax:

CALL FUNCTION RemoteFunction STARTING NEW TASK taskname

Destination ...

EXPORTING...

TABLES ...

EXCEPTIONS...

Have a look at the following document which was published recently in the SDN:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f078394a-4469-2910-c4bf-853c7567...

Don't forget to reward if useful

Former Member
0 Kudos

There are five types.

Synchronuos RFC

With synchronous RFC, processing stops in the calling program until the called remote function is processed and its output is returned. Then in the calling program, the processing continues after the call.

Asynchronous RFC

In an asynchronous Remote Function Call, the called remote function is started and then continues processing on its own immediately in the calling program. Remote function processing is separate from the calling program. The function output can be received later in the program.

Transactional RFC

you can use transactional RFC to bundle several remote functions into one LUW (with an automatic rollback mechanism in case of error).

Queued RFC

Parallel RFC

Vinodh Balakrishnan

Former Member
0 Kudos

Tcode: SM59