‎2011 Oct 11 3:33 AM
Hi,
There are 2 reports accessing 1 table. I am facing the runtime error with description - "The database system detected a deadlock and avoided it by rolling back your transaction.u201D
Have come across implementing the ENQUEUE and DEQUEUE concept on the table. Please clarify the below queries:
1.Is the above error occuring beacuse the two reports are accessing the table at the same time?
2.Implementing EN/DEQUEUE will solve the problem?
3.If first report is writing the data to table at 12pm(after locking the table), and the second report trying to access the table at 12:10pm to write the data, will this wait in some queue and write the data after the first report releases the table lock?
Regards,
Rajkamal
‎2011 Oct 11 4:07 AM
Hello Raj,
You should understand the difference between Database Locks & SAP locks.
The database system detected a deadlock and avoided it by rolling back your transaction
1.Is the above error occuring beacuse the two reports are accessing the table at the same time?
Initial look at the statement suggests that this is because of Database Lock collision. You need to check if both the programs were trying to write (INSERT/UPDATE/MODIFY/DELETE) the same data to the DB table.
2. Implementing EN/DEQUEUE will solve the problem?
It should. But make sure you don't lock the entire table, try to lock only the individual records which are being processed(This is a good coding practice, of course you can override it depending on your requirement).
3.If first report is writing the data to table at 12pm(after locking the table), and the second report trying to access the table at 12:10pm to write the data, will this wait in some queue and write the data after the first report releases the table lock?
No, afiak there is no such queue. Alternatively you can put the lock in a iteration(viz., DO loop, WHILE loop) & check when the locks are released.
Hope i'm clear.
BR,
Suhas
‎2011 Oct 11 4:07 AM
Hello Raj,
You should understand the difference between Database Locks & SAP locks.
The database system detected a deadlock and avoided it by rolling back your transaction
1.Is the above error occuring beacuse the two reports are accessing the table at the same time?
Initial look at the statement suggests that this is because of Database Lock collision. You need to check if both the programs were trying to write (INSERT/UPDATE/MODIFY/DELETE) the same data to the DB table.
2. Implementing EN/DEQUEUE will solve the problem?
It should. But make sure you don't lock the entire table, try to lock only the individual records which are being processed(This is a good coding practice, of course you can override it depending on your requirement).
3.If first report is writing the data to table at 12pm(after locking the table), and the second report trying to access the table at 12:10pm to write the data, will this wait in some queue and write the data after the first report releases the table lock?
No, afiak there is no such queue. Alternatively you can put the lock in a iteration(viz., DO loop, WHILE loop) & check when the locks are released.
Hope i'm clear.
BR,
Suhas