11-24-2005 6:02 AM
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
11-24-2005 6:04 AM
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
11-24-2005 6:42 AM
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
11-24-2005 7:52 AM
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!
11-24-2005 7:40 AM
11-24-2005 7:59 AM
Hi Jeffrey,
You can achieve your requirement like this...
Call BDC1.
if sy-subrc = 0. " BDC1 successfull
Call BDC2.
endif.
Regards,
Raj
11-24-2005 9:15 AM
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
11-24-2005 10:32 AM
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
11-24-2005 9:06 AM
hi
ROLLBACK will be done automatically for the records which contains error.So you dont need to do it manually..
Regards,
Abdul
11-24-2005 4:33 PM
You can't rollback after a commit, but you could put some logic in to do a reversal if the original BDC fails.
Rob
11-25-2005 7:43 PM
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
11-24-2005 6:39 PM
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.
11-24-2005 6:49 PM
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