Skip to Content
0
Former Member
Aug 08, 2012 at 06:11 AM

Validation in SBO_SP_TransactionNotification

12 Views

I want validation in SBO_SP_TransactionNotification that If We have add one doccument with value Branch = Howrah, Name = ABC , Date = 08.08.12. Now I want if user again enter the doccument with same value Branch = Howrah, Name = ABC , Date = 08.08.12 then system check the entry in table that already is exist & give the error for duplicate entry not allowed. I have written code below but it is not working

IF @transaction_type = 'A' AND @object_type = 'Simple Form'

BEGIN

declare @branch NVARCHAR(100)

Select @branch = U_branch FROM "@SIMPLEFORM" T0 where T0.DocEntry = @list_of_cols_val_tab_del

declare @ename NVARCHAR(100)

Select @ename = U_empname FROM "@SIMPLEFORM" T0 where T0.DocEntry = @list_of_cols_val_tab_del

declare @date DATE

Select @date= T0.U_date from "@SIMPLEFORM" T0 where T0.DocEntry = @list_of_cols_val_tab_del

IF Exists (Select T0.DocNum from "@SIMPLEFORM" T0 where T0.U_branch = @branch and T0.U_empname = @ename and convert (date,T0.U_date) = @date )

begin

SET @error = 10

SET @error_message = N'Duplicate Entry Not Allowed'

end

END

Please provide the best solution