How to Configure Hierarchical Loops for X12 EDI 856 and 857 Profiles

Document created by bruce_hamblin288981 Employee on Aug 2, 2016Last modified by Adam Arrowsmith on Feb 28, 2017
Version 8Show Document
  • View in full screen mode

This article outlines how to build the hierarchical structure and setup necessary for the EDI X12 856 and 857 Advance Ship Notice (ASN) transactions.



Why are the HL segments and the hierarchical structure important in an 856 or 857 ASN?

The 856 and 857 ASN documents are used to send the recipient information describing the actual physical shipment, as well as information allowing the recipient to identify and match the shipment to the ASN.


Therefore, the 856 and 857 ASN must describe the physical shipment’s structure. This structure is usually along the lines of Shipment / Order / Pack / Item, with each of these represented in a Hierarchical Level, usually abbreviated “HL level” in EDI documentation and guideline. The HL levels are designated S-Shipment, O-Order, P-Pack, I-Item. Each of these HL levels is contained within a looping structure, and the loops are nested, to represent the physical shipment structure.


One of the most common structures used in ASN’s is the S/O/P/I structure. Using the S/O/P/I structure as an example, the highest outermost loop is the Shipment (HL-S) loop. Within the HL-S loop, you will have one or more Order (HL-O) loops. Within the HL-O one or more Pack (HL-P) loops. And within the HL-P loop you will have 1 or more Item (HL-I) loops.


Below is a sample of a completely configured S / O / P / I structure in the AtomSphere EDI Profile. Notice the nesting of the HL loops as well as the looping option of “Unique”.



How to configure the 856 / 857 ASN profile


Before you begin...

To begin setting up the structure, you need to create an EDI profile by importing the appropriate X12 version and transmission document (either 856 or 857). To do this you will need to know the X12 version to be used (e.g. v4010, v5010), the transmission document (856 or 857), and the specific segments to be used within the ASN.


This information will need to come from either the Boomi client or from the client’s Trading Partner. The information can be found in the EDI Implementation Guideline/specification or a sample EDI file (if this is not a new implementation).


For our example, we will use this sample 856. The data has been indented to show the logical HL nesting.




















In this case, the Shipment HL Loop requires the:







The Order HL Loop requires the:



The Pack HL Loop requires the:





The Item HL Loop requires the:




Let's start building the profile.


1. Import the header, first HL loop, and summary segments

  1. Create a new EDI Profile component.
  2. On the Options tab, be sure to choose Standard=X12. Configure the File Options section for delimiter information as per your specification. Do not configure the X12 Version Information section because this will be populated automatically during the import.
  3. Click Import in the upper right.
  4. Choose the Version and select either the 856 or 857 document.
  5. Select the segments for the ASN as required by your EDI specification. For the HL loop, select only the segments applicable to the your HL-S loop:
  6. When the EDI segments are initially imported into the profile, the profile will have a single HL loop within the Detail section:


2. Rename the previous HL loop and import the next HL loop

  1. Change the Name and Loop ID for the first HL loop to "HL-S". Note: The Name is for readability but the Loop ID must be changed to enable the import to create a new HL loop instead of overwriting the existing one. Your first HL loop should now look like this:
  2. Click Import again and select ONLY the HL loop and segments required by your HL-O loop (do not select any Header or Summary segments). After importing the profile will have a second HL loop as a "sibling" to the first loop (we will rearrange it later):
  3. Change the Name and Loop ID of the new HL loop to "HL-O", similar to above.
  4. Repeat these steps for the HL-P and HL-I loops, renaming the previous loop before importing the next one. When finished your profile should look like this:


3. Configure the HL segment: Additional Criteria

Next each HL loop's HL segment needs to be configured to properly identify the individual segment instance. Notice that the Segment ID is left as “HL”. This is critical, as the Segment ID in the profile is carried through and is included in the X12 transaction that is created. The values in the Segment ID MUST adhere to the ANSI X12 Standards.


  1. Select the HL-S loop's HL segment.
  2. Under the Additional Criteria section, enable "Use Additional Criteria to Define Segment?", select Data Element "HL03", and enter Element Value "S":
  3. Repeat these steps for each HL loop's HL segment. Note the Data Element will always be "HL03" but the Element Value will be "O", "P", or "I",  respectively.


4. Configure the HL elements hierarchical levels

Next, you need to configure how the profile manages the linkages between the various HL loops. This is critical, because it identifies and manages the parent / child relationships that the hierarchical structure represents. Fortunately the AtomSphere EDI mapping engine automatically determines these values for you. You only need to configure a pair of HL elements to generate them.


There are two fields, or elements, in the EDI HL segment used to manage the parent / child structure. They are the HL01 and HL02:

  • The HL01 contains an incremental value that uniquely identifies a given HL segment occurrence within the document, starting with 1.
  • The HL02 contains the value from its parent's HL01 element.


For example, take the following ASN snippet:














Look at the Pack-level HL segment, “HL*3*2*P”. This means it is the 3rd HL segment in the document and its parent is the 2nd HL occurrence. Similarly, look at the two Item-level HL segments under that Pack, “HL*4*3*I” and “HL*5*3*I”. The first Item HL is the 4th HL occurrence and the second is the 5th HL occurrence but both are children to the same Pack HL occurrence (3).


  1. Within the HL-S loop's HL segment, select the HL01 element.
  2. Under the Advanced section, choose Auto-Generate Option “Hierarchical Level 1”. This instructs the mapping engine to populate the HL occurrence incremental value:
  3. Select the HL02 element.
  4. Under the Advanced section, choose Auto-Generate Options "Hierarchical Level 2”. This instructs the mapping engine to populate the parent’s HL01 value.
  5. Repeat these steps for each HL loop's HL segment.


4. Rearrange the HL loops

The final step is to rearrange the HL loops to properly nest them.


  1. Starting with the HL-I loop (i.e. the lowest-level child loop), drag and drop the entire HL-I loop on top of the HL-P loop (you will see a plus icon) like this:
  2. The HL-I loop is now inside the HL-P loop:
  3. Repeat these steps to move the HL-P loop into HL-O, and the HL-O loop into HL-S. When finished the profile should look like this:



At last, your 856 profile is now ready to use in a map!

9 people found this helpful