Describing Remote Function Calls and BAPIs

Objectives

After completing this lesson, you will be able to:
  • List interface technologies used by SAP systems
  • Explain the process flow for a Remote Function Call
  • Explain the significance and use of business objects and BAPIs

Overview of Interfaces

SAP systems have interfaces at different communication levels. These interfaces can be divided into SAP proprietary interfaces and open interfaces. They range from highly technical connection options, for example, using the TCP/IP protocol or CPI-C, to highly specialized interfaces designed for business objects, such as BAPIs or the IDoc interface used in the ALE environment. When you consider SAP proprietary interfaces, all higher interfaces, that is, those that access business objects or processes, use the same technology: the Remote Function Call (RFC).

Interface Technologies Used in SAP Systems

Note

For information about additional interfaces, choose the Quick link /connectors on SAP Support Portal (https://support.sap.com/connectors).

Remote Function Call

The Remote Function Call interface is an SAP interface protocol based on CPI-C and TCP/IP. It simplifies the programming of communication processes between different SAP systems. RFCs enable you to call and execute predefined functions in a remote SAP system – or within the same SAP system. RFCs manage the communication process, parameter transfer, and error handling.

RFC describes an interface, not the programming language in which the function runs. You can also use RFCs to call functions in non-SAP systems. The procedure for RFC communication between two SAP systems is that the calling SAP system uses an RFC definition in the SAP system called to access a specific function.

If you want to start external programs remotely, you need an RFC interface outside the SAP system. For example, a simple Dynamic Link Library (DLL). Every RFC interface is bidirectional, so external programs can also use RFCs to access functions in SAP systems.

Note

All function modules (including those that are remote-enabled) are created, together with their import and export parameters, using the Function Builder. You can call the Function Builder from the SAP Easy Access menu by navigating to ToolsABAP WorkbenchDevelopmentFunction Builder, or by using transaction code SE37.

To call an RFC module from an SAP system:

  • there must be a technical connection between the two systems – this connection is called an RFC Destination

  • and you need to know the import and export parameters (defined in the Function Builder) to perform the Remote Function Call

RFC Destinations

You can manage your RFC Destinations from the SAP Easy Access menu by navigating to ToolsAdministrationAdministrationNetworkRFC Destinations, or by using transaction SM59.

In the figure "Remote Function Call in Detail", you can see, on the left side, the calling system in which an RFC destination named DEST has been created. A target of an RFC destination in transaction SM59 should not be confused with an SAP system, since an RFC destination points to one specific client in an SAP system. RFC destinations are also referred to as connections between logical systems; this term is used, above all, in the environment of Application Link Enabling (ALE).

When defining RFC destinations in AS ABAP-based SAP systems, have in mind:

  • RFC destinations are always directed to one particular client if their target is an AS ABAP-based SAP system

  • RFC destinations can be accessed from all clients of a source SAP system (provided the user has the required authorizations)

This means that you can have many RFC destinations between two ABAP-based SAP systems. Because you can specify a logon user for the target in each RFC destination, you can also access clients in the target system several times, for example, with a different logon user each time. If you need a bidirectional RFC connection between two systems, that is, the system called can also execute RFC modules in the calling system, then you need to set up an equivalent second RFC destination in the system called.

Remote-Enabled Function Modules (Remote Function Calls – RFCs)

In ABAP, you use RFCs to call a function module in another system as follows:

Code Snippet
123
CALL FUNCTION <Name> DESTINATION <Destination to Target> EXPORTING ... IMPORTING ...

Here, <Name> specifies the function module to be executed in the target system. The name of the <Destination to Target> must refer to one of the RFC destinations available. EXPORTING and IMPORTING are used to pass parameters to the target function module and to receive the returned parameters.

When you are creating an RFC destination, you can provide credentials for the target system; if not, you need to enter logon data when you call the RFC destination during runtime. The function module called in the target system is executed using the user ID that has been entered for the RFC destination.

Note

SAP systems can establish trusted relationships with each other. If a calling (sending) SAP system is known to the called (receiving) system as a trusted system and the user who initiated the RFC call is defined in both of the systems, no password is supplied (Trusted RFC).

RFC has become the most important SAP proprietary interface in the SAP environment. Some special RFC modules, which follow certain conventions, are known as BAPIs (Business Application Programming Interfaces).

BOR and BAPIs

A Business Application Programming Interface (BAPI) is a standardized programming interface that facilitates internal and external access to business processes and data in SAP systems. BAPIs are defined in the Business Object Repository as methods of SAP business objects and enable an object-oriented view of business data in an SAP system.

BAPIs allow integration at the business level, not the technical level. This provides for greater stability of the linkage and independence from the underlying communication technology.

Note

BAPIs are created and tested in exactly the same way as other function modules as RFC-enabled function modules, using the Function Builder, transaction SE37, and are then defined as methods of an object type in the BOR.

You can display an overview of available BAPIs in the BOR, for example, by choosing the Business Object Repository button in the application toolbar of Business Object Builder (SAP Easy Access menu path ToolsABAP WorkbenchDevelopmentBusiness Object Builder), transaction SWO1 and then select Business Object RepositoryBAPI. This leads to the BAPI Explorer (transaction BAPI).

You can also access the BAPI Explorer directly using transaction code BAPI.

Possible Uses for BAPIs

  • To link business processes across system boundaries (for example, when using ALE)

  • Used by SAP to integrate various solutions in the framework of SAP Business Suite

  • To connect an SAP system to the Internet

  • Used in conjunction with SAP Business Workflow scenarios that extend beyond system boundaries

  • To connect to third-party software and legacy systems

Use BAPIs

Business Example

You want to lock a user in a remote SAP system using a BAPI.

Log in to track your progress & complete quizzes