Posting freight lines automatically from the WMS Shipment in Dynamics NAV

Posting freight lines automatically from the WMS Shipment in Dynamics NAV

Some of my customers using the Dynamics NAV Warehouse Management (WMS) module face the same issues with this WMS setup:

  1. The Sales Orders are created by the sales people and a freight line is applied, either as a G/L line or as a resource line.
  2. When the sales order is released for delivery, shipment lines are made based on the sales order, either by the sales person, by the warehouse manager or by the warehouse employee himself.
  3. Depending on the setup, a pick is created and posted to “transport” the item from the picking zone to the shipment zone.
  4. Lastly, the warehouse shipment is posted.
  5. At nighttime, all sales orders with posted shipments are automatically invoiced and invoices are printed/sent by email.

Using the WMS module, it means that the warehouse employees do not necessarily see the sales order because they have all necessary information on the Warehouse Shipment. However, only item lines are transferred to the warehouse shipment so all other types have to be handled manually on the sales order. Making an automation like this, will leave all G/L lines and resource lines behind on the sales order to be posted separately later. This also means that the customers will receive separate invoices: one for the items and one for the freight.

There is a fairly simple solution to the problem. It does demand a license to change codeunits though.

In the Warehouse setup table (5769), two fields are created:

  • Post G/L lines with Shipments
  • Post Resource lines with shipments.

Two lines if both G/L Lines and Resource lines should be posted otherwise one field is enough.

And the equivalent Warehouse Mgt. Setup page (5775):

In the Whse.-Post Shipment Codeunit (5763):

Find the function HandleSalesLine, make a local variable…

…and insert the Following lines just before the end of the function:


Now if the fields are activated in the setup table, freight lines made as G/L lines or resource lines on the sales order will always be included in the posting of the shipment, and thereby be included on the invoice.

To keep the solution as close to standard as possible, the fields could be created in a customer specific setup table and page. This way the only change will be in the codeunit.

Leave a Reply

Your email address will not be published. Required fields are marked *