Transaction Notification in SAP B1

Transaction Notification in SAP B1:-

Transaction Notification in SAP B1. In this post, I will explain Transaction Notification in SAP B1.SP_Transaction Notification is the stored procedure automatically created in each database when we create the database.We use this procedure for handling the validation against the business object so that we can prevent the users from doing some action when the condition is being false.It receives the notification of data -driven event against the specific business object when we work on the business object like -Invoice, Sales Order, Purchase Order etc.

There are two types of Transaction notification procedure namely:


1-[dbo].[SBO_SP_PostTransactionNotice] :
In this procedure, we can add our code for doing some action after completion of the transaction.Generally, we don’t need this procedure because most of the validation we have to put before completion of the transaction thus we prefer the second one.

2- [dbo].[SBO_SP_TransactionNotification]:
In this procedure, we can add our code for doing some action before completion of the transaction.Mostly we use this procedure for making the validation against business object transaction.It is also known as PreTransactionNotification .

This procedure must return two values for instance:-

Transaction will be rollback if @error holds value other than Zero with the @error message
There are five parameters in the TransactionNotification That procedure takes as an input for the specific business object. These are as:

@objecttype – The object type Of the business Object.this is a string value and represents the object Ex- Business Partner-‘2′, GRPO -’20’.
@transaction_type – This is the action type eg [A]dd, [U]pdate, [D]elete, [C]ancel, C [L]ose
@num_of_cols_in_key – number of columns/fields in the key of the record.
@list_of_key_cols_tab_del – This parameter keys name on which Document going to identify
@list_of_cols_val_tab_del – It automatically receives the current key for identifying the object’s document ex-When we Opens Sales Order, Example: Current DocEntry will be received in this parameter.
How to Use this PrExample:

Prevent a user from adding a GRPO if the field ‘Customer Ref. No’ is empty/blank.


ALTER proc [dbo].[SBO_SP_TransactionNotification]

@object_type nvarchar(20), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int, --number of columns/fields in the key of the record.
@list_of_key_cols_tab_del nvarchar(255), --Key Field name
@list_of_cols_val_tab_del nvarchar(255) --DocEntry value



-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'

--------------------------ADD YOUR CODE FOR GRPO-----------------------------

IF @object_type = N'20' AND ( @transaction_type = N'A' OR @transaction_type = N'U' )

IF (select OPDN.NumAtCard from OPDN where OPDN.DocEntry=@list_of_cols_val_tab_del) IS NULL
SELECT @Error = 11
SELECT @error_message =@list_of_key_cols_tab_del



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!