Are You Experiencing These Symptoms?

  • Transaction Deadlock Error: Red error bar at the bottom: 'Transaction (Process ID) was deadlocked on lock resources with another process'.
  • Cannot Save Documents: Users randomly unable to add Sales Orders, Invoices, or Deliveries during busy hours.
  • Temporary System Freezes: The SAP B1 client hangs for 10-20 seconds before finally saving a document.
  • Dropped Integration Payloads: Your API or third-party Add-ons failing to sync data because the tables are locked.

The Zaak Solution

Deadlocks are almost always caused by poorly written custom code inside the SBO_SP_TransactionNotification. We audit your database, refactor messy loops and cursors into set-based logic, and fix index fragmentation so multiple users can write to the database simultaneously without collision.

What is a Deadlock?

A deadlock happens when User A and User B both try to save data at the exact same time. User A locks Table 1 and needs Table 2. User B locks Table 2 and needs Table 1. They both sit there waiting for each other indefinitely until SQL Server steps in, kills one of the processes, and throws the dreaded Deadlock Error.

The Usual Suspect: SBO_SP_TransactionNotification

In SAP Business One, the SBO_SP_TransactionNotification is a special stored procedure that runs every single time a document is added or updated. It is used to enforce custom business rules (e.g., "Don't allow saving an Invoice if the PO number is missing").

If a developer writes inefficient code in this procedure—such as using SQL Cursors, complex loops, or querying massive unindexed tables—it drastically increases the time it takes to save a document. The longer a document takes to save, the higher the mathematical probability that two users will collide and cause a deadlock.

Key insight: The Transaction Notification procedure must execute in under 50 milliseconds. Anything longer is a ticking time bomb for deadlocks during peak transaction hours.

How We Fix It

1. Refactoring to Set-Based Logic

We completely eliminate row-by-row processing (Cursors/While loops) inside your transaction notifications. SQL and HANA are optimized for "Set-Based" logic. We rewrite your validations to evaluate entire datasets instantly.

2. NOLOCK / READ UNCOMMITTED Hints

When your validation logic simply needs to check if a record exists (without modifying it), we implement WITH (NOLOCK) table hints. This allows the system to read the data without placing a lock on the table, instantly freeing up traffic for other users.

3. Offloading Heavy Automation

If you are using the Transaction Notification to automatically create other documents or trigger massive updates, you are doing it wrong. We strip this heavy logic out and move it to an Asynchronous Service Layer script, freeing the main UI thread immediately.

Stop Losing Data to Deadlocks

Are deadlocks disrupting your warehouse or finance teams? Let us audit your SQL/HANA environment and refactor your custom logic for enterprise-scale volume.

Request Free Performance Review