Olá Nikhil,
Por favor, teste a consulta abaixo e depois retorne
SE @transaction_type IN (N'A', N'U') E
(@Object_type = N'20')
begin
if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)
FROM [dbo].[PDN1] T0 INNER
JOIN [dbo].[POR1] T1 ON T1.DOCENTRY =
T0.BASEENTRY
WHERE T0.BaseType = 22 E
T0.ItemCode = T1.ItemCode E T0.BaseLine
= T1.LineNum
e T0.DOCENTRY = @list_of_cols_val_tab_del
GROUP BY T0.BaseEntry
HAVING SUM(T0.Quantity)+(SUM(T0.Quantity)*.05) > SUM(T1.Quantity)
ou SUM(T0.Quantity)+(SUM(T0.Quantity)*.05) > sum(t0.BaseOpnQty)
begin
select @Error = 10, @error_message =
'A quantidade do GRPO excede a quantidade do PO'
end
end
Obrigado
Unnikrishnan