cancel
Showing results for 
Search instead for 
Did you mean: 

Transcations

Former Member
0 Kudos

Good Afternoon

Experts:

If I do not use <b>g_B1Connection.Company.StartTransaction()</b> to explicitly start a transaction, is there an ImplicitTransaction happening behind the scenes whenever I use an object?

My scenario:

I)Hit Add button to insert a new Material Requisition through our Add-on

2)An error occurs on the insert(maybe some problem in the Stored Procedure or invalid data)

3)I catch that problem and throw an exception resulting in a message in the

StatusBar of the screen

<b>Now, is there any kind of ActiveTransactions running in the background since

the insert failed?</b>

Is there a way to check for ActiveTransaction for the logged on User?

Thanks,

EJD

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for the input.

EJD

Former Member
0 Kudos

Ed ...

I'm not sure if I understand well your question. But you can use the <b>StartTransaction </b>and <b>EndTransaction </b>methods to achive the rollback of a group of database statements if execution fails. Like this ...

                    msboCompany.StartTransaction()
                   '  
                   ' ****************** code here to update database *************
                   ' 
                   Try
                       msboCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
                    Catch ex As Exception
                        msboCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
                        SBO_Application.MessageBox("Error on function!" & vbCrLf & ex.Message)
                    End Try

Former Member
0 Kudos

Good Evening

Thanks for replying Neftali. I uderstand the usage of the StartTransaction and EndTransaction. In situations where I do not utilize that in SAP and there is an error with a database function(S/P call etc...), is there a Transaction out there in the background hanging around?

If so, how can I find if there is one?

Thanks,

Ed

Former Member
0 Kudos

Forgive my ignorance. But do you mean by "S/P call" a store procedure call ? And if so, do you mean a SAPs store procedure or one directly on SQL Server ?

I don't remember how right now but you can have a store procedure return a value if an error ocurres!

Former Member
0 Kudos

Hey:

I just meant calling a SQL S/P from within SAP. The error could result from a simple update or insert to the database.

So, I guess my inquiry comes down to -->what happens in SAP if I do not use the StartTransactio and EndTransaction? Does SAP still start a Transaction that gets stuck "out there"? If so, how can I tell if this is the case?

EJD

Former Member
0 Kudos

Well

Quick answer ... I don't know! It is a good question for SAP.

I believe the official word by SAP is that Store Procedures are not supported. Store Procedures (eventhough you can actually call them ... I suppose is for UD store procedures)

If you are calling one of your own store procedures I believe you can make the store procedure return an error code and then see if SAP's function call return that value

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

You are not supposed to start or create SP in the B1 DB. This is against the

solution certification guidelines.

Former Member
0 Kudos

Gianluigi:

Do you mean you should even call a SQL S/P from SAP?

Thanks for the input,

EJD