Microsoft Dynamics AX 2012 R3 – WMS/TMS scenario from setup through execution to transportation charges on order

Purpose: The purpose of this document is to illustrate how to setup and execute on WMS/TMS scenario in Microsoft Dynamics AX 2012 R3. In particular I want to focus on end-to-end logical flow from setup through execution to transportation charges applied to order, and highlight appropriate technical details to support troubleshooting if necessary.
 
Challenge: In Microsoft Dynamics AX 2012 R3 you can leverage advanced Warehouse management and Transportation management business capabilities. End-to-end WMS/TMS scenario will require appropriate setup from setting up location directives and work templates to wave templates, etc. for WMS, and from carrier setup to various engines parameters for TMS. Proper logical understanding of data elements involved in WMS/TMS scenario setup may greatly facilitate your efforts.
 
Solution: In this walkthrough I'll focus on logical sequence of steps when setting up sample end-to-end WMS/TMS scenario for outbound flow using sales order. I'll also provide easy-to-understand diagrams to facilitate understanding of the topic. And also I'll provide necessary technical details for you to be able to effectively and efficiently set up your own scenarios. For more in depth info please refer to Warehouse management implementation guidance document (link) and Transportation management implementation guidance document (link).
 
Walkthrough
I'll start with a brand new company in Microsoft Dynamics AX 2012 R3 using Demo VM to emphasize the ease of setup. After I created my own company "ALEX" I also did appropriate required minimum setup for the company itself (currency), ledger details (chart of accounts, accounting structures, currencies, exchange rates) and inventory posting details (because I used Shared chart of accounts I just replicated accounts from USMF company for simplicity)
In my scenario I'll showcase outbound flow using sales order. Sales order will be created, transportation load will be planned according to the setup, warehouse work will be created for picking, and ultimately I want to include transportation charges to sales order
At this point I'll start setting up data specific to my scenario
I'll start with Customer  
Customer
You can notice that I specified address (GA) for the customer above
Customer (Delivery terms)
Delivery terms setting for the customer is important because this will allow to enable adding transportation charges to order upon confirmation of outbound shipment
Terms of delivery
Please note that I marked "Add transportation charges to order" checkbox
In warehouse parameters I'll define User location specifying a template which is not License plate controlled, this will be required later for successful warehouse work execution
Warehouse parameters
Note: User location profile (Non license plate controlled)
Then I will create a new warehouse and specify address for it, this address will be used as Ship From address during load planning later, and logically Customer address will be used as Ship To address
Warehouse
I'll check User location "1" and its non-empty Aisle, prior to that I have created Warehouse worker "1"
User location
Also I defined a bunch of other location in warehouse as necessary (skipping the setup of all locations here for simplicity)
Next stop is definition of the product
Product
Please note that "Ware" storage dimension group has been used which is appropriate for Advanced Warehouse management in Microsoft Dynamics AX 2012 R3 Demo VM. While I'm setting up the product I'll also set up its physical dimensions, this will be needed for the future apportionment of transportation charges onto sales order line(s) based on product(s) weight
Physical dimensions
Now let's review business entities involved in WMS portion setup
WMS setup process diagram
In particular before we execute we have to set up Location directives (to know where to pick products from for sales order picking scenario), Work templates (to know what steps to perform during picking process for sales order picking scenario) and Wave templates (to define Wave picking activities)
Location directives
Location directives – Location directives (Edit query)
Location directives – Location directive actions (Edit query)
My location directive action defines "LPBULK" warehouse location as picking location for sales order picking, this is where I'll start from
Work templates
Work template (Edit query)
My work template defines 2 steps required when doing picking (one pick operation and one put operation), I'll specify where I'll put my product myself during picking using RF scanner. Also while I'll be executing warehouse work User location I've set up earlier will also be used on the background
Wave template
For wave template I'll mark "Automate wave creation", "Process wave at release to warehouse" and "Automate wave release" checkboxes to automate wave creation and wave release into one step which automatically takes place when I release work to warehouse (for simplicity). I also defined wave processing methods in a sequence as shown above. Please note that if you don't see wave processing methods available you should regenerate them ("Regenerate methods" button) as shown below
Wave process methods
Then I'll compose my RF menu keeping it very simple, just one single option for sales picking
Mobile device menu items
For sales picking menu item I'll use existing work generated upon release work to warehouse and keep it User directed. At last I'll include menu item to the appropriate menu as shown below
Mobile device menus
And here is my warehouse work user setup
Work user
This concludes a required minimum setup for my scenario
Now we can switch to TMS portion setup. The idea is that I'll need to ship product(s) from WA (Zip code 98052) to GA (Zip code 30009)
TMS (98052 -> 30009) setup process diagram
When setting up TMS portion I'll need to answer a number of questions defining how I want to transport goods. Here's the logical list of questions:

