How do you determine which interface method to use when interfacing to SAP/R3? In other words, do you go with BAPI, IDocs, RFC or ALE and so on?
RFC is the technology that allows to call a function module within an R/3 system from another R/3 instance or an external program from an R/3 instance.
BAPI function modules are special function modules that are released by SAP as an official application programming interface, which is releases and supported for public use. Hence, BAPIs are a subset of the RFC enabled function modules. Technically, there is no difference between RFCs and BAPIs, but SAP wants you to use a BAPI to access R/3 functionality from external programs, whenever a BAPI exists.
IDoc is a transport vehicle for data transfer in and out of an R/3 system. The data transferred between the system in the IDoc format, which is a text format. The IDoc is either exchanged via a file, so R/3 writes the IDoc to a file and the other one picks up the IDoc and vice versa or the IDoc is handed other via an R/3 RFC call. To send an IDoc to R/3 you call the special BAPI function: IDOC_INBOUBD_ASYNCHRONOUS and to send it out, R/3 ultimately calls IDOC_SEND. (However, for sending you should customize the route in transaction menu WEDI, and let the IDoc engine do the work).
ALE is a scheduling mechanism that defines a scenario to determine the triggers and data types to exhange with an external system. ALE uses IDocs to ecxhange the data at a given time.
So the general decision is: Would you rather use IDocs (or ALE) or RFCs (or BAPIs) to exchange the data? If you need the data to be protocolled or to be exchanged asynchronously, then you need IDocs. If you can dispose of logging the data in the receiving system (and thus dispose of the possibility to reprocess the data), then you can call the handling RFC function directly, which is quicker, produces less data garbage, but requires that the sending system must care for the error handling.
Dig Deeper on SAP selection and implementation
Related Q&A from Axel Angeli
An SAP user is receiving an error message while integrating SAP iDoc PORDCR1 for a purchase order. Continue Reading
SAP expert Axel Angeli explains how to update the "further dates" tab information in am SAP transaction through an SAP IDoc. Continue Reading
An SAP R/3 4.7 user wants looking to post a document entry using different trading partner fields for credit and debit for function FB01. Continue Reading