From R/3 Release 4.0 onwards, BAPIs can also be used in Application Link Enabling (ALE) to exchange and replicate data between two distributed systems. When data is transferred between distributed systems you decide between using synchronous and asynchronous BAPIs.
Synchronous BAPIs
Synchronous BAPIs are generally used to read data from a remote logical system, for example to display a customer list.
Before calling the BAPI, it is therefore necessary to determine the RFC destination of the remote system or the BAPI server. The application developer has access to an API for determining the RFC destination of the BAPI.
Asynchronous BAPIs
Asynchronous BAPIs are generally used for replicating data on one or more logical systems, for example to distribute article master data.
To implement an asynchronous data transfer with a BAPI, an ALE IDoc interface must be generated. This interface controls all of the data communication between logical systems using IDoc technology. The application then calls the generated ALE IDoc interface locally instead of the BAPIs.
As with synchronous BAPIs, the corresponding logical systems of the BAPI must be determined before you call the ALE-IDoc interface. These are transferred to the ALE-IDoc interface as input parameters.
Processing the Return Parameter
Each BAPI has the standardized Return parameter for returning messages to the calling application. For more information about this parameter, see Return Parameters (Error Handling) in the BAPI Programming Guide.
First the function module that converts the IDoc into the corresponding BAPI in the receiving system is called. After this status records are written for the IDoc in which messages sent in the Return parameter are logged.
If the value of the field Type is A (abort) in at least one of the return parameter entries, status 51 (error, application document has not been posted) is written to all the IDoc status records and a ROLLBACK executed. If the value of the field Type is E (error) in at least one of the return parameter entries, status 51 (error, application document has not been posted) is written to all the IDoc status records and a COMMIT WORK is executed anyway. Otherwise status 53 (application document posted) is written and a COMMIT WORK is executed.
ALE Distribution Model
As with the message types, synchronous and asynchronous BAPIs are maintained in the ALE context in the ALE distribution model. Based on the distribution model, the logical systems (for asynchronous BAPIs) or RFC destinations (for synchronous BAPIs) are determined at runtime.
For more detailed information about using BAPIs in an ALE context, see ALE Programming and the document Using ALE Services .