-          How will transport the goods (which shipping carrier)

-          How will carrier deliver the goods (what services, for example, standard or expedited)

-          How much will it cost to deliver goods based on certain criteria (cost, time, distance, etc.)

-          More specifically how much will it cost and why (based on service and geo location)

-          More specifically how big is the distance (based on geo location)

-          More specifically how long will it take to deliver the goods (based on geo location)

Once you answer these questions and set up the system appropriately you'll be ready to plan your transportation loads. Let's see how this works 
First of all I'll initialize base transportation engines data in Transportation parameters with all the engines shipped with the product which is a huge help 
Transportation management parameters
Dialog
Infolog
Then before I review what system has generated for me I'll define transportation Miscellaneous charge based on charge code for Charge module = Customer which is needed in order to transfer transportation charges to sales order upon Outbound shipment confirmation
Miscellaneous charges
Here's how the original charge code looks like
Charges code
Please note that I specified Debit on Customer and Credit onto Ledger account
I'll also need transportation mode as defined below, I'll use "Ground" for simplicity
Mode
After this we're ready to set up transportation carrier, I'll call it "Contoso", it may be external party associated with vendor account or internal party if you operate your own fleet depending on your business requirements
Carrier
Please note that I marked "Use carrier" and "Activate carrier rating" checkboxes which is required for future transportation Rate shopping. As the next step I'll add Service to carrier using data I created earlier
Carrier - Service
After the system initialized engines data for me a number of data elements have been created. Here's how Rate base types look like. I'll focus my attention on P2P rate base type for clarity
Rate base type – Rate base
Please notice that for P2P rate base type a certain meaningful data setup elements have been already defined. By looking at the setup I'll need at least to specify country (and Zip code) in order to define rates for the places I can expect my goods to be delivered to (Drop off …)
Rate base type – Assignment
Out of the box transportation engines come with the product in Microsoft.Dynamics.Ax.TMS.dll assembly which can be found in Server directory
Engines assembly
Here's the list of engines, but I'll focus my attention on P2PMileage engine for clarity
Rate engine
The idea is that in order to identify transportation rate P2P mileage engine will be used, the rates will be assigned based on Pick up Country (as specified in Rate base type – Assignment above), and apportionment engine based on weight will be used to apportion transportation charges onto sales order line(s)
Rate engine – P2PMileage - Parameters
Here's the details of apportionment engine
Apportionment engine (Generic engine)
For the apportionment engine in use the system will be looking at Route > Segment > Shipment > Container > Line apportionment hierarchy apportioning to Shipment level only taking into account product Weight (please recall Product physical dimensions setup to make it happen)
Apportionment engine - Parameters
Please note that there's a number of apportionment engines available as shown above. The general idea behind apportionment of transportation charges is that taking into account total amount from transportation invoice this amount gets allocated to each order line item on the associated order based on certain criteria. Apportionment criteria may be by weight (based on product data), by volume (based product data), by product cost, by price (net unit price of the product), etc.
 
