Stored Procedures in SAP Business One
Stored Procedures in SAP Business One
Stored Procedures in SAP Business One
Symptom
This note deals with SAP Business One stored procedures, their purposes, usage, limitations and support
scope.
Solution
Purpose:
The purpose of Transaction Notifications is to enable the partner/customer to receive notification and register
logs on any transaction taking place within the SAP Business One database. SAP Business One provides
two stored procedure mechanisms for receiving notification of data-driven events.
• SBO_SP_TransactionNotification
• SBO_SP_PostTransactionNotice
It is triggered for the majority of the SAP Business One transactions and user-defined objects (UDO),
whenever operations such as add, update, delete, cancel, close are performed in SAP Business One Client
or DI API or DIServer or ServiceLayer.
SBO_SP_TransactionNotification is triggered before the SAP Business One transaction is committed. It can
be used to roll back transactions and display custom error messages in the SAP Business One Client.
Depending on the Business Object and the operation performed, there could be multiple notification
procedures triggered in a sequence. For example, when you update an item code, both notifications will be
triggered for every warehouse associated to the item code and also for the item code itself.
• SBO_SP_EDF_TransactionNotification(Obsolete)
This was introduced for Electronic document handling, but no longer has usage.
Usage:
Notification Procedures can be edited by the user to add SQL scripts as part of a notification process.
@error - You can set any value other than 0 to trigger rollback of a transaction
(SBO_SP_TransactionNotification) or register the transaction on the log files (
SBO_SP_PostTransactionNotice).
@error_message - You set a string value which will be displayed in the SAP Business One Client status bar (
SBO_SP_TransactionNotification) or on the log files (SBO_SP_PostTransactionNotice).
The additional code must be exception free and no TRY/CATCH handling in SQL Server will be supported.
Enhancements:
1. Enable/Disable TransactionNotification:
By default, TransactionNotification is enabled and triggered for the majority of SAP Business One
transactions.
Starting from SAP Business One 9.1 PL05, TransactionNotification can be disabled for a company database
for all objects (Administration → System Initialization → General Setting → Service).
TransactionNotification can also be disabled for a specific object by setting an entry in the [CompanyBD].
CTNS table. Currently there is no user interface in SAP Business One to set the entries. They need to be set
manually as below.
CTNS.EnableAsyN = 'Y' means that relevant operations on this object will trigger SEVT notification; 'N'
means they will not
CTNS.EnableTn = 'Y' means that relevant operations on this object will trigger an
SBO_SP_TRANSACTIONNOTIFICATION notification; 'N' means they will not
CTNS.EnablePTn = 'Y' means that relevant operations on this object will trigger an
SBO_SP_POSTTRANSACTIONNOTICE notification; 'N' means they will not
By default, the following objects are registered into CTNS to NOT send the three kinds of notifications (SEVT;
SBO_SP_TRANSACTIONNOTIFICATION; SBO_SP_POSTTRANSACTIONNOTICE):
• 10000044 (BTN)
• 10000045 (SRN)
• 10000066 (SRQ)
• 10000067(BTQ)
• 310000008 (BTW)
• 10000062 (IVL)
• 310000000 (IVK)
• 310000003 (IVQ)
• 310000005 (IVE)
Starting from SAP Business One version 10.0 FP 2108, you can add user_id (integer type) as the 6th
parameter into the procedure SBO_SP_TransactionNotification. Before you add the parameter, close all
active applications connected to the SAP Business One database. This parameter is not applicable for
SBO_SP_PostTransactionNotice.
Sample code for SAP Business One, version for SAP HANA
Limitations:
Support Scope:
The Transaction Notification stored procedures are provided "as is" and the support does not apply for the
logic implemented in the procedures.
The guidelines below should be followed when building the logic in the notification procedure.
Please refer to the maintenance policy document and SAP Note 2371729 for more details.
Other terms
Products