cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RFC Function Module

Former Member
0 Likes
2,905

Hi all,

I need to create a RFC Function module, I have the RFC destination given, May I know any further seetings needed for a RFC Function Module.

Thanks

Mungala.

View Entire Topic
Former Member
0 Likes

hi

<b>RFC ( Remote Function calls )</b>

A remote function call is a call to a function module running in a system different from the caller's. The remote function can also be called from within the same system (as a remote call).

RFC consists of two interfaces : A calling interface for ABAP Programs and a calling interface for Non-SAP programs.

Any ABAP program can call a remote function using the CALL FUNCTION...DESTINATION statement. The DESTINATION parameter tells the SAP System that the called function runs in a system other than the caller's.

<b>RFC CLIENT and RFC SERVER</b>

RFC client is the instance that calls up the Remote Function Call to execute the function that is provided by an RFC server.

The RFC Interface takes care of :-

- Converting all parameter data to the representation needed in the remote system

Calling the communication routines needed to talk to the remote system.

Handling communications errors, and notifying the caller, if desired ( using EXCEPTIONS paramater of the CALL FUNCTION).

<b>Calling Remote function modules</b>

You can use the CALL FUNCTION statement to call remote functions by including an additional DESTINATION clause.

CALL FUNCTION ‘remotefunction’

DESTINATION dest

EXPORTING f1 =

IMPORTING f2 =

TABLES t1 =

EXCEPTIONS

The field ‘dest’ can be either a literal or a variable. Logical destinations are defined in the RFCDES table via transaction SM59 or via the menu path: Tools ->Administration,Administration->Network->RFC destinations.

<b>Calling remote functions locally :-</b>( i.e. call a remote function within the same system )

The two options to do this are –

CALL FUNCTION...DESTINATION = 'NONE'

CALL FUNCTION... [no DESTINATION used]

<b>Calling remote function modules BACK :-</b>

The remote function can invoke its own caller (if the caller is itself a function module), or any function module loaded with the caller.

You can trigger this call-back mechanism using

CALL FUNCTION... DESTINATION 'BACK‘.

<b>Types of RFC’s</b>

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

<b>Writing remote function modules</b>

In the function module attributes tab (transaction code SE37), set the processing type as Remote-enabled module to create a remote function module.

Write the code for the function module.

Define the destination of the RFC server in the RFC client system that calls the remote function ( via SM59 transaction).

Declaring Parameters: All parameter fields for a remote function module must be defined as reference fields, that is, like ABAP Dictionary fields.

Exceptions: The system raises COMMUNICATION_FAILURE and SYSTEM_FAILURE internally. You can raise exceptions in a remote function just as you would in a locally called function.

<b>Debugging Remote function calls</b>

It is not possible to debug a remote function call to another system.

However, when testing ABAP-to-ABAP RFC calls, you can use the ABAP debugger to monitor the execution of the RFC function in the remote system.

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.

regards

ravish

<b>plz dont forget to reward points if helpful</b>