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: 

Rollback work after a Batch Input

former_member355937
Participant
0 Kudos

Hi!

I need to rollback the changes made if there are errors occured during execution of two batch input programs in my calling program (using rollback work).

Is this possible?

Thanks,

Jeff

12 REPLIES 12

Former Member
0 Kudos

when you do batch input or bdc we cannot rollback but when got some errors it will not post the document. So you neednot rollback

former_member188685
Active Contributor
0 Kudos

Hi RollBack will be done automatically if any erros is there in case of Batch Input. you need not to do roll back explicitly.

regards

vijay

0 Kudos

hello all,

actually our problem is like this, we have 2 BDC to call, say BDC1 and BDC2. If at least one failed, we should rollback changes made by both calls.

for example:

call BDC1

call BDC2

if the first call (BDC1) has no error, and the second call (BDC2) fails, then we want to rollback changes made by the first BDC (BDC1) call...

please help us...

many thanks!

andreas_mann3
Active Contributor
0 Kudos

Hi Jeff,

have a look here:

Andreas

Former Member
0 Kudos

Hi Jeffrey,

You can achieve your requirement like this...

Call BDC1.

if sy-subrc = 0. " BDC1 successfull

Call BDC2.

endif.

Regards,

Raj

0 Kudos

hi raj,

your example is ok if BDC1 (first call) fails, but if the first call, BDC1, succeed and BDC2 fails, we need to rollback changes made by the first BDC (BDC1) call as well...

regards,

sid

0 Kudos

Hi Sid!

I already feared, that this is your requirement. But this is not according the transaction logic.

Per definition a transaction is the combination of tables, which have to be changed together to get a consistent status in DB.

A second transaction is independent - but can have a link as follow-on document.

It is OK to have step 1, but not step 2 in the system - e.g. a goods issue, but no goods receipt of receiving plant. The process is obviously not finished, but we have a consistent status.

If in this example the truck has an accident, then we can't just cancel the goods issue -> in general it's not possible to rollback some transactions.

Still it's possible to correct some faults, e.g. by creating storno documents, by deletion of created master data... But this is a separate step (with a different transaction / movement type / function code), not just a 'go-back' statement in a report.

Either you develope a correction 'just book step 2 after error'-report, or you have to add a 'cancel step 1'-function in case of step 2 failure.

Regards,

Christian

abdul_hakim
Active Contributor
0 Kudos

hi

ROLLBACK will be done automatically for the records which contains error.So you dont need to do it manually..

Regards,

Abdul

Former Member
0 Kudos

You can't rollback after a commit, but you could put some logic in to do a reversal if the original BDC fails.

Rob

0 Kudos

A different approach would be to use BAPIs. Since they don't have a commit, but you need to code it yourself, you can simply not do the commit if there are errors.

Rob

Former Member
0 Kudos

Hi,

You have call the second BDC by checking the return code of the First BDC and by reading the First BDC success message(This can be done with the help of the FM <b>FORMAT_MESSAGE</b>.

So After the First BDC got successfully executed only then call the Second BDC transaction .

There is no concept of Rollback in BDC.

Former Member
0 Kudos

Develop BDC3 to rollback BDC1 in case of BDC2 failure.

So you will have BDC1, BDC2 and BDC3. Check whether this works for your requirement.

Thanks

Anantha