Skip to main content

One of the trickiest types of documents to map against in the EDI 856, which makes frequent use of a segment loop called HL (Hierarchical Loop). 


HLLoops represent multiple elements that are part of a hierarchical structure at once. From the EDI standpoint, each HLLoop is treated like a sibling element, but the HLLoop is a representation of an element in a hierachy so two neighboring HLLoops can mean different things based on the values of HL01, HL02, and HL03:

HL01 is the index of the loop from the top of the document
HL02 is the index of the immediate parent to this loop
HL03 is the type of the loop

Let's look at a simplified 856:

 

HL*1**S~   <-- the root shipment
HL*2*1*O~  <-- the first order, child of the shipment
HL*3*2*I~  <-- the first item, child of the first order (index 2)
HL*4*2*I~  <-- the second item, child of the first order (index 2)
HL*5*1*O~  <-- the second order, child of the shipment
HL*6*5*I~ <-- the first item of the second order (index 5)
HL*7*5*I~ <-- the second item of the second order (index 5)


There is a feature in CData Arc that makes the transformation of EDI to XML a better representation of this hierarchy. Without nest master detail loops set, the XML output has all HLLoops at the same level, as siblings:
 

<HLLoop1 />
<HLLoop1 />
<HLLoop1 />
<HLLoop1 />
<HLLoop1 />
<HLLoop1 />
<HLLoop1 />



But if Nest Master Detail Loops is set to true in the Advanced tab of the EDI connector:

 

the X12 connector is able to output the HLLoops in a hierarchy, so you can loop over them as their type:
 

<HLLoop1>  <-- each of these HLLoop1's at the root is a shipment -->
  <HLLoop1> <-- each of these HLLoop1/HLLoop1's is an order -->
    <HLLoop1> <-- each of these is HLLoop1/HLLoop1/HLLoop1's is an item -->
    </HLLoop1>
    <HLLoop1>
    </HLLoop1>
  </HLLoop1>
  <HLLoop1>
    <HLLoop1>
    </HLLoop1>
    <HLLoop1>
    </HLLoop1>
  </HLLoop1>
</HLLoop1>



You can also map out to this hierarchical structure when you are creating an outbound mapping. The best way to do this is to start with a document structure that matches the hierarchy of the data you are mapping to the 856 (for example, data extracted from linked shipments, orders, packages, and items tables), and map each parent loop to its corresponding child HLLoop in the destination. 

 


 

Hi James,

 

I have a typical scenario where HL_T loop should be created just once for each new value in the loop.

My input files has Tare level SSCC and Pack level SSCC at the same level but HL_T should occur once for each label code. Is this a custom script or any standards setting available?

input:

    E1EDL24

           +E1EDL11

               PACK_SCC - 084111111

               PACK QTY  - 1

               +ZE1EDL11- 

                 PALLET_SSCC - T000001

           +E1EDL11

                 PACK_SCC - 084111112

                 PACK QTY  - 1

               +ZE1EDL11- 

                  PALLET_SSCC - T000001

           +E1EDL11

               PACK_SCC - 084111113

               PACK QTY  - 1

               +ZE1EDL11- 

                  PALLET_SSCC - T000001

           +E1EDL11

               PACK_SCC - 084111114

               PACK QTY  - 1

               +ZE1EDL11- 

                  PALLET_SSCC - T000002

           +E1EDL11

                 PACK_SCC - 084111115

                 PACK QTY  - 1

               +ZE1EDL11- 

                   PALLET_SSCC - T000002

          + E1EDL11

                 PACK_SCC - 084111116

                 PACK QTY  - 1

               +ZE1EDL11- 

                   PALLET_SSCC - T000002

Output should be 

HL*T

   MAN*GM*T000001

HL*P

  MAN*GM*084111111

  MAN*GM*084111112

  MAN*GM*084111113

HL*T

   MAN*GM*T000002

HL*P

  MAN*GM*084111114

  MAN*GM*084111115

  MAN*GM*084111116

 

Thank you1              


Reply