Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Modules

former_member778253
Active Participant
0 Likes
832

Hi,

What r function modules in RFC?

5 REPLIES 5
Read only

former_member189059
Active Contributor
0 Likes
677

Function Modules are general purpose ABAP routines that can be called from any abap program

the benefit of function modules lies in their reusability, which saves developers from creating redundant code and increases programming efficiency

An RFC (Remote Function Call) is nothing but a call to a function module which is remote enabled

Remote Enabled means that the function module can be called from other systems as well

these systems can be R/3, XI, Java etc

Read only

Former Member
0 Likes
677

hi,

Remote Function Call:

RFC is an SAP interface protocol. Based on CPI-C, it considerably simplifies the programming of communication processes between systems.

RFCs enable you to call and execute predefined functions in a remote system - or even in the same system.

RFCs manage the communication process, parameter transfer and error handling.

Have a look at this link.

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

http://help.sap.com/saphelp_47x200/helpdata/en/22/042860488911d189490000e829fbbd/frameset.htm.

Read only

Former Member
0 Likes
677

Hi,

Difference between Normal function module and Rfc enabled function mdoule is u can find the radio button for RFC enabled will be checked in case of RFC function mdoule,but the radio button normal is checked for normal function module.

In the program the difffernece is in calling the FM.

For normal FM it is CALL FUNCTION '<FUNCTION MDOULE NAME>'

For RFC FM it is CALL FUNCTION '<FUNCTION MDOULE NAME>' Destination <Destination name>

reward points if it helps..

Regards,

\Omkar.

Read only

Former Member
0 Likes
677

The RFC Interface Locate the document in its SAP Library structure

A

remote function call (RFC)

is the call of a function module that runs in a different system to the calling program. Although it is also possible to call a function module in the same system as an RFC, normally RFCs are used when the caller and the called function module run in the same system.

In the SAP system, these functions are provided by the RFC interface system. The RFC interface system enables function calls between two SAP systems, or between an SAP system and an external system.

The RFC- interface system is made up of the following interfaces:

· Calling interface for ABAP programs

· Each ABAP program can call a remote function module using the command CALL FUNCTION...DESTINATION. The parameter DESTINATION informs the SAP system that the called function module runs in a different system to the calling system. RFC communication with the remote system takes place as a part of the CALL FUNCTION command.

· RFC function modules in an SAP system must be proper function modules and must be registered in the SAP system as remote.

· If the calling program and the called program are both ABAP programs, the RFC interface provides both communication partners. The calling program can be any ABAP program, and the called program must be a function module that is registered as remote.

· For more detailed information on calling function modules that are registered as remote, see Calling RFC Function Modules in ABAP.

· For more information on writing function modules that you want to call remotely, see Writing RFC Function Modules in ABAP.

· Interfaces for calling non-ABAP programs

If either the calling program or the called partner is not an SAP program, this program must be programmed in such a way that it can play the role of the other partner in RFC communication.

To support you when implementing RFC partner programs in non-SAP systems, read: Components of the SAP Communication Technology

RFC-supported and GUI-supported interfaces can be used by external programs to call function modules in SAP systems, and execute them in these systems. Likewise, ABAP programs can also use these interfaces to use functions supplied by external programs.

RFC in SAP Systems Locate the document in its SAP Library structure

In all SAP systems, CALL FUNCTION represents an integral part of the ABAP language. This statement executes a function (a function module) in the same system.

REMOTE FUNCTION CALL (RFC) is an extension of CALL FUNCTION in a distributed environment. Existing function modules can be executed using an RFC from a remote system. This is done by adding a DESTINATION clause to the CALL FUNCTION statement.

The destination parameter displays an entry in the RFCDES table (which is defined with transaction SM59). This entry contains all necessary parameters to connect to and log in the destination system.

You can use RFC between two SAP systems.

By using the RFC Library (RFC API), you can also use the functions of the RFC between an SAP system and a C program on different platforms. It is of no significance to the caller whether the remote function is provided in an SAP System or in a C program.

RFC frees the ABAP programmer from having to program his own communications routines. When you make an RFC call, the RFC interface takes care of:

· Converting all parameter data to the representation needed in the remote system. This includes character string conversions, and any hardware-dependent conversions needed (for example, integer, floating point). All ABAP data types are supported.

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

· Handling communications errors, and notifying the caller, if desired. (The caller requests notification using the EXCEPTIONS parameter of the CALL FUNCTION statement.)

The RFC interface is effectively invisible to the ABAP programmer. Processing for calling remote programs is built into the CALL FUNCTION statement. Processing for being called is generated automatically (in the form of an RFC stub) for every function module registered as remote. This stub serves as an interface between the calling program and the function module.

A distinction is made between an RFC client and RFC server. RFC client is the instance that calls up the Remote Function Call to execute the function that is provided by an RFC server. In the following, the functions that can be executed remotely will be called RFC functions and the functions provided via RFC API will be called RFC calls.

All RFC functions available in a remote RFC server system, which are called by an RFC client, are processed transactionally. This means that after execution of the first RFC function in the RFC server system the complete context (all globally defined variables in the RFC server program or in the main program of a function module) is available for further RFC functions. The RFC connection is closed only

· when the context of the calling ABAP program has ended or

· explicitly by RfcAbort or RfcClose in the external program.

You can either assign an application server directly, or assign it through a message server, as part of a load distribution. This applies to RFCs between two SAP systems and to RFCs between an SAP system and an external system.

To make the execution of RFC functions reliable, safe and independent from the availability of the RFC server or RFC server system, the transactional RFC (tRFC) is available for SAP systems. This ensures that the called function module is executed only once in the RFC server system.

In transactional RFC calls, the data that belongs to an RFC function must first be stored temporarily on the SAP database in the RFC client system. When processing is completed, this must be reported back to the calling ABAP program. Everything else is handled by the tRFC component in the SAP system.

Since a database is not always available on external systems, the link to the tRFC interfaces is implemented such that the client or server programs based on RFC API must take on some administrative functions to ensure that the respective function module is executed only once.

Regards,

Pavan P.

Read only

Former Member
0 Likes
677

Hello

On our IDES ECC 5.0 there are approximately 22'000 RFC-enabled function modules available. Go to transaction SE16 and display the contents of table TFDIR. Set field FMODE = 'R' (remote).

<b>Reward points</b>

Regards