Skip to Content
0
Former Member
Feb 11, 2010 at 07:16 AM

Warning message if numatcard in delivery receipt is used again

35 Views

Hi guys,

Good day!

Here's the thing: if the numatcard in delivery receipt is used again, a warning message should pop up, informing the user that there's such numatcard already exists.

I have this query.

set ANSI_NULLS ON

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'

declare @CardCode nvarchar (42)

declare @count int

declare @itemcode nvarchar (32)

declare @NumAtCard nvarchar(100)

if @object_type = '17' and @transaction_type in ('A', 'U', 'C', 'D', 'L')

begin

-- SELECT @numatcard = numatcard from ordr

SELECT Top 1 @NumAtCard = NumAtCard, @CardCode = CardCode

FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del

If Exists (SELECT TOp 1 NumAtCard FROM ORDR Where NumAtCard = @NumAtCard And CardCode = @CardCode Group By NumAtCard, CardCode Having COunt(NumAtCard) > 1) Begin

SELECT @error = 1, @error_message = 'Duplicate Customer PO NO "'+ @NumAtCard +'" already exists.'

END

-- Select the return values

select @error, @error_message

end

This actually worked but the problem is it blocks the transaction (DR). A warning message is what is needed.

Please help.

Thank you,

Jaki