In order to understand how transportation time is defined we'll take a look at Transit time engine
Transit time engine
Transit time engine – Details
Please note that I defined 7 days to be required to transport goods from WA (98052) to GA (30009) using Standard service (STD). And this is how I can tell which data elements are required to define transit time. Transit time field screen suggests that I need to specify at least Pick up and Drop off Countries to define transit days
Transit time field
Transit time engine - Parameters
Then we'll create a rate master to define transportation rate and tie it to P2P rate base type
Rate master (created from scratch)
Below we'll see already familiar setup for Rate base type – Assignment based on Pick up Country
Rate master – Rate base type
Rate base setup is still empty, so we'll need to create appropriate setup there
Rate master – Rate base
But before we do this we'll need to introduce Break master defining how we assign rates based on distance buckets. That's why we'll go ahead with creation of a new Break master
Break master (created from scratch)
For simplicity I created Empty Break master charging for each mile as opposed to miles buckets (for example, <100 miles, <200 miles, etc.). Now we can tie it all together (Break master with Rate base setup for Rate master)
Rate base - Details
As you can see I defined that 10$ will be charges for each mile between WA (98052) and GA (30009) for simplicity
Rate base - Search
Note: In case Search screen is not showing you newly created Rate base details please refresh the screen (F5). Now we'll take another look at Rate base type – Rate base setup
Rate base type
And then review the final setup pf Rate master
Rate master
Rate master – Rate base assignment
The rate will be assigned based on Pick up Country and Pick up Zip code criteria from Rate base (P2PMileageBase) for Standard Service (STD)
Now we have enough data to define Shipping carrier Rating profile
Shipping carrier – Rating profile
Shipping carrier – Rating profile
We still remember Rate engine setup as shown below
Rate engine
Rate engine - Parameters
Now using Mileage engine we'll define what will be the distance between point A (WA, 98052) and point B (GA, 30009) for transportation
Mileage engine
Mileage engine field setup suggest what info will be needed to define distance(s), we'll need at least Pick up Zip code and Drop off Zip code
Mileage engine field
Mileage engine - Parameters
Now I can define that the distance between WA, 98052 and GA, 30009 will be 500 miles
Mileage engine - Details
Mileage engine - Details
The next logical step is to define transportation route. You can define it in number of ways. For example, below I defined Route guide with Shipping carrier, Carrier service and Delivery terms criteria
Route guide
Route guide – Origin/Destination
Terms of delivery
OR
You can define Route guide using Route plan
Routing guide
Route plan
Route plan allows me to define multi-stop routes with hubs if necessary
Route plan - Details
Hub master
You may use different hub types, for example, Warehouse, DC (Distribution center), etc.
Hub type
Ultimately you can define stop rates for route segments as necessary
Spot rates
When all the setup is complete you can open Rate route workbench and do Rate shopping
Rate route workbench (Rate shop)
As the result you will see that the system will suggest transportation option exactly based on what we've set up earlier
Rate route workbench – Route results
Rate route workbench – Segments (Segment)
Rate route workbench – Segments (Details)
Now we can switch to the execution mode and proceed with sales order creation
Sales order
Please note that after I created a new sales order address has been propagated properly on sales order based on customer master setup
Sales order - Lines
I'll do inventory reservation before I release work to warehouse
Reservation
Sales order
From sales order I can now execute Rate route workbench directly. This way all the necessary data will be defaulted into Rate route workbench from sales order
Rate route workbench
The result I observe here will be exactly the same comparing to the one we saw when testing. After I feel comfortable about suggested transportation option I can assign this Route with Rate to my sales order
Infolog
Mode of delivery has been properly assigned to sales order line
Sales order Line - Details
Now as I have planned transportation for sales order I'm ready to execute warehouse work to get products out of the warehouse, that's why I'll release work to the warehouse now
Sales order
Note: Please don't forget to specify street in your addresses (From, To) in order to avoid exception upon Release work to warehouse
Infolog
When my work has been successfully released to the warehouse the system also created associated picking wave and shipment
Infolog
This is how associated Shipment looks like
Shipment
This is how associated Load looks like
Load
This is how generated work looks like
Work
This is how associated picking wave looks like
Wave
You can also review the load on Load planning workbench
Load planning workbench
We know that the work has been already released to warehouse, so we can execute the work now
Scanner interface - Login
Scanner interface - Menu
I enabled only one menu item for sales picking for simplicity
Scanner interface – User directed
We'll start with scanning WorkID to begin work execution
Scanner interface – User directed
Based on earlier Location directive setup we'll be picking from "LPBULK" location. Please note that I assume you have enough on-hand in that location, also otherwise you would not be able to reserve inventory before releasing work to warehouse for picking
Scanner interface – User directed
Please note that initially I did have enough on-hand in "LPBULK" location on License Plate "1"
Scanner interface – User directed
Scanner interface – User directed
I'll move products to "LPSTAGE" location for loading onto the truck. For simplicity I'll only do sales picking using scanner
Scanner interface – User directed
Then I complete the work
Scanner interface – User directed
Now I can review that work status changed to Closed
Work
And associated inventory transactions changed status to "Picked"
Inventory transactions
Now we'll back to sales order
Sales order
This is how planned transportation charges looked like
Rate route workbench
Rate route workbench – Route Results
Rate route workbench – Segments (Segments)
Rate route workbench – Segments (Details)
Please also note that I could have assigned rate and route automatically by pressing "Route with rate" button. In my case the result would be the same because I only set up one transportation option
Infolog
You can also review the route itself
Route
Route – Segment
Route – Segment info
Route - Load
Route - Shipment
On Route rate details screen we can explicitly see the rate (transportation charge)
Route rate details
Now when we reviewed necessary info we can go ahead and confirm outbound shipment which will transfer associated transportation charges onto sales order (apportion them into sales order lines) in form of miscellaneous charges
Load details – Confirm Outbound shipment
Confirm Outbound shipment - Infolog
At this point I can expect miscellaneous charges for transportation charges to appear against appropriate sales order line(s). In fact I will stop for a bit to review what takes place behind the scenes. The question I would logically have in order to understand the process completely: How [transportation charge]-related miscellaneous charge gets created? Assuming that you have proper setup miscellaneous charge will be created and then updated (with exact amount based on results of apportionment) upon outbound shipment confirmation
In Microsoft Dynamics AX 2012 R3 TMS you can also review TMS transactions taking place behind the scenes. Thus route confirmation steps are takes in  \Data Dictionary\Tables\TMSRoute\Methods\routeConfirmation method. Here's how messages related to route confirmation looks like
Request
<?xml version="1.0" encoding="utf-8"?><Transaction><Type>CONFIRMATION</Type><DataArea>alex</DataArea><DlvTerm>DEF</DlvTerm><CarrierCode>Contoso</CarrierCode><CarrierServiceCode>STD</CarrierServiceCode><CarrierGroupCode></CarrierGroupCode><InventSiteId>1</InventSiteId><InventLocationId>11</InventLocationId><ThirdPartyAccount></ThirdPartyAccount><ModeCode></ModeCode><BaseCurrency></BaseCurrency><DefaultDimension><BusinessUnit></BusinessUnit><CostCenter></CostCenter><Department></Department><ItemGroup></ItemGroup><Project></Project></DefaultDimension><ModuleType>Cust</ModuleType><Accounts><CustomerCode>Client</CustomerCode><CustomerGroup>10</CustomerGroup><CustomerInvoiceCode>Client</CustomerInvoiceCode><VendorCode></VendorCode><VendorGroup></VendorGroup><VendorInvoiceCode></VendorInvoiceCode></Accounts><Request><ShippingEntity><Type>SHIPMENT</Type><RouteGuideName></RouteGuideName><RoutePlanName></RoutePlanName><RouteConfigurationCode></RouteConfigurationCode><Sequence>1</Sequence><RECORDTYPE>Load</RECORDTYPE><LoadId>ALEX-000011</LoadId><ShipmentId>ALEX-000003</ShipmentId><Direction>Outbound</Direction><OrderNumber>ALEX-000013</OrderNumber><OrderCurrency>USD</OrderCurrency><LoadTemplate></LoadTemplate><TransportationTemplate></TransportationTemplate><Customer><Name>Client</Name><Address>One Microsoft Way</Address><City>Alpharetta</City><State>GA</State><PostalCode>30009</PostalCode><CountryRegion>USA</CountryRegion><County>FULTON</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential></Customer><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode><PickUp><Name>11 - Warehouse 11</Name><Address>One Microsoft Way</Address><City>Redmond</City><State>WA</State><PostalCode>98052</PostalCode><CountryRegion>USA</CountryRegion><County>KING</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode></PickUp><DropOff><Name>Microsoft</Name><Address>One Microsoft Way</Address><City>Alpharetta</City><State>GA</State><PostalCode>30009</PostalCode><CountryRegion>USA</CountryRegion><County>FULTON</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode></DropOff><Weight>1.00</Weight><Volume>0.00</Volume><STCC></STCC><DeliveryDate>06/20/2015 06:59:59</DeliveryDate><ShipDate>06/13/2015 01:14:33</ShipDate><DlvTerm>DEF</DlvTerm><EquipmentCode></EquipmentCode><Value>100000.00</Value><DirectDelivery>false</DirectDelivery><ShippingEntity><Type>LINE</Type><ItemId>ProductWHS</ItemId><Qty>1.00</Qty><Weight>1.00</Weight><STCC></STCC><Harmonized></Harmonized><Volume>0.00</Volume><Value>100000.00</Value><TMSFilterCode1></TMSFilterCode1><TMSFilterCode2></TMSFilterCode2><TMSFilterCode3></TMSFilterCode3><TMSFilterCode4></TMSFilterCode4><InventTransId>ALEX-000053</InventTransId><RecId>5637146097</RecId><PackQty>1.00</PackQty></ShippingEntity><DeliveryAccessorials /><RatingEntities><RatingEntity><CarrierCode>Contoso</CarrierCode><CarrierServiceCode>STD</CarrierServiceCode><MethodCode>Ground</MethodCode><ModeCode>Ground</ModeCode><Rate><RateType>2</RateType><Code>P2PMileageBase</Code><Level>Shipment</Level><TotalRate>5000.00</TotalRate><ShipperRate>5000.00</ShipperRate><CustomerRate>5000.00</CustomerRate><CurrencyCode>USD</CurrencyCode><UnitRate>5000.00</UnitRate><Units>1</Units><User>No</User></Rate></RatingEntity></RatingEntities></ShippingEntity></Request></Transaction>
 
