Skip to Content
Former Member
Nov 28, 2012 at 12:24 PM

Using transactions (start,end,rollback) with UI operations



I'm trying to use transactions in order to couple 2 database operations:

1. Adding a document through the UI.

2. Adding a document through the DI.

If one fails, I want the other to rollback. In order to do that, I'm trying to start a transaction before the 1st UI document addition and end/rollback once it is finished and I've added the 2nd document through the DI.

Problem is that the rollback option doesn't seem to block the addition of a document through the UI.

Is it possible to implement this idea with current SDK tools?

private bool BeforeFormAdd(SAPbouiCOM.ItemEvent pVa)        {            if (!mCompany.InTransaction)                mCompany.StartTransaction();            return true;        }private bool AfterFormAdd(SAPbouiCOM.ItemEvent pVal)        {            if (mCompany.InTransaction)            {                if (Create2ndDocSuccess())                 mCompany.EndTransaction(di.BoWfTransOpt.wf_Commit)               else
mCompany.EndTransaction(di.BoWfTransOpt.wf_RollBack); } return true; }