Hi Ravi
Try this
If (@object_type = '22') and (@transaction_type in ('A' , 'U'))
BEGIN
IF EXISTS ( SELECT t1.Itemcode FROM OPOR t1 INNER JOIN POR1 t2 ON t1.DOCENTRY = t2.DocEntry WHERE t1.DocEntry =@list_of_cols_val_tab_del AND
and (T1.ItemCode not in (select code from oitt)) OR (t1.ItemCode not in (select code from itt1))
)
BEGIN
SELECT @Error = 22
SELECT @error_message = 'Item Cannot be posted'
END
END
Regards
Jenny