Back to Tutorials
SQL & HANA•4 min read
VIDEO + GUIDE • PRO

SBO_SP_TransactionNotification: Blocking Bad Data Before It Reaches the Database

The stored procedure every SAP B1 admin should master. Learn the parameters, safe coding patterns, and five production-ready validation rules you can deploy today.

SB1

SAP B1 Academy Editorial

Published • 4 min read

Save

Every SAP Business One database ships with an empty stored procedure called SBO_SP_TransactionNotification. It fires after a document or master record is added, updated, cancelled, or closed, but before the transaction is committed. That makes it the most powerful (and most abused) place to enforce business rules that standard configuration cannot.

How the Procedure Works

When a user clicks Add or Update, SAP B1 calls the procedure with five input parameters and expects two outputs back:

  • @object_type: the object ID as text. For example 17 is Sales Order, 13 is A/R Invoice, 2 is Business Partner, and 4 is Item Master Data.
  • @transaction_type: A (Add), U (Update), D (Delete), C (Cancel), or L (Close).
  • @list_of_cols_val_tab_del: the key value of the record, usually the DocEntry or CardCode.
  • @error / @error_message: set @error to any non-zero value and the client rolls back the transaction and shows your message.

Because the procedure runs inside the transaction, a slow query here slows down every document posting company-wide. Keep each rule tightly filtered by object type and transaction type.

The Golden Rules Before You Write Any Code

  1. Never modify data inside the procedure. Validate only; use the DI API or Service Layer for updates.
  2. Always filter on @object_type and @transaction_type first so unrelated postings skip your logic.
  3. Keep a version-controlled copy of the procedure. Upgrades and copy-company operations can overwrite it.
  4. Prefix every message with a rule code (for example [SO-01]) so support teams can trace complaints quickly.
Pro Member Content

Sign in to continue. This deep-dive is available to Pro members.

Join SAP Business One consultants and key users worldwide. Free forever, no credit card required.

or use a magic link