Response
<Transaction>
  <Type>CONFIRMATION</Type>
  <DataArea>alex</DataArea>
  <DlvTerm>DEF</DlvTerm>
  <CarrierCode>Contoso</CarrierCode>
  <CarrierServiceCode>STD</CarrierServiceCode>
  <CarrierGroupCode></CarrierGroupCode>
  <InventSiteId>1</InventSiteId>
  <InventLocationId>11</InventLocationId>
  <ThirdPartyAccount></ThirdPartyAccount>
  <ModeCode></ModeCode>
  <BaseCurrency></BaseCurrency>
  <DefaultDimension>
    <BusinessUnit></BusinessUnit>
    <CostCenter></CostCenter>
    <Department></Department>
    <ItemGroup></ItemGroup>
    <Project></Project>
  </DefaultDimension>
  <ModuleType>Cust</ModuleType>
  <Accounts>
    <CustomerCode>Client</CustomerCode>
    <CustomerGroup>10</CustomerGroup>
    <CustomerInvoiceCode>Client</CustomerInvoiceCode>
    <VendorCode></VendorCode>
    <VendorGroup></VendorGroup>
    <VendorInvoiceCode></VendorInvoiceCode>
  </Accounts>
  <Request>
    <ShippingEntity>
      <Type>ROUTE</Type>
      <ShippingEntity>
        <Type>SHIPMENT</Type>
        <RouteGuideName></RouteGuideName>
        <RoutePlanName></RoutePlanName>
        <RouteConfigurationCode></RouteConfigurationCode>
        <Sequence>1</Sequence>
        <RECORDTYPE>Load</RECORDTYPE>
        <LoadId>ALEX-000011</LoadId>
        <ShipmentId>ALEX-000003</ShipmentId>
        <Direction>Outbound</Direction>
        <OrderNumber>ALEX-000013</OrderNumber>
        <OrderCurrency>USD</OrderCurrency>
        <LoadTemplate></LoadTemplate>
        <TransportationTemplate></TransportationTemplate>
        <Customer>
          <Name>Client</Name>
          <Address>One Microsoft Way</Address>
          <City>Alpharetta</City>
          <State>GA</State>
          <PostalCode>30009</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>FULTON</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
        </Customer>
        <ResponsibleForPayment>Company</ResponsibleForPayment>
        <VendorCode></VendorCode>
        <VendorInvoiceCode></VendorInvoiceCode>
        <PickUp>
          <Name>11 - Warehouse 11</Name>
          <Address>One Microsoft Way</Address>
          <City>Redmond</City>
          <State>WA</State>
          <PostalCode>98052</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>KING</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
          <ResponsibleForPayment>Company</ResponsibleForPayment>
          <VendorCode></VendorCode>
          <VendorInvoiceCode></VendorInvoiceCode>
        </PickUp>
        <DropOff>
          <Name>Microsoft</Name>
          <Address>One Microsoft Way</Address>
          <City>Alpharetta</City>
          <State>GA</State>
          <PostalCode>30009</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>FULTON</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
          <ResponsibleForPayment>Company</ResponsibleForPayment>
          <VendorCode></VendorCode>
          <VendorInvoiceCode></VendorInvoiceCode>
          <Mileage>
            <MileageEngineCode>P2P</MileageEngineCode>
            <Miles>500</Miles>
          </Mileage>
          <ZoneMasters />
        </DropOff>
        <Weight>1.00</Weight>
        <Volume>0.00</Volume>
        <STCC></STCC>
        <DeliveryDate>06/20/2015 06:59:59</DeliveryDate>
        <ShipDate>06/13/2015 01:14:33</ShipDate>
        <DlvTerm>DEF</DlvTerm>
        <EquipmentCode></EquipmentCode>
        <Value>100000.00</Value>
        <DirectDelivery>false</DirectDelivery>
        <ShippingEntity>
          <Type>LINE</Type>
          <ItemId>ProductWHS</ItemId>
          <Qty>1.00</Qty>
          <Weight>1.00</Weight>
          <STCC></STCC>
          <Harmonized></Harmonized>
          <Volume>0.00</Volume>
          <Value>100000.00</Value>
          <TMSFilterCode1></TMSFilterCode1>
          <TMSFilterCode2></TMSFilterCode2>
          <TMSFilterCode3></TMSFilterCode3>
          <TMSFilterCode4></TMSFilterCode4>
          <InventTransId>ALEX-000053</InventTransId>
          <RecId>5637146097</RecId>
          <PackQty>1.00</PackQty>
        </ShippingEntity>
        <DeliveryAccessorials />
        <RatingEntities>
          <RatingEntity>
            <CarrierCode>Contoso</CarrierCode>
            <CarrierServiceCode>STD</CarrierServiceCode>
            <MethodCode>Ground</MethodCode>
            <ModeCode>Ground</ModeCode>
            <TotalRate>5000</TotalRate>
            <Rate>
              <RateType>0</RateType>
              <TotalRate>5000</TotalRate>
              <Units>500</Units>
              <UnitRate>10</UnitRate>
              <Code>P2PMileageBase</Code>
              <BillingGroupID></BillingGroupID>
              <ExternalCode></ExternalCode>
              <CurrencyCode>USD</CurrencyCode>
              <ObjectID></ObjectID>
              <CustomerRate>5000</CustomerRate>
              <ShipperRate>5000</ShipperRate>
            </Rate>
            <CurrencyCode>USD</CurrencyCode>
            <TransitTime>
              <TransitTimeEngineCode>PointToPoint</TransitTimeEngineCode>
              <TransitDays>7</TransitDays>
            </TransitTime>
          </RatingEntity>
        </RatingEntities>
      </ShippingEntity>
    </ShippingEntity>
  </Request>
