Application Development and Automation 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: 
Read only

Rollback work after a Batch Input

Former Member
0 Likes
2,334

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
Read only

Former Member
0 Likes
1,637

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

Read only

Former Member
0 Likes
1,637

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

Read only

0 Likes
1,637

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!

Read only

andreas_mann3
Active Contributor
0 Likes
1,637

Hi Jeff,

have a look here:

Andreas

Read only

Former Member
0 Likes
1,637

Hi Jeffrey,

You can achieve your requirement like this...

Call BDC1.

if sy-subrc = 0. " BDC1 successfull

Call BDC2.

endif.

Regards,

Raj

Read only

0 Likes
1,637

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

Read only

0 Likes
1,637

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

Read only

abdul_hakim
Active Contributor
0 Likes
1,637

hi

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

Regards,

Abdul

Read only

Former Member
0 Likes
1,637

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

Rob

Read only

0 Likes
1,637

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

Read only

Former Member
0 Likes
1,637

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.

Read only

Former Member
0 Likes
1,637

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