Hi,
Try this and let me know your feedback. Not considered quantity in this code. If this works, then we may try to add other requirements.
if @transaction_type IN ('A','U') and @object_type = '112'
begin
if exists (SELECT t0.docentry FROM ODRF T0 WHERE T0.[ObjType] = 15 and T0.[DocNum] IN ( select T0.docnum from ODRF T0 group by T0.docnum HAVING count(t0.docentry) > 1) and T0.docentry = @list_of_cols_val_tab_del)
begin
SET @error = 121
SET @error_message = 'Delivery for approval already created for this SO'
end
end
Thanks & Regards,
Nagarajan