SBOhub Search

What are SP_TransactionNotification & SP_PostTransactionNotice?

Two handy features built deep into the Microsoft SQL backend of SAP Business One are SP_TransactionNotification and SP_PostTransactionNotice. These two stored procedures have different functions depending on what you are trying to accomplish with custom SQL code. You can use them to make subtle changes in the process flow.


Stored Procedures
Stored Procedures

This stored procedure is found in your SQL database under the stored procedure folder. Bring up SQL management studio to find it under your database.

The code you write here will run each transaction in SAP Business One through the procedure to see if it triggers any of the conditions. For example, if you wanted to stop something from happening in SAP Business One like changing a business partner's price level, then this is where you would do that.


Helpful Information
Helpful Information

This stored procedure is found in the same spot as your SP_TransactionNofitication stored procedure. The code that you write here will be triggered after a transaction is posted to your database. So if you need to do any kind of post processing when something specific happens in the SAP Business One database you would write that here.

Improving Operations

These two store procedures work like any other stored procedure you may have written and all the same syntax applies as well. The difference is that built into the core SAP Business One logic each transaction will pass through the stored procedure to see if any code inside it affects what is going through it.

If it does meet the criteria you can also code further logic such as popping up an error message in the SAP Business One client or sending the data for further processing by the DI API. The sky is really the limit here and if you know SQL well you can do some very creative things.

SAP has coded special variables that hold the key data of the pending or completed transaction that you can use in queries. Even if the data has not been committed you can use the variables in queries as if it was already in the database. You can even secure your logic by limiting it to a certain subset of users. It looks for status too such as whether the transaction was done in add, update, delete, cancel or close modes.

I think you can see the extreme power of these two stored procedures SP_TransactionNotification and SP_PostTransactionNotice. Open the procedures up in your database, there are a few snippets of helpful information in there to help you understand them.

Watch for knowledge base articles going into depth on this subject in the future!

Author Info

Peter Canale
Peter Canale Follow Connect

Co-founder of SBOhub, starter, experienced executive, and probably having the best day ever.