Hi Harshal,
check this
IF @transaction_type IN ('A','U') AND @Object_type = '202'
BEGIN
/* Stop Prd. Order if InStock less than Planned. */
IF Exists ( SELECT T1.[DocEntry],T1.[ItemCode], T1.[PlannedQty], T2.[OnHand]
FROM [dbo].[OWOR] T0 INNER JOIN [dbo].[WOR1] T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
WHERE T2.[WhsCode] = T1.[wareHouse] and T1.[PlannedQty] > T2.[OnHand]
and 'Y' = (select T10.InvntItem from oitm T10 where T10.Itemcode = T1.[ItemCode] )
and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 1, @error_message = ' Stock is less than Planned'
END
END