Hi,
Please try this:
IF @transaction_type = 'A' AND @object_type = '20'
BEGIN
IF exists (Select ItemCode from dbo.PDN1 T0
Where T0.Baseentry is null
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 1, @error_message = 'Not allowed to create GRPO without Purchase Order!'
End
END
Thanks