</Transaction>
 
Then when the system runs apportionment in \Classes\TMSProcessXML_Base\runApportionment method here's how apportionment related messages look like
Request
<Transaction><Type>APPORTIONMENT</Type><DataArea>alex</DataArea><DlvTerm>DEF</DlvTerm><CarrierCode>Contoso</CarrierCode><CarrierServiceCode>STD</CarrierServiceCode><CarrierGroupCode></CarrierGroupCode><InventSiteId>1</InventSiteId><InventLocationId>11</InventLocationId><ThirdPartyAccount></ThirdPartyAccount><ModeCode></ModeCode><BaseCurrency></BaseCurrency><DefaultDimension><BusinessUnit></BusinessUnit><CostCenter></CostCenter><Department></Department><ItemGroup></ItemGroup><Project></Project></DefaultDimension><ModuleType>Cust</ModuleType><Accounts><CustomerCode>Client</CustomerCode><CustomerGroup>10</CustomerGroup><CustomerInvoiceCode>Client</CustomerInvoiceCode><VendorCode></VendorCode><VendorGroup></VendorGroup><VendorInvoiceCode></VendorInvoiceCode></Accounts><Request><ShippingEntity><Type>ROUTE</Type><ShippingEntity><Type>SHIPMENT</Type><RouteGuideName></RouteGuideName><RoutePlanName></RoutePlanName><RouteConfigurationCode></RouteConfigurationCode><Sequence>1</Sequence><RECORDTYPE>Load</RECORDTYPE><LoadId>ALEX-000011</LoadId><ShipmentId>ALEX-000003</ShipmentId><Direction>Outbound</Direction><OrderNumber>ALEX-000013</OrderNumber><OrderCurrency>USD</OrderCurrency><LoadTemplate></LoadTemplate><TransportationTemplate></TransportationTemplate><Customer><Name>Client</Name><Address>One Microsoft Way</Address><City>Alpharetta</City><State>GA</State><PostalCode>30009</PostalCode><CountryRegion>USA</CountryRegion><County>FULTON</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential></Customer><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode><PickUp><Name>11 - Warehouse 11</Name><Address>One Microsoft Way</Address><City>Redmond</City><State>WA</State><PostalCode>98052</PostalCode><CountryRegion>USA</CountryRegion><County>KING</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode></PickUp><DropOff><Name>Microsoft</Name><Address>One Microsoft Way</Address><City>Alpharetta</City><State>GA</State><PostalCode>30009</PostalCode><CountryRegion>USA</CountryRegion><County>FULTON</County><CountryRegionISOCode>US</CountryRegionISOCode><PhoneNumber></PhoneNumber><Residential>No</Residential><ResponsibleForPayment>Company</ResponsibleForPayment><VendorCode></VendorCode><VendorInvoiceCode></VendorInvoiceCode><Mileage><MileageEngineCode>P2P</MileageEngineCode><Miles>500</Miles></Mileage><ZoneMasters /></DropOff><Weight>1.00</Weight><Volume>0.00</Volume><STCC></STCC><DeliveryDate>06/20/2015 06:59:59</DeliveryDate><ShipDate>06/13/2015 01:14:33</ShipDate><DlvTerm>DEF</DlvTerm><EquipmentCode></EquipmentCode><Value>100000.00</Value><DirectDelivery>false</DirectDelivery><ShippingEntity><Type>LINE</Type><ItemId>ProductWHS</ItemId><Qty>1.00</Qty><Weight>1.00</Weight><STCC></STCC><Harmonized></Harmonized><Volume>0.00</Volume><Value>100000.00</Value><TMSFilterCode1></TMSFilterCode1><TMSFilterCode2></TMSFilterCode2><TMSFilterCode3></TMSFilterCode3><TMSFilterCode4></TMSFilterCode4><InventTransId>ALEX-000053</InventTransId><RecId>5637146097</RecId><PackQty>1.00</PackQty></ShippingEntity><DeliveryAccessorials /><RatingEntities><RatingEntity><CarrierCode>Contoso</CarrierCode><CarrierServiceCode>STD</CarrierServiceCode><MethodCode>Ground</MethodCode><ModeCode>Ground</ModeCode><TotalRate>5000</TotalRate><Rate><RateType>0</RateType><TotalRate>5000</TotalRate><Units>500</Units><UnitRate>10</UnitRate><Code>P2PMileageBase</Code><BillingGroupID></BillingGroupID><ExternalCode></ExternalCode><CurrencyCode>USD</CurrencyCode><ObjectID>5637144598</ObjectID><CustomerRate>5000</CustomerRate><ShipperRate>5000</ShipperRate></Rate><CurrencyCode>USD</CurrencyCode><TransitTime><TransitTimeEngineCode>PointToPoint</TransitTimeEngineCode><TransitDays>7</TransitDays></TransitTime></RatingEntity></RatingEntities></ShippingEntity></ShippingEntity></Request></Transaction>
 
