Hi try with this,
IF @object_type= '1250000001' AND @transaction_type in ('A')
BEGIN
IF EXISTS (SELECT T0.DocEntry FROM [dbo].[WTQ1] T0, [dbo].[OITW] T1, dbo.[OWTQ] T2, dbo.[OWHS] T3 WHERE T3.WhsCode = T2.U_Test
and
T1.ItemCode = T0.ItemCode and T2.Filler = '2' and T1.OnHand <0 and T0.WhsCode = 'DS' and T2.DocEntry = T0.DocEntry AND
T2.DOCENTRY= @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 1, @error_message = 'Insufficient Stock'
END
END
Thanks,
Harshal