How do I create a Partial Warehouse Shipment in Business Central?

Hello Readers,

I would like to start this blog with something simple yet frequently asked about - how to create a partial warehouse shipment in Business Central. There are not many options to accomplish this in the standard application, while it seems to have significant business value for some companies.

Why, you may ask?

Because many businesses see a warehouse shipment as a document describing a single transport (truck, container, whatever) leaving the company's premises. This transport can be just a part of the underlying order (or even an order line) - an order that could potentially fit many transports departing on the same day.

Seems logical, right? Let’s see, what the vanilla version of Business Central has to offer to support this.


We will start with a simple Sales Order with the WMS location:

To create a warehouse shipment for this order we can now use the Create Warehouse Shipment action which will result in the following document:

As some of you already expected, and all of you can see now, both lines from the order have been included on the warehouse shipment with the full quantities. So how to make it a partial warehouse shipment now? We cannot change the quantities in the lines (this field is not editable), but…

We can remove lines!

How does that help us? Let’s analyze this. If we remove any of the lines from our warehouse shipment and try using Create Warehouse Shipment action on the underlying order again, Business Central will create a new warehouse document for all the lines and quantities that are not included on any existing (or posted) warehouse shipment.

So we know that it is possible to split an order into multiple warehouse shipments on the line basis. But, how to split one order line into multiple warehouse shipments? Well, you can’t. You would need to split the order line and follow the above procedure.

I mean - it works, but we can do better.


As you probably know, on the Sales Order lines we can find the Qty. to Ship field that allows us defining a portion of the line that should be shipped during a posting routine. Unfortunately it does not work with WMS, but what if it did?

When I was looking into making the partial warehouse shipment creation easier, I wondered how we could incorporate that Qty. to Ship idea into warehouse document creation and I came up with the following design.

 

Let’s create a new set of Qty. to Ship (Whse.) and Return Qty. to Receive (Whse.) fields and let users decide what portion of the sales line should go to the warehouse document at the very beginning. These new fields should be autofilled in a similar way as the standard fields, but for the lines with WMS locations.

 

As soon as I started developing this change it turned out that making it happen was actually quite easy. I started with adding new field definitions (including both line UoM and base UoM quantities) and creating procedures for initializing their values.

You may notice that I was forced to add two new FlowFields for Return Whse. Outstanding Quantity as these were missing for some reason.

Later I looked into the objects that Business Central uses when creating warehouse documents. There are plenty, but it turned out that what I was looking for was Sales Warehouse Management (codeunit 5991). In the current system architecture it’s a codeunit handling the connection between sales and warehouse lines. I used two sets of event subscribers - one for handling Qty. to Ship (Whse.) and Return Qty. to Receive (Whse.) positive values and another to make sure that we won’t create any warehouse document header without lines.

And then… of course I adjusted a few other things, but let’s keep it concise, shall we? You can find the complete source code on my GitHub


Results? We will start with a Sales Order similar to the one we started with:

In the subform we can see one of the new fields - Qty. to Ship (Whse.). It has been filled in with the line’s outstanding quantity according to the Sales & Receivables Setup.

Let’s say we want to create a partial shipment now; let’s adjust the values:

Now we can try executing the Create Warehouse Shipment action:

Voila! We created a partial Warehouse Shipment with portions of the underlying sales order lines based on user input.