Hi,
Please try this:
IF @transaction_type IN (N'A') AND (@Object_type = N'15')
BEGIN
declare @numlinii int
SELECT @numlinii = (LineNum + 1) FROM DLN1
WHERE DLN1.DocEntry = @list_of_cols_val_tab_del AND ((Quantity > BaseOpnQty))
ORDER BY LineNum ASC
IF (not ISNULL(@numlinii, 0) = 0)
BEGIN
SET @error = 10
SET @error_message = N'Delivery Quantity is more than sales order qty ' + CONVERT(nvarchar(4), @numlinii) + N' !'
end
END
Thanks