on 01-03-2012 2:52 PM
Hi,
I am trying to implement transaction on an Objects. When I use Company.StartTransaction , my application becomes very slow. I want to know how it works? Does it lock the object? If it locks how to implment concurrent users transactions? How to avoid deadlock?
Thanks & regards,
Raj
Thank you very much for your reply. I am using global transactions and users are trying to save the data in the table at the same time. In that case, My system is not responding. I am using Silverlight application. How do I avoid the slowness and implement transactions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
transaction handling:
- local transaction (single transaction)
so basically each data manupilation (update, add) over a business objects using a transaction, called local transaction of the business object.
Business Object means DI API objects, like Documents, BusinessPartners, Items, etc.
Example: if you issue a sales invoice document, it writes many tables in the background in a single transaction.
Dim oDoc as SAPbobsCOM.Documents
Set oDoc = oCompany.GetBusinessObject(oInvoices)
This not causes deadlocks, only wait locks on the object while the process is finish. It has automatic rollback procedure, and you can query the result (eg the transaction is commited or rolled back) by the return code of the transaction. if return code differs from 0 you have a rollback event, and the error. If return code is 0 the transaction is commited
lRetCode = oDoc.Add()
- global transaction
This global transaction can be used when you load large amount of flow pending data, and if there is an error in the flow you must redo (rollback) all your operations in the transaction. It is overrides the single transactions
you can start the transaction by
oCompany.StartTransaction()
if the job finished, then you can till decide you dismiss the operations (roll back) or accept the data (commit). operations with business objects in the flow can do automatic rollback before you commit your work you may inquery the transation status
if (oCompany.Intransaction) then
company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
end if
If is comfortable used with Try Catch End Try error handling.
Example:
you load Business Partners and sales orders into SAP B1. If your business partner import is fails, your sales order will defekt by missing the business partner. In this case you can use global transaction for each BP - Sales Order pair. some pseudo code:
1.read BP's
2. start loop over BP-s
3. Add BP
- if BP cannot be added, skip loop and take next BP (step 5)
4. Add Sales Order
- if Sales Order cannot be added, rollback transaction and goto step 5, In this case BP and sales order will be not added.
5 look for next BP
This can cause deadlock's in the system, so take care usage of this.
regards
János
Edited by: Janos Nagy on Jan 3, 2012 4:13 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.