Block Posting Entry When the Quantity Delivered is More than the Quantity on the Sales Order

27/03/2022 smart village SAP

When sales orders are raised, Users may deliver more quantity than the quantity in the sales order. To prevent this, use the query below to block posting. The system will generate an error message to warn the user. Follow the path to post the query:

Login to Microsoft SQL Server Management Studio

    1. Expand Databases.
    2. Expand Your Database in this case (SVTL2022).
  1. Expand Programmability.
  2. Expand Stored Procedures.
  3. Scroll down to dbo.SBO_SP_TransactionNotification.

Right Click on dbo.SBO_SP_TransactionNotification

6. Click Modify

7. Paste Query in the section indicated above “Insert your query here”

8. Click Execute   ——-Delivered Quantity cannot be more than Sales order Quantity                                                                                                                                                                                         IF @transaction_type IN (N’A’, N’U’) 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’Delivered quantity cannot exceed Sales order quantity ‘ + CONVERT(nvarchar(4), @numlinii) + N’ !’ end

END

I hope this helps. Thank you