Warehouse & 3PL BC Sales Line → Warehouse Shipment (Whse. Validate Source Line, codeunit 5777) Microsoft BCApps source: WhseValidateSourceLine.Codeunit.al (Text001) and SalesWarehouseMgt.Codeunit.al (SalesLineDelete); mibuso forum report

Cannot Cancel or Change a Sales Order Line: A Related Warehouse Shipment Line Exists

Raw System Error String
The Sales Line cannot be deleted when a related Warehouse Shipment Line exists.

What It Means

A customer cancels a line or the whole order, or a Shopify/EDI update tries to remove a line. Business Central refuses, because the line is already on a warehouse shipment. The warehouse (your own or a 3PL fed from warehouse shipments) has the instruction to ship it. A related error appears if you change the line instead of deleting it: 'Quantity must not be changed when a Warehouse Shipment Line for this Sales Line exists'. The same check covers Type, No., Variant Code, Location Code, Unit of Measure Code, Drop Shipment, Qty. to Ship and Shipment Date.

Root Cause

When a sales line is on a warehouse shipment, codeunit 'Sales Warehouse Mgt.' blocks a delete (SalesLineDelete calls RaiseCannotBeDeletedErr) and blocks changes to key fields (SalesLineVerifyChange). This is a control: the sales side must not change an order while the warehouse works on it. It fires even if nothing is picked or shipped yet. Integrations that cancel or edit orders automatically (Shopify order edits, EDI 860 change orders, 3PL connectors) hit it when they run after the warehouse shipment was created.

Step-by-Step Fix

  1. Note the sales order number and line number from the error or from the integration log.
  2. Open the sales order. Choose Related > Warehouse > Warehouse Shipment Lines (or search 'Warehouse Shipments' and filter on the order number) to find the shipment.
  3. Check with the warehouse or 3PL that nothing is physically picked or packed for that line. If a pick exists, delete or register the pick first; if a 3PL received the order, cancel it in the 3PL portal first.
  4. Open the warehouse shipment. Delete the line for this sales line, or delete the whole shipment if it only holds this order.
  5. Go back to the sales order. If its Status is Released, choose Reopen.
  6. Delete or change the sales line (or rerun the integration step that failed).
  7. Release the order again and choose Create Warehouse Shipment if the rest of the order must still ship.
  8. To stop repeats: have the integration check for warehouse shipment lines before it edits an order, and send late changes to a person instead of failing in the job queue.

Verification Steps

How to verify: The sales line deletes or changes without the error. The warehouse shipment, if recreated, holds only the lines that should ship.

Sources & References

Early Access · 30-Day Sandbox Pilot

Stop Order Sync Failures Before Customers Notice

The Order Flow Doctor monitors Microsoft Dynamics 365 Business Central order flows across Shopify, EDI (TrueCommerce, SPS), 3PLs, and carriers. Get automated root-cause diagnosis and one-click fixes.

We respect your privacy. No spam. You will only be contacted when pilot slots open for your stack.