Container label layouts and printing

Container labels provide information about a container and the related shipment data. A typical scenario that might involve this type of label is one where a worker is creating and packing containers by using the Warehouse Management mobile app. The worker can print a container label that includes a bar code of the container ID and apply it to the physical container.

As for license plate labels, the Zebra Programming Language (ZPL) is used to create label layouts for container labels.

Learn more in Packing containers with the Warehouse Management mobile app.

Example scenario: Print container labels when containers are created by using the Warehouse Management mobile app

This example scenario shows how you can set up your system to print container labels when a worker creates a container by using the web client and/or the Warehouse Management mobile app. The Warehouse Management mobile app scenario builds on the information that is provided in Packing containers with the Warehouse Management mobile app. That article provides more details about the full process of packing containers by using the Warehouse Management mobile app.

Make sample data available

To work through this scenario by using the sample records and values that are specified here, you must be on a system where the standard demo data is installed. Additionally, you must select the USMF legal entity before you begin.

You can also use this scenario as guidance for using the feature on a production system. However, in that case, you must substitute your own values for each setting that is described here.

Create a container label layout

The label layout controls what information is printed on the label and how it's laid out. Here, you enter the ZPL code that is sent to the printer. Typically, you'll copy this code from a label designer program.

As the system generates a label, it can replace field and method names that are used in the label layout with actual values. You can easily find text that will be replaced by looking for dollar signs ($) in the code.

Create a basic label layout

Follow these steps to create a container label layout.

  1. Go to Warehouse management > Setup > Document routing > Label layout.

  2. At the top of the list pane, set the Label layout type field to Container label.

  3. On the Action Pane, select New to create a label.

  4. Set the following values for the new label:

    • Label layout ID – Enter Container.

    • Description – Enter Container ID barcode.

    • Definition type – Select the method that's used to define the label layout:

      • ZPL – Define the label layout by using ZPL.

      • Variables – Define a label layout that can be used with an external service. (Learn more in Print labels using an external service.) If you select this option, the Printer text layout FastTab provides grids where you define system variables and data variables. Under System variables, set the LabelFile field to the path of the label design in the external system, and set the Quantity field to the number of labels to print. Under Data variables, define the values that are sent from Supply Chain Management by mapping them to the corresponding placeholders in the label design from the external system.

      • Variables (script) – Use the script format to define a label layout that can be used with an external service. (Learn more in Print labels using an external service.) On the Printer text layout FastTab, define the label file, the quantity, and the values to send. Here's an example.

        "filePath": "/Instant Print/GS1-128.nlbl", 
        "quantity": "1",
        "dataSources": [
        {
            "GTIN of Contained Trade Items": "06183928726611",
            "Product_name": "D365FO: $ItemName$"
        }
        ]
        
    • Label layout data source ID – Leave this field blank if you'll use only container data. If you must include data from other tables, select a label layout data source that has the required joins. For more information about how to set up and use a label layout data source, see the next section in this article.

    • Enable label template support – Leave this option set to No for now. (When it's set to Yes, you can add header, row, and footer elements to your layout, as described later in this article.)

    • Date, time, and number format – Select the language to use when date, time, and number values that are shown in a label layout are formatted.

    • Printer stock type – Select a printer stock type. A printer stock type typically describes the type of paper that a specific printer uses. It's also used to specify the type of paper that a specific label layout should be printed to. For information about how to set up printer stock types, see Set up printer stock types.

  5. On the Printer text Layout FastTab, enter label code in a way that's appropriate for the selected definition type. The following example shows code that you can copy and paste for testing if the Definition type field is set to ZPL.

    CT~~CD,~CC^~CT~
    ^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR8,8~SD15^JUS^LRN^CI0^XZ
    ^XA
    ^MMT
    ^PW812
    ^LL0609
    ^LS0
    ^BY3,3,262^FT658,186^BAI,,Y,N
    ^FD$WHSContainerTable.ContainerId$^FS
    ^FT660,457^A0I,39,38^FH\^FDContainer ID^FS
    ^FT660,515^A0I,39,38^FH\^FDShipment: $WHSContainerTable.ShipmentId$^FS
    ^PQ1,0,1,Y^XZ
    

    Note

    While you're customizing the label code on the Printer text layout FastTab, you can add valid field and method names by following these steps:

    1. In the Tables list, select the table.
    2. Depending on the type of item that you want to add, select either the Fields tab or the Methods tab, and then select the name of the field or method to add.
    3. If the Definition type field is set to ZPL or Variables (script), select Insert at end of text to add the field or method to the end of the code. As you require, move the new field or method to the place in the code where you want to use it.
    4. If the Definition type field is set to Variables, select a row in the Data variables table, and then select Insert field reference to add the field or method as a field value.
  6. On the Action Pane, select Save.

Set up and use a label layout data source

In the label layout in the preceding example, only the container ID ($WHSContainerTable.ContainerId$) is used, and this value is available directly in the container table. If you want to include related information (such as the delivery name that's related to a shipment), and the required layout label data source doesn't already exist, follow these steps to create it and then select it in your label layout.

  1. Go to Warehouse management > Setup > Document routing > Label layout data source.

  2. On the Action Pane, select New.

  3. Set the following values for the new label layout data source:

    • Label layout data source ID – Enter a name for the data source.
    • Description – Enter a short description of the data source.
    • Label layout type – Select Container label.
  4. On the Action Pane, select Save.

  5. On the Action Pane, select Edit query.

  6. A standard query editor dialog box appears. On the Joins tab, add joins to the required tables. (For example, you might make a join to the shipment table if you want your label to show the delivery name that's related to a shipment.)

  7. Go to Warehouse management > Setup > Document routing > Label layout.

  8. Create or select a label layout, and then, in the Label layout data source ID field, select the record that you just created.

  9. You can now add the new field values to the print layout code. Be sure to reference the correct table.field-names values in the ZPL code. The additional tables will include a number as a suffix (_#).

Caution

On the Label layout data source page, be careful about removing a table from the query for an existing record. You might remove field and/or method names that are already used in existing label layouts.

Enable label template support

Label templates let you design labels that have more advanced layouts, which can include header, row, and footer elements. Follow these steps to format a label that includes label template elements.

  1. Go to Warehouse management > Setup > Document routing > Label layout.

  2. At the top of the list pane, set the Label layout type field to Container Label.

  3. Follow one of these steps:

    • To create a new layout, select New on the Action Pane.
    • To edit an existing layout, select the layout in the list pane, and then select Edit on the Action Pane.
  4. In the Label layout data source ID field, select a data source. (A data source is required to enable label template support. However, if you need only container table data, you can select a very simple data source where no joins are defined.)

  5. Set the Enable label template support option to Yes.

  6. Use the {{Header ... }}, {{Row ... }}, and {{Footer ... }} elements in your code. The following example shows a label that includes all these elements. Because it prints data about items that are packed in a container, you'll have to use a Label layout data source ID value that uses a query that joins to the container lines (container details). The data can be split among multiple pages to ensure that all data will be printed if you have many container lines. In this example, a container ID bar code and six container lines will be printed on the first page. Ten lines will be printed per page. Each line will contain information about the item, quantity, and unit. This setup is controlled by the RowsPerLabelFirst=6 and RowsPerLabel=10 attributes.

    {{LabelStart
    ^FX ... ZPL commands to start the label ...
    
    ^XA
    ~TA000
    ~JSN
    ^LT0
    ^MNW
    ^MTT
    ^PON
    ^PMN
    ^LH0,0
    ^JMA
    ^PR6,6
    ~SD15
    ^JUS
    ^LRN
    ^CI27
    ^PA0,1,1,0
    ^XZ
    ^XA
    ^MMT
    ^PW800
    ^LL900
    ^LS0
    }}
    
    {{HeaderFirst
    ^FX ... Header on the first label only ...
    
    ^BY3,3,220
    ^FO150,120^BC
    ^FD$WHSContainerTable.ContainerId$^FS
    ^FT80,420^A0N,33,33^FH\^CI28^FDItem^FS^CI27
    ^FT579,420^A0N,33,33^FH\^CI28^FDQuantity^FS^CI27
    ^FT720,420^A0N,33,33^FH\^CI28^FDUnit^FS^CI27
    ^FT80,100^A0N,58,58^FH\^CI28
    ^FDShipment: $WHSContainerTable.ShipmentId$^FS^CI27
    }}
    
    {{Header
    ^FX ... Header on every label after the first ...
    
    ^FT80,100^A0N,58,58^FH\^CI28
    ^FDShipment: $WHSContainerTable.ShipmentId$^FS^CI27
    ^FT80,150^A0N,40,40^FH\^CI28
    ^FDContainer: $WHSContainerTable.ContainerId$^FS^CI27
    ^FT80,220^A0N,33,33^FH\^CI28^FDItem^FS^CI27
    ^FT579,220^A0N,33,33^FH\^CI28^FDQuantity^FS^CI27
    ^FT720,220^A0N,33,33^FH\^CI28^FDUnit^FS^CI27
    }}
    
    {{Row Table=WHSContainerLine_1 RowsPerLabelFirst=6 RowsPerLabel=10 StartYFirst=500 StartY=300 IncY=50
    ^FX... ZPL commands to format the row using *$position.YPos$* to position the location of the text fields ...
    
    ^FT80,$position.YPos$^A0N,30,30^TBN,480,30^FH\^CI28^FD$WHSContainerLine_1.ItemId$^FS^CI27
    ^FT579,$position.YPos$^A0N,30,30^TBN,120,30^FH\^CI28^FD$WHSContainerLine_1.Qty$^FS^CI27
    ^FT720,$position.YPos$^A0N,30,30^TBN,100,30^FH\^CI28^FD$WHSContainerLine_1.UnitId$^FS^CI27
    }}
    
    {{FooterFirst
    ^FX ... Footer on the first label only ...
    
    ^FT550,800^A0N,58,58^FH\^CI28^FDLabel: $position.labelNumber$/$position.labelCount$^FS^CI27
    ^PQ1,0,1,Y
    }}
    
    {{Footer
    ^FX ... Footer on every label after the first...
    
    ^FT550,800^A0N,58,58^FH\^CI28^FDLabel: $position.labelNumber$/$position.labelCount$^FS^CI27
    ^PQ1,0,1,Y
    }}
    
    {{LabelEnd
    ^FX ... ZPL commands to end the label ...
    
    ^XZ
    }}
    

    Note

    Because of the RowsPerLabel=10 attribute, this setup will loop over container lines and split out a label for each set of 10 container lines. If you change the attribute to RowsPerLabel=1, a label will be generated for each line.

    This setup will print one copy of each label. If you require more copies (for example, one copy for each side of the container), set the n value for the \^PQn section in the footer to the required number of copies. For example, to print two copies of each label, specify \^PQ2.

Set up container label routing

To specify the container label layouts that are used and where they're printed, you must define a Container label routing record, as described in the following procedure.

  1. Go to Warehouse management > Setup > Document routing > Container label routing.

  2. On the Action Pane, select New to create a routing record.

  3. On the header of the new routing record, set the following fields:

    • Sequence number – Enter an integer to define the order that the routing record should be evaluated in. Each routing must have a unique sequence number. The system evaluates routings in order of ascending sequence numbers and uses the first routing that criteria are met for. If you're using demo data, enter 1.
    • Name – Enter a name for the routing record. For example, enter Container packing.
  4. On the Overview FastTab, use the following fields to define the criteria that are used to select the label routing:

    • Warehouse – Specify the warehouse where the routing should be used. If you're using demo data, enter 62.
    • Location – Specify the location where the routing should be used. If you're using demo data, select Pack, based on the assumption that the target printer is physically placed at the packing location.
    • Worker – Specify the worker that the routing should be used for. To use the routing for any worker, leave this blank.
    • Mobile device user ID – Specify the user ID that the routing should be used for. To use the routing for any worker, leave this blank.
    • Container type – Specify the container type that the routing should be used for.
    • Container status - Specify the container status (Open or Closed) that the routing should be used for.
    • Account number – Specify the customer account that the routing should be used for. To use the routing for any customer, leave this blank.
    • Carrier – Specify the shipping carrier that the routing should be used for. To use the routing for any carrier, leave this blank.
    • Run query – To add custom selection criteria to a routing record, set this option to Yes, and then select Edit query on the Action Pane. A standard query editor dialog box appears, where you can add more selection criteria.

    Note

    When you print a container label from the Warehouse Management mobile app, the current user's warehouse, location, worker ID, and user ID are passed as possible filter values for selecting the printer and layout. Other values will be found based on the selected shipment.

    Note

    When a worker prints a container label from the Close container dialog, their worker ID, packing station warehouse, and location are passed as possible filter values for selecting the printer and layout. Other values are found based on the selected shipment.

  5. On the Container label routing printer FastTab, assign the printer and label layout that should be used when the criteria for the routing record are met. Select New on the toolbar to add a line to the grid. Then set the following fields for the new line:

    • Name – Select an appropriate ZPL printer. Learn more in Install the Document Routing Agent to enable network printing. Leave this field blank if you want to use dynamic printer selection, or select As fallback printer in the Use specified printer field.
    • Use specified printer – If you want to use dynamic printer selection and use the configured printer as a fallback when dynamic printer selection doesn't find a more specific printer, set this field to As fallback printer. If this field is set to Always and a printer is configured, then dynamic printer selection is disabled.
    • Label layout ID – Select the label layout to use. The example label layout ID value that was suggested earlier in this scenario was Container.

    Note

    To reduce the number of label routings, consider using dynamic printer selection with printers associated with packing station locations, mobile device users, or mobile devices. In those cases, label routings only specify the label layouts to be printed based on the properties of the container and you don't need to duplicate the setup when new packing stations and printers are added.

Set container labels to be printed automatically when new containers are created

If you want a container label to be printed automatically each time that a new container is created, configure each packing profile as described in the following procedure.

  1. Go to Warehouse management > Setup > Packing > Packing profiles.
  2. On the Action Pane, select Edit.
  3. Select the profile that container labels should automatically be printed for. If you're working with sample data, select the row where the Packing profile ID field is set to WHS62.
  4. Select the Print container label at container creation checkbox for the selected row.
  5. Close the page.

Note

The Container ID mode field for packing profile WH62 is set to Auto. Therefore, the number sequence that is defined for the Container ID reference will be used as part of the container creation process.

Set container labels to be printed automatically when containers are closed

If you want a container label to be printed automatically each time a container is closed, configure the container packing policy as described in the following procedure.

  1. Go to Warehouse management > Setup > Containers > Container packing policies.
  2. On the Action Pane, select Edit.
  3. Select the policy that container labels should automatically be printed for. If you're working with sample data, select the row where the Packing profile ID field is set to WHS62Close.
  4. Set Print container labels on container close to Always.
  5. Close the page.

Create a new mobile device menu item for printing container labels

To enable workers to print container labels manually, you must create a new mobile device menu item for the Warehouse Management mobile app.

  1. Go to Warehouse management > Setup > Mobile device > Mobile device menu items.

  2. On the Action Pane, select New to add a mobile device menu item.

  3. For the new menu item, set the following fields:

    • Menu item name – Enter an internal name for the new menu item. For example, enter Print container label.
    • Title – Enter the item name as it should appear in the Warehouse Management mobile app. For example, enter Print container label.
    • Mode – Select Indirect.
    • Activity code – Select Print container label.
  4. Close the page.

Add the new mobile device menu item to the menu

Now that you've created the mobile device menu item, you can add it to the mobile device menu. In this example, you'll add it to the existing Outbound mobile device menu.

  1. Go to Warehouse management > Setup > Mobile device > Mobile device menu.
  2. On the Action Pane, select Edit.
  3. In the list pane, select the Outbound menu.
  4. In the Available menus and menu items column, select the mobile device menu item that you created (for example, Print container label).
  5. Select the Add button (right arrow) to move the menu item into the Menu structure column.
  6. Close the page.

Run a scenario to print container labels

For an example that shows how to print bar codes automatically as part of a container creation process, see Packing containers with the Warehouse Management mobile app. Follow the instructions there, and confirm that the scenario that's described in this article is also supported when a packing profile is used where the Print container label at container creation checkbox is selected.

To manually print a container label, follow one of these steps.

  • In the web client, go to Warehouse management > Packing and containerization > Containers, and select Print > Container label on the Action Pane.
  • In the Warehouse Management mobile app, use the Print container label mobile device menu item.

Here are a few suggestions for ways that you can customize and fine-tune this scenario to help reduce the number of steps that workers must perform when they print container labels:

  • Set up the mobile device menu item to query data by using Warehouse Management mobile app detours. In this way, the menu item can look up a container ID instead of prompting the worker to enter it manually.
  • When a worker selects the Print container label mobile device menu item on the Outbound menu, the app automatically submits the current User ID and Warehouse values. If workers want to specify a Location value, they can do so in the app.
  • If you want the Location value to be assigned automatically when a worker selects Print container label from the Pack inventory into containers menu item, set up a detour.