Hi,
Try this:
IF @transaction_type in ('A') AND (@OBJECT_TYPE='67')
BEGIN
IF exists (SELECT T0.[Docentry] FROM OWTR T0 inner join WTR1 t2 on t2.docentry =
t0.docentry WHERE (T2.U_RemainQty = 0 or T2.U_RemainQty ='') and T2. U_ChallanEntry is not null OR T2. U_ChallanEntry ='') and
T0.Docnum = @list_of_cols_val_tab_del )
Begin
SET @error = 345575
SET @error_message = 'Please check Remaining open quantity'
End
End