Hi All,
I have used above SP into SP_TN but how come it does not works?
I would like to control my DO qty cannot greater than SO qty.
Can anybody explain to me what's wrong with the code?
After put the code do compile and do i need to do anything such as store procedure on DO's Qty?
Please advise.
IF @transaction_type IN (N'A', N'U') AND (@Object_type = N'17')
BEGIN
IF exists (SELECT T0.BaseEntry, SUM(T0.Quantity)
FROM [dbo].[DLN1] T0
INNER JOIN [dbo].[RDR1] T1 ON T1.DOCENTRY = T0.BASEENTRY
WHERE T0.BaseType = 15 AND T0.ItemCode = T1.ItemCode AND T0.BaseLine = T1.LineNum
AND T0.DOCENTRY = @list_of_cols_val_tab_del
GROUP BY T0.BaseEntry
HAVING (SUM(T0.Quantity) > SUM(T1.Quantity)) or sum(t0.quantity) > sum(t0.BaseOpnQty))
BEGIN
SET @Error = 10
SET @error_message = 'Delivery quantity is over Sales quantity'
END
SELECT @error, @error_message
END
Thank you.
Regards
Jenny