Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Transaction with Fully Rolled Back

Former Member
0 Kudos

Hi there,

I've the scenario for a project that require multiple transaction as a subsequent process. I'll have one RFC Function Module that wrap multiple BAPI inside there. This RFC will be publish as a webservice and will be consumed by .NET application.

The problem that I've, the subsequent process will depend each other. For the example : Create SO, Purch Requisition, and with Reference to PR, I need to create the PO. So I need to commit the transaction for Sales Order creation before I can't continue to create the purchase order.

If there is a problem during the creation of PO, the Sales Order already committed to the database and I can't roll it back.

Any suggest, how I can handle this situation with concept of Complete the whole transaction and not at all if there is an error for one of the transaction.

Thanks in advance for any help.

Cheers,

Danny

1 ACCEPTED SOLUTION

Sougata
Active Contributor
0 Kudos

Just a thought - once you come across an error in the subsequent document, is it not possible to reverse/cancel/delete the previous document you successfully commited to the database?

For example, you successfully created the SO and commited to the database. Then while trying to create the PR in the next step you come across an error for which the PR doc cannot be posted. At that point can't you fire another BAPI/FM to reverse/delete the SO created in the previous step? Then exit the program after cleanup/error reporting to inform the end user.

Let me know what you think!

3 REPLIES 3

Sougata
Active Contributor
0 Kudos

Just a thought - once you come across an error in the subsequent document, is it not possible to reverse/cancel/delete the previous document you successfully commited to the database?

For example, you successfully created the SO and commited to the database. Then while trying to create the PR in the next step you come across an error for which the PR doc cannot be posted. At that point can't you fire another BAPI/FM to reverse/delete the SO created in the previous step? Then exit the program after cleanup/error reporting to inform the end user.

Let me know what you think!

Former Member
0 Kudos

Dear Sougata,

Thanks for your message. But, that's just a sample of simple transaction. What we'll have probably around 5 transactions. If the fourth transaction failed, we don't want to cancel/delete the other 4 transactions. I need somekind of post or not at all.

Cheers,

Danny

Sougata
Active Contributor
0 Kudos

Hi Danny,

Unfortunately this is the only option for you because you cannot rollback after you commit to the database. The other option would be to trigger Check BAPIs or BAPIs with test mode = 'X'....but that will be a problem for e.g. if you want to create a PO with reference to a PR created in the earlier step. If you can omit the part of creating with reference, then I think this is possible by first triggering BAPIs in test mode for all the documents that have to be created - if the whole chain is successful then you trigger BAPIs in update mode to post the docs (Commit) or else exit the process. Hope it made sense.

Cheers,

Sougata.