RFC and BAPI Interfaces to SAP Systems
RFC is the protocol used by SAP for remote communication, that is, for communications between remote independent systems.
RFC is used for communications between two independent SAP systems, or for communications between an SAP system and a non-SAP system, such as an external application. It can also be used for communications between modules on the same system.
Using the RFC interfaces you can extend the functionality of R/3 applications from an external program.
Compared to using the GUI interfaces, using RFC interfaces requires more knowledge of the business logic of the R/3 applications with which you are integrating the external application.
Types of RFC Interfaces
There are many levels at which external applications can integrate with R/3 through the RFC channel (interface). SAP Automation tools support several of these methods:
External programs using RFCs can either make or receive remote function calls to or from an SAP system. Therefore, using RFCs an external program can act as either the client or the server to an SAP system. Conversely, the SAP system can take the role of either the client or the server to the external application.
You can use a combination of SAP Automation tools to incorporate remote function calls into your programming environment. SAP Automation offers several products that make programming RFCs easier. It offers products for programming of RFCs from languages such as C, C++, Java, or COM-compliant languages, such as Visual Basic and applications such as Excel.
SAP Automation also includes tools that help you browse the metadata of RFC function modules, meaning that they allow you to view the syntax of RFC functions, their parameters and fields.
Using RFCs requires knowledge of ABAP programming, because calling a remote function in R/3 is calling an ABAP function. You may also need to extend the existing set of available RFC with your own ABAP code.
R/3 systems contain a set of business objects, which are an object-oriented representation of real-world business objects. Examples of business objects are a purchase requisition, a G/L account, or an employee.
An R/3 system also contains Business Application Programming Interfaces (also called Business APIs, or BAPIs), which provide a programming interface to business objects. BAPIs are a set of methods for working with and manipulating SAP business objects.
Internally, BAPIs are implemented as function modules stored in the R/3 Function Builder. Each BAPI has an equivalent internally-named function module. However, you should use the BAPI and not the function module behind it, because the BAPI provides a stable, object-oriented view of R/3 applications and data. The internal function modules or even the fact that the BAPIs are implemented as function modules are not guaranteed to remain the same in future releases of R/3.
The advantage of using BAPIs over using RFCs is that using BAPIs requires no ABAP programming knowledge. You use BAPIs from standard programming languages such as C++ and Java.
Using BAPIs also offers the most stability to your application, because BAPIs stay consistent over different R/3 releases.
However, business objects and their BAPIs are created by SAP, and you can only use BAPIs that were implemented by SAP. If a certain BAPI for performing a certain application task was not implemented yet, you must seek alternative programming methods.
SAP Automation includes a component for using R/3 transactions to feed data into R/3 in batch input mode.
IDoc interface technology is an SAP standard for sending documents back and forth between different R/3 systems or between an R/3 system and an external application.
IDoc is useful for transferring large amounts of data in asynchronous mode.
The IDoc interface technology is based on transactional RFC, which is a more reliable flavor of RFC in that it ensures that a certain transaction is called exactly once in the RFC server system. It also ensures execution even if the RFC server system is not available at the time that the RFC client makes the call.
An IDoc is a data container that follows a certain SAP standard format. It contains a header and segments of data. SAP defines templates for various IDoc documents; for example, there is a definition for a purchase requisition IDoc.
External programs can use the IDoc method of communicating data to and from an SAP system if an appropriate IDoc template exists. Sometimes it is possible to extend an existing IDoc template. If there is no IDoc template for the type of data you wish to transfer, and there is no IDoc template that you can extend, you must seek another programming method.