Hi,
Try this and replace with your series, ware house and user.
IF @object_type = '22' AND @transaction_type IN (N'A',N'U')
BEGIN
IF Exists
(SELECT T0.DocEntry FROM POR1 T0 INNER JOIN OPOR T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.DocType = 'I' AND T1.Series = 'CAP-14' AND T0.[WhsCode] = '01' and T0.[UserSign] = '1' and T1.docentry = @list_of_cols_val_tab_del)
BEGIN
SELECT @error = 1
SELECT @error_message = 'Not allowed to add PO'
END
END
Thanks & Regards,
Nagarajan