Response
<Transaction>
  <Type>APPORTIONMENT</Type>
  <DataArea>alex</DataArea>
  <DlvTerm>DEF</DlvTerm>
  <CarrierCode>Contoso</CarrierCode>
  <CarrierServiceCode>STD</CarrierServiceCode>
  <CarrierGroupCode></CarrierGroupCode>
  <InventSiteId>1</InventSiteId>
  <InventLocationId>11</InventLocationId>
  <ThirdPartyAccount></ThirdPartyAccount>
  <ModeCode></ModeCode>
  <BaseCurrency></BaseCurrency>
  <DefaultDimension>
    <BusinessUnit></BusinessUnit>
    <CostCenter></CostCenter>
    <Department></Department>
    <ItemGroup></ItemGroup>
    <Project></Project>
  </DefaultDimension>
  <ModuleType>Cust</ModuleType>
  <Accounts>
    <CustomerCode>Client</CustomerCode>
    <CustomerGroup>10</CustomerGroup>
    <CustomerInvoiceCode>Client</CustomerInvoiceCode>
    <VendorCode></VendorCode>
    <VendorGroup></VendorGroup>
    <VendorInvoiceCode></VendorInvoiceCode>
  </Accounts>
  <Request>
    <ShippingEntity>
      <Type>ROUTE</Type>
      <ShippingEntity>
        <Type>SHIPMENT</Type>
        <RouteGuideName></RouteGuideName>
        <RoutePlanName></RoutePlanName>
        <RouteConfigurationCode></RouteConfigurationCode>
        <Sequence>1</Sequence>
        <RECORDTYPE>Load</RECORDTYPE>
        <LoadId>ALEX-000011</LoadId>
        <ShipmentId>ALEX-000003</ShipmentId>
        <Direction>Outbound</Direction>
        <OrderNumber>ALEX-000013</OrderNumber>
        <OrderCurrency>USD</OrderCurrency>
        <LoadTemplate></LoadTemplate>
        <TransportationTemplate></TransportationTemplate>
        <Customer>
          <Name>Client</Name>
          <Address>One Microsoft Way</Address>
          <City>Alpharetta</City>
          <State>GA</State>
          <PostalCode>30009</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>FULTON</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
        </Customer>
        <ResponsibleForPayment>Company</ResponsibleForPayment>
        <VendorCode></VendorCode>
        <VendorInvoiceCode></VendorInvoiceCode>
        <PickUp>
          <Name>11 - Warehouse 11</Name>
          <Address>One Microsoft Way</Address>
          <City>Redmond</City>
          <State>WA</State>
          <PostalCode>98052</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>KING</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
          <ResponsibleForPayment>Company</ResponsibleForPayment>
          <VendorCode></VendorCode>
          <VendorInvoiceCode></VendorInvoiceCode>
        </PickUp>
        <DropOff>
          <Name>Microsoft</Name>
          <Address>One Microsoft Way</Address>
          <City>Alpharetta</City>
          <State>GA</State>
          <PostalCode>30009</PostalCode>
          <CountryRegion>USA</CountryRegion>
          <County>FULTON</County>
          <CountryRegionISOCode>US</CountryRegionISOCode>
          <PhoneNumber></PhoneNumber>
          <Residential>No</Residential>
          <ResponsibleForPayment>Company</ResponsibleForPayment>
          <VendorCode></VendorCode>
          <VendorInvoiceCode></VendorInvoiceCode>
          <Mileage>
            <MileageEngineCode>P2P</MileageEngineCode>
            <Miles>500</Miles>
          </Mileage>
          <ZoneMasters />
        </DropOff>
        <Weight>1.00</Weight>
        <Volume>0.00</Volume>
        <STCC></STCC>
        <DeliveryDate>06/20/2015 06:59:59</DeliveryDate>
        <ShipDate>06/13/2015 01:14:33</ShipDate>
        <DlvTerm>DEF</DlvTerm>
        <EquipmentCode></EquipmentCode>
        <Value>100000.00</Value>
        <DirectDelivery>false</DirectDelivery>
        <ShippingEntity>
          <Type>LINE</Type>
          <ItemId>ProductWHS</ItemId>
          <Qty>1.00</Qty>
          <Weight>1.00</Weight>
          <STCC></STCC>
          <Harmonized></Harmonized>
          <Volume>0.00</Volume>
          <Value>100000.00</Value>
          <TMSFilterCode1></TMSFilterCode1>
          <TMSFilterCode2></TMSFilterCode2>
          <TMSFilterCode3></TMSFilterCode3>
          <TMSFilterCode4></TMSFilterCode4>
          <InventTransId>ALEX-000053</InventTransId>
          <RecId>5637146097</RecId>
          <PackQty>1.00</PackQty>
          <Apportionment>
            <Rate>
              <TotalRate>5000</TotalRate>
              <CurrencyCode>USD</CurrencyCode>
              <RateType>0</RateType>
              <ChargeCode>DEF</ChargeCode>
              <ModuleType>Cust</ModuleType>
              <ChargeType>None</ChargeType>
              <Code>P2PMileageBase</Code>
              <ObjectID>5637144598</ObjectID>
            </Rate>
          </Apportionment>
        </ShippingEntity>
        <DeliveryAccessorials />
        <RatingEntities>
          <RatingEntity>
            <CarrierCode>Contoso</CarrierCode>
            <CarrierServiceCode>STD</CarrierServiceCode>
            <MethodCode>Ground</MethodCode>
            <ModeCode>Ground</ModeCode>
            <TotalRate>5000</TotalRate>
            <Rate>
              <RateType>0</RateType>
              <TotalRate>5000</TotalRate>
              <Units>500</Units>
              <UnitRate>10</UnitRate>
              <Code>P2PMileageBase</Code>
              <BillingGroupID></BillingGroupID>
              <ExternalCode></ExternalCode>
              <CurrencyCode>USD</CurrencyCode>
              <ObjectID>5637144598</ObjectID>
              <CustomerRate>5000</CustomerRate>
              <ShipperRate>5000</ShipperRate>
            </Rate>
            <CurrencyCode>USD</CurrencyCode>
            <TransitTime>
              <TransitTimeEngineCode>PointToPoint</TransitTimeEngineCode>
              <TransitDays>7</TransitDays>
            </TransitTime>
          </RatingEntity>
        </RatingEntities>
      </ShippingEntity>
    </ShippingEntity>
  </Request>
