Batch Creation of Warehouse Shipments

In one of my previous blog posts about processing shipments I mentioned a batch job I developed many years ago to automatically create warehouse shipments. I have since that post received many requests and questions about this batch job, so here it is!

The objects themselves are available in the downloads section and the details about the functionality is described below. I hope you will find this useful.

In standard Microsoft Dynamics NAV there are two ways to create warehouse shipments; 1. from the order itself using a create warehouse shipment function or 2. by manually create a warehouse shipment and retrieving order lines using pre-configured filters or selecting individual orders. The modification described here provides a third option that allows you to create the warehouse shipments using a batch job that runs through all warehouse requests and automatically create the appropriate warehouse shipments. This is an option that has in many cases been proven superior compared to the two standard methods of creating warehouse shipments.

The main advantage with this modification is that you can have Dynamics NAV to automatically create warehouse shipments that represents shipments to be processed to individual destinations, one destination one warehouse shipment (instead of one warehouse shipment with orders going to different destinations which is the true intention behind the warehouse shipment in Dynamics NAV).

Another great advantage is that it allows Dynamics NAV to combine orders going to the same destination into a single warehouse shipment and in the same time also divide orders with multiple shipment dates into different warehouse shipments.

This modification works both for location that are setup as directed put-away and picks and also without the directed put-away and picks as long as the require shipment functionality is activated.

Sounds great, right?

Here is how it’s been developed;

Three new fields has been added to the warehouse shipment header; destination type, destination no. and destination sub. no. The new fields indicates where the shipment is going, the destination type is either customer, vendor or location and the destination no. is then either the customer no., vendor no. or location code (same fields as you have in the warehouse request table). The destination sub. no. is in case there is a ship-to code on the sales order or an order address code on the purchase return order.


The new fields will be used by the batch job to combine order lines going to the same destination into one warehouse shipment. The combining of orders in this case is based on the three fields, plus the shipping agent code (which is already a standard field in the warehouse shipment header).

To make it work the destination sub. no. field has also been added to the warehouse request table. The warehouse request table basically sits between the orders and warehouse shipments. Records in the warehouse request table are created when the order is released and based on those records the warehouse shipments are created.


Then there are some new code added to codeunit 5771 – Whse.-Sales Release and 5772 – Whse.-Purch. Release to populate the new destination sub. no. field in the warehouse request tabled during the release of an order.


The actual batch job that creates the warehouse shipments is then a process only order report (like a typical batch job in Dynamics NAV) based on the warehouse request table.


In addition to filtering on the warehouse requests it has the following options;

Ending Date – Specifies the horizon for which warehouse shipments should be created. Order lines with shipment dates on this date and earlier will be included when warehouse shipments are created. Note that it looks at the order lines not the headers.

Combine Shipments – This Boolean fields determines if the batch job should combine order lines going to the same destination with the same shipping agent.

Append to Existing Shipment – This option field defines if the batch job should append order lines to existing warehouse shipments or not. It is only enabled if the combine shipment function is used. The options are never, always and if no pick exists.

When the warehouse shipments are created they are automatically released. So, if you are using warehouse shipments in combination with warehouse picks then you can go directly to the warehouse pick creation (through the pick worksheet for example) after this batch job has run.

During the creation of the warehouse shipment we need to make sure the new fields are populated. This is done in report 5753 – Get Source Documents according to below.


The typical way to apply the functionality is to have a user run the batch job a couple of times a day with an ending date today or a couple of days forward. New orders that are created and that are due to be shipped within the next couple of days will then be added as warehouse shipment automatically. Orders that are due further out in the future will not be added to any warehouse shipments until it becomes time to process them.

Places that are using this minor modification are really liking it and it has added lots of value.

One additional thing that can be done is to change the functionality on the warehouse shipments that allows users to add additional order lines to an existing warehouse shipment so that it prevents mixing order lines going to different destinations.

The objects are in the downloads area, as always with my objects; use them as you want but use them at your own risk.

The post Batch Creation of Warehouse Shipments first appeared on Olof Simren - Microsoft Dynamics NAV & 365 Business Central Blog.

Olof Simren - Freelance Microsoft Dynamics NAV Expert

Naviona - Microsoft Dynamics NAV Partner

Comment List