Query For Null Vendor’s Refrence Number ( SP_TransactionNotification)
Query For Null Vendor’ Refrence Number (SBO_SP_TransactionNotification)
This Query is Generate Error Message if you Add your Purchase Order Document Without entering the Vendor’s Refrence Number
USE [SP_Notification]
GO
/****** Object: StoredProcedure [dbo].[SBO_SP_TransactionNotification] Script Date: 26/04/2016 14:02:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
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,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
— 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’
——————————————————————————————————————————–
IF @transaction_type = ‘A’ or @transaction_type = ‘u’ AND @object_type = ’22’
BEGIN
IF exists (SELECT T0.[DocNum] FROM OPOR T0 WHERE T0.[NumAtCard] IS NULL and @object_type=’22’ and T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 20, @error_message = ‘Please Enter Vendor’s Refrence Number First!’
End
END
——————————————————————————————————————————–
— Select the return values
select @error, @error_message
end
Thanks
Bhavesh Samant
Thank you..
Hello Shane,
If you want this query in other Document like Goods Receipts Po and Other you can change Object_type and field Which you want..
Thanks
Bhavesh Samant
Good effort ! it will be helpful for others also.