</Transaction>
 
Our goal is that in \Classes\TMSProcessXML_Base\readAppSalesLine method the system should be able to successfully retrieve appNode element which ideally would look like this
<Apportionment><Rate><TotalRate>5000</TotalRate><CurrencyCode>USD</CurrencyCode><RateType>0</RateType><ChargeCode>DEF</ChargeCode><ModuleType>Cust</ModuleType><ChargeType>None</ChargeType><Code>P2PMileageBase</Code><ObjectID>5637144598</ObjectID></Rate></Apportionment>
 
Subsequently miscellaneous charges for sales order will be calculated in \Classes\TMSRateRoute\calcMiscChargesSOLoad method based on results of apportionment
TMSApportionedValue
Then miscellaneous charge(s) will be available on sales order line level as shown below
Charges transactions
And this is how TMS transactions log looks like. You may review it to better understand what takes place when certain function will be executed, it is also handy for troubleshooting purposes
TMSTransaction
The last thing I want to mention is Freight bill details generated as shown below
Freight bill details
Freight bill details - Rate
After you have Freight bill details you an then compare it with the actual invoice for mathing purposes
This concludes the end-to-end scenario in this walkthrough
 
Addendum (98401 -> 92114)
Having all this knowledge it is quite easy to enable new pair of zip codes for Rate Shopping, say in standard USMF Demo company in Microsoft Dynamics AX 2012 R3 Demo VM
Here's the list of 4 things you have to do in USMF Company to set up transportation from WA (98401) to CA (92114) using data elements from standard demo data
Remembering TMS Setup process diagram below here is what you will need to set up
#1 Rate master (No changes here)
 
#2 Rate base
Note: Rate = 10$
#3 Mileage engine
Note: 100 Miles
#4 Transit time master
Note: 5 days
As the result you can review Rate shopping details on Rate route workbench
Result
 
Summary: In this walkthrough I illustrated how to setup and execute on WMS/TMS scenario in Microsoft Dynamics AX 2012 R3. In particular I focused on end-to-end logical flow from setup through execution to transportation charges applied to order, and highlighted appropriate technical details to support troubleshooting as necessary. With this knowledge you can set up your own WMS/TMS scenarios with ease and also successfully troubleshoot any potential missing setups to get you to desired results.
 
Tags: Microsoft Dynamics AX 2012 R3, WMS, TMS, Advanced Warehouse Management, Transportation Management, Miscellaneous charges.
 
Note: This document is intended for information purposes only, presented as it is with no warranties from the author. This document may be updated with more content to better outline the issues and describe the solutions.
 
Author: Alex Anikiev, PhD, MCP