Try This
IF @object_type = '20'
AND @transaction_type in ( 'A' ,'U')
BEGIN
IF EXISTS (
SELECT t1.DocEntry
FROM OPDN t1
INNER JOIN PDN1 t2
ON t1.DocEntry=t2.docentry
WHERE @list_of_cols_val_tab_del = t1.DocEntry
AND t2.WhsCode not in ( '19' )
)
BEGIN
SET @error = -2
SET @error_message = 'Select the QC warehouse in Goods Receipt Purchase Order'
END
END