There are many differences between IDOCs and BAPIs.
BAPIs in 3.1 are synchronous; in 4.+ they can be asynchronous (and I
believe they then drive certain ALE/IDOCs).
BAPIs are called from the outside-in. That is, an external program
invokes a BAPI that gets data from SAP to display or updates data in
SAP. The BAPI concept does not include an event concept — you cannot
tell SAP that when certain events happen to a “business object”, to fire
a message or a file to an external system.
BAPIs are invokable from Java or C/C++ or Visual Basic (and I think some
people are using Delphi).
In 3.1x there are very few BAPIs to use. In 4.+ SAP has added a large
BAPIs are not totally immune to upgrades but if they are to be retired
you supposedly will have them supported for two releases. Whether those
are point or letter releases, I don’t know. I believe that IDOCs may
be more changable from release to release.
BAPIs are reasonably well documented and there is a common place to look
to see what is available. IDOCs — I have heard — are poorly
documented in terms of finding them, and IDOCs were done differently by
different groups in SAP.
BTW, you can also use Java, C/C++, Visual Basic, … to invoke RFCs in
SAP and get or update data. That’s how the BAPIs work since they
utimately are sets of RFC calls (written to a design spec for BAPIs).