Skip to Content
0
Former Member
Apr 24, 2014 at 07:34 AM

Could not commit transaction; Error -1 detected during transaction

320 Views

Hi all,

This is the error that I am facing while using the Company Transaction Object.

I have 3 document transactions that needs to get consecutively executed and if any one of them fails, the whole set should be rolled back.

Thus I have used the Transaction Object to achieve the same.

But albeit the documents gets executed individually, putting them across into the transaction object throws me the error 'Could not commit transaction; Error -1 detected during transaction'. The error is thrown from "oCompany.EndTransaction(BoWfTransOpt.wf_Commit);" line.

I am placing my code for purview as below.

if (pVal.ItemUID == "btnReject")
                            {
                                if (oForm.Mode == BoFormMode.fm_OK_MODE)
                                {
                                    //if (!oCompany.InTransaction)
                                    //{
                                        oCompany.StartTransaction();
                                    //}
                                    bool postSKUSuccessful = false, postStyleRFP = false, postStyleIssue = false;
                                    postSKUSuccessful = GenerateSKUReceipt(oApplication, oCompany, oForm);
                                    if (postSKUSuccessful)
                                    {
                                        postStyleRFP = PushStyleFromProductionForRejection(oApplication, oCompany, oForm);
                                        if (postStyleRFP)
                                        {
                                            postStyleIssue = PushOutRejectedStyleStock(oApplication, oCompany, oForm);
                                        }
                                    }
                                    if (postSKUSuccessful && postStyleRFP && postStyleIssue)
                                    {
                                        oApplication.StatusBar.SetText("All rejection operations posted successfully!", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                        //if (oCompany.InTransaction)
                                            oCompany.EndTransaction(BoWfTransOpt.wf_Commit);
                                        UpdateWorkOrderWithRejectQuantity(oApplication, oCompany, oForm);
                                       
                                    }
                                    else
                                    {
                                        oApplication.StatusBar.SetText("One of the rejection operations has failed! Whole operations are rolled back.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                        //if (oCompany.InTransaction)
                                            oCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                                       
                                    }
                                }
                                else
                                {
                                    oApplication.StatusBar.SetText("This Operation can take place in OK Mode only.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                }
                            }

Please help !!!

Thanks,

Siju Dasan

Message was edited by: Siju Dasan I am using SBO 8.82 PL 10.