First of all I'm not a SAP/BAPI developer. We have a java application that is calling some BAPIs over RFCs using JCo library. The question is whether there is any way to call several of those in a single transaction.
I believe the correct way to do it would be to
- begin JCoContext
- execute some RFCs
- call BAPI_TRANSACTION_COMMIT
- end JCoContext
E.g. we'd like to call those system bapis this way: BAPI_CATIMESHEETMGR_INSERT BAPI_CATIMESHEETMGR_CHANGE
But for some reason all the stuff gets commited regardless of what we do. I would like to understand what exactly is commiting this data. Are commits part of those BAPIs or is it some kind of JCo "feature"?
A good place to start learning the RFC transaction model is this piece of help, where you can read the guidelines about creating custom BAPIs:
So yes, generally your assumption is correct, the implicit commit happens in RFC.
Moreover, "Transaction Model for Developing BAPIs" help section contains important notes about your scenario:
So you will not be able to achieve what you want: create (BAPI_CATIMESHEETMGR_INSERT) and change (BAPI_CATIMESHEETMGR_CHANGE) timesheet in one LUW (Logical Unit of Work).
It must be done in two LUWs (two RFC calls).