Skip to Content
0
Former Member
Jun 04, 2008 at 04:18 PM

Problem with Debit Memo in sp_TransactionNotification

18 Views

Hello.

I need block the Invoice creation if not have a Sales Order previus. I modified the sp_TransactionNotification:

declare @error int

declare @error_message nvarchar (200)

DECLARE @DocEntry as nvarchar(255)

select @error = 0

select @error_message = N'Ok'

IF @object_type = '13' AND @transaction_type= 'A' AND

BEGIN

SET @DocEntry = @list_of_cols_val_tab_del

IF (SELECT count(*) FROM dbo.RDR1 T0

INNER JOIN dbo.ORDR T1 ON T1.DocEntry = T0.DocEntry

WHERE T0.TrgetEntry = @DocEntry) = 0

BEGIN

SET @Error = 1

SET @error_message = 'ALA-001 No Existe Pedido Previo'

END

END

but the problem is that block Credit Memo creation too. I know that the object type for the invoice and the credit memo is the same, but ¿how make reference at the DocSubType in the sp_TransactionNotification.

thanks in advance.

Oscar