Common Controls / Stored Procedures for SBO Transaction Notifications In SAP B1

In this blog we are sharing some common stored procedures which can be used in SAP B1 as transaction notification to prevent or allow customized actions.

You can modify these sample codes and use it as per your requirements.

Please note its recommended to test the stored procedure in test database before applying it in live database. 

If you are keen to learn about SBO transaction notification please watch below video

Sales Order Without Sales Quotation:

IF @transaction_type IN (‘A’,’U’) AND @Object_type = ’17’
BEGIN
IF EXISTS (SELECT T0.[DocEntry] FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.[DocEntry] =
T1.[DocEntry] WHERE T1.[BaseType] = ‘-1’ and t0.DocType = ‘I’
and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 17, @error_message = ‘Sales Order without Sales Quotation’
END
END

Delivery Without Sales Order:

IF @transaction_type IN (‘A’,’U’) AND @Object_type = ’15’
BEGIN

IF EXISTS (SELECT T0.[DocEntry] FROM ODLN T0 INNER JOIN DLN1 T1 ON T0.[DocEntry] =
T1.[DocEntry] WHERE T1.[BaseType] = ‘-1’ and t0.DocType = ‘I’
and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 15, @error_message = ‘Delivery without Sales Order’
END
END

 

Invalid Numbering Series on AR Invoice

IF @transaction_type IN (‘A’,’U’) AND @Object_type = ’13’
BEGIN

IF EXISTS (SELECT T0.[DocEntry] FROM OINV T0 WHERE T0.[Series]= ‘4’ and T0.DocType = ‘I’
and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 112, @error_message = ‘Invalid Series’
END
END

Leave a Comment

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