‎2006 Jan 11 6:01 PM
Hi,
when I call an RFC I see that after the call to the RFC returns everything has been committed to the database. This is not the desired behavior. I want to call several RFCs in a row and then send BAPI_TRANSACTION_COMMIT or BAPI_TRANSACTION_ROLLBACK.
Does anybody know whether this can be done at all and if so how?
Regards, Oliver Plohmann
‎2006 Jan 11 7:14 PM
An RFC call is nothing but a loginprocesslogout similar to an online user. Similar to when an online user logs out, a commit is performed, even that is true with RFC.
You have to group all the different BAPIs that you want to call into one RFC call and that way they will commit or rollback as a group. You cannot go back and forth making multiple RFC calls, one for each BAPI that you use without commit happening after each call.
Here is how your calls should be modelled.
Log on
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Log off
‎2006 Jan 11 6:02 PM
‎2006 Jan 11 6:09 PM
what is the RFC, read the RFC documentation, you can see
whether you need to use bapi_transaction_commit explicitly or not , read the documentation of the RFC.
regards
vijay
‎2006 Jan 11 7:14 PM
An RFC call is nothing but a loginprocesslogout similar to an online user. Similar to when an online user logs out, a commit is performed, even that is true with RFC.
You have to group all the different BAPIs that you want to call into one RFC call and that way they will commit or rollback as a group. You cannot go back and forth making multiple RFC calls, one for each BAPI that you use without commit happening after each call.
Here is how your calls should be modelled.
Log on
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Log off
‎2006 Jan 12 4:55 AM
Hi oliver,
1. As recommended,
u will have to BUNCH everything
in one FM (RFC Enabled)
2. If u see the documentation F1 on Call FUNCTION syntax,
ITS CLEARLY MENTIONED THAT :
Note
Note that a database commit occurs at each Remote Function Call (RFC).
Hence, irrespective of which ever BAPI / FM(rfc)
u call, it will
do DATABASE COMMIT.
SAP has already clearly mentioned it
in their F1 documenation.
regards,
amit m.
‎2006 Jan 12 8:32 AM
Hi all,
thanks for all the answers. The RFC is a plain remote enabled function module I wrote of my own. The RFC is called from outside SAP from Java using JCo. I guess it is clear now that I can forget about what I was dreaming of being able to do.
This means I have to send tons of data all in once with one RFC to SAP. This is not very nice, especially because I can't make updates/inserts/deletes at runtime in an arbitrary order.
I can see two ways to address this issue:
1. Call one RFC for every update/insert/delete. Each RFC stores the import parameters in a separate database table and exits without doing anything else. At the end, call a custom RFC that retrieves the import parameters from the parameter tables, call the RFCs again in the right order and do a commit work then.
2. Send a stream of data from Java that is interpreted by a single RFC which makes the appropriate updates/inserts/deletes and then commits.
The latter approach seems more elegant, but more difficult to implement. What would you guys recommend? The whole thing is a little effortful, but would be a cool thing to implement.
Regards, Oliver Plohmann