This project has moved and is read-only. For the latest updates, please go here.

Parsing 856 Loop Ids

May 22, 2014 at 2:29 AM
I have been using the X12 parser v2.3.1.0 for awhile now and am very pleased with the results. One of my trading partners is requesting I add the SAC segment in receiving their 856's to reflect shipping charges. I found that v2.3.1 didn't support this segment so I upgraded to v3.0.8 and it was able to parse this segment. Problem now is that it doesn't identify the various HLoops with their true Loop Id. For example the Shipment loop. I'll paste a comparison between the two versions. Is there any way I can get the Loop Ids to appear with their titles like they did in v2.3.1? Image
May 22, 2014 at 2:47 AM
Looking at the different version releases I see that v2.3.2 was the last one that shows the real Loop Ids. And v2.3.3 was the first one that appears to parse the SAC segment okay. Although it doesn't show the real Loop Ids when I view the XML parsed output.
May 22, 2014 at 4:13 PM
I am making headway. Looking at the older XML 856 definition I was able to paste in a SAC loop and it parses fine with a test 856 document. Thing is now that I need to place this SAC loop under the Order HLoop and not the default Shipment HLoop that the ANSI X12 spec typically mandates. Still working...
<?xml version="1.0" encoding="utf-8" ?>
<TransactionSpecification xmlns="http://tempuri.org/X12ParserSpecification.xsd"  TransactionSetIdentifierCode="856">
  <Segment SegmentId="BSN" Repeat="1"/>
  <Segment SegmentId="DTM"/>
  <Segment SegmentId="CTT" Usage="Situational" Trailer="true" Repeat="1"/>
  <HierarchicalLoop LoopId="SHIPMENT" Usage="Required" LevelCode="S">
    <Name>SHIPMENT</Name>
    <Segment SegmentId="LIN"/>
    <Segment SegmentId="SN1"/>
    <Segment SegmentId="SLN"/>
    <Segment SegmentId="PRF"/>
    <Segment SegmentId="PO4"/>
    <Segment SegmentId="PID"/>
    <Segment SegmentId="MEA"/>
    <Segment SegmentId="PKW"/>
    <Segment SegmentId="PKG"/>
    <Segment SegmentId="TD1"/>
    <Segment SegmentId="TD5"/>
    <Segment SegmentId="TD3"/>
    <Segment SegmentId="TD4"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
    <Segment SegmentId="PER"/>
    <Segment SegmentId="DTM"/>
    <Segment SegmentId="FOB"/>
    <Loop LoopId="BT" Usage="Required" LoopRepeat="1">
      <Name>Bill-To-Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BT"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="IC" Usage="Required" LoopRepeat="1">
      <Name>Intermedicate Consignee</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="IC"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SU" Usage="Required" LoopRepeat="1">
      <Name>Supplier</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SU"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="ST" Usage="Required" LoopRepeat="1">
      <Name>Ship To</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="ST"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SF" Usage="Required" LoopRepeat="1">
      <Name>Ship From</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SF"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SE" Usage="Required" LoopRepeat="1">
      <Name>Selling Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SE"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>    
    <Loop LoopId="BY" Usage="Required" LoopRepeat="1">
      <Name>Buying Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BY"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SAC" Usage="Required" LoopRepeat="1">
      <Name>Service, Promotion, Allowance, or Charge</Name>
      <StartingSegment SegmentId="SAC" Usage="Required" Repeat="1"/>
      <Segment SegmentId="CUR" Repeat="1" />
    </Loop>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="ORDER" Usage="Required" LevelCode="O">
    <Name>ORDER</Name>
    <Segment SegmentId="PRF" Usage="Required" Repeat="1"/>
    <!--<Segment SegmentId="TD5" Usage="Required" Repeat="1"/> DON'T SEE THIS IN THE ANSI X12 DOCS -->
    <Segment SegmentId="PID"/>
    <!--<Segment SegmentId="TD1"/> DON'T SEE THIS IN THE ANSI X12 DOCS -->
    <Segment SegmentId="REF"/>
    <Loop LoopId="BY" Usage="Required" LoopRepeat="1">
      <Name>Buying Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BY"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>      
    </Loop>    
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="TARE" Usage="Required" LevelCode="T">
    <Name>TARE</Name>
    <Segment SegmentId="MAN" Usage="Required" Repeat="1"/>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="PACK" Usage="Required" LevelCode="P">
    <Name>PACK</Name>
    <Segment SegmentId="MAN" Usage="Required" Repeat="1"/>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="ITEM" Usage="Required" LevelCode="I">
    <Name>ITEM</Name>
    <Segment SegmentId="LIN"/>
    <Segment SegmentId="SN1"/>
    <Segment SegmentId="SLN"/>
    <Segment SegmentId="PRF"/>
    <Segment SegmentId="PO4"/>
    <Segment SegmentId="PID"/>
    <Segment SegmentId="MEA"/>
    <Segment SegmentId="PKW"/>
    <Segment SegmentId="PKG"/>
    <Segment SegmentId="TD1"/>
    <Segment SegmentId="TD5"/>
    <Segment SegmentId="TD3"/>
    <Segment SegmentId="TD4"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
    <Segment SegmentId="CUR"/>
    <Segment SegmentId="V1"/>
    <Segment SegmentId="PER"/>
    <Loop LoopId="LOAD" Usage="Required" LoopRepeat="1">
      <Name>LOAD DETAIL</Name>
      <StartingSegment SegmentId="CLD" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="DTP"/>
    </Loop>
  </HierarchicalLoop>
</TransactionSpecification>
May 23, 2014 at 9:16 PM
I had to move the SAC loop segment underneath the ORDER HLoop and out of the SHIPMENT HLoop. While this breaks ANSI X12 standards for the 856, I was able to create the SEF file and rely on it with my trading partner. And to parse through this .NET library. Below is the XML for this custom 856. Hope this helps anyone in the same boat as I was!
<?xml version="1.0" encoding="utf-8" ?>
<TransactionSpecification xmlns="http://tempuri.org/X12ParserSpecification.xsd"  TransactionSetIdentifierCode="856">
  <Segment SegmentId="BSN" Repeat="1"/>
  <Segment SegmentId="DTM"/>
  <Segment SegmentId="CTT" Usage="Situational" Trailer="true" Repeat="1"/>
  <HierarchicalLoop LoopId="SHIPMENT" Usage="Required" LevelCode="S">
    <Name>SHIPMENT</Name>
    <Segment SegmentId="LIN"/>
    <Segment SegmentId="SN1"/>
    <Segment SegmentId="SLN"/>
    <Segment SegmentId="PRF"/>
    <Segment SegmentId="PO4"/>
    <Segment SegmentId="PID"/>
    <Segment SegmentId="MEA"/>
    <Segment SegmentId="PKW"/>
    <Segment SegmentId="PKG"/>
    <Segment SegmentId="TD1"/>
    <Segment SegmentId="TD5"/>
    <Segment SegmentId="TD3"/>
    <Segment SegmentId="TD4"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
    <Segment SegmentId="PER"/>
    <Segment SegmentId="DTM"/>
    <Segment SegmentId="FOB"/>
    <Loop LoopId="BT" Usage="Required" LoopRepeat="1">
      <Name>Bill-To-Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BT"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="IC" Usage="Required" LoopRepeat="1">
      <Name>Intermedicate Consignee</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="IC"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SU" Usage="Required" LoopRepeat="1">
      <Name>Supplier</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SU"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="ST" Usage="Required" LoopRepeat="1">
      <Name>Ship To</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="ST"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SF" Usage="Required" LoopRepeat="1">
      <Name>Ship From</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SF"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SE" Usage="Required" LoopRepeat="1">
      <Name>Selling Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="SE"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>    
    <Loop LoopId="BY" Usage="Required" LoopRepeat="1">
      <Name>Buying Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BY"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>
    </Loop>
    <Loop LoopId="SAC" Usage="Required" LoopRepeat="1">
      <Name>Service, Promotion, Allowance, or Charge</Name>
      <StartingSegment SegmentId="SAC" Usage="Required" Repeat="1"/>
      <Segment SegmentId="CUR" Repeat="1" />
    </Loop>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="ORDER" Usage="Required" LevelCode="O">
    <Name>ORDER</Name>
    <Segment SegmentId="PRF" Usage="Required" Repeat="1"/>
    <!--<Segment SegmentId="TD5" Usage="Required" Repeat="1"/> DON'T SEE THIS IN THE ANSI X12 DOCS -->
    <Segment SegmentId="PID"/>
    <!--<Segment SegmentId="TD1"/> DON'T SEE THIS IN THE ANSI X12 DOCS -->
    <Segment SegmentId="REF"/>
    <Loop LoopId="BY" Usage="Required" LoopRepeat="1">
      <Name>Buying Party</Name>
      <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
        <EntityIdentifier Code="BY"/>
      </StartingSegment>
      <Segment SegmentId="N2"/>
      <Segment SegmentId="N3" Usage="Required" Repeat="2"/>
      <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="PER"/>
      <Segment SegmentId="FOB"/>      
    </Loop>    
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="TARE" Usage="Required" LevelCode="T">
    <Name>TARE</Name>
    <Segment SegmentId="MAN" Usage="Required" Repeat="1"/>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="PACK" Usage="Required" LevelCode="P">
    <Name>PACK</Name>
    <Segment SegmentId="MAN" Usage="Required" Repeat="1"/>
  </HierarchicalLoop>
  <HierarchicalLoop LoopId="ITEM" Usage="Required" LevelCode="I">
    <Name>ITEM</Name>
    <Segment SegmentId="LIN"/>
    <Segment SegmentId="SN1"/>
    <Segment SegmentId="SLN"/>
    <Segment SegmentId="PRF"/>
    <Segment SegmentId="PO4"/>
    <Segment SegmentId="PID"/>
    <Segment SegmentId="MEA"/>
    <Segment SegmentId="PKW"/>
    <Segment SegmentId="PKG"/>
    <Segment SegmentId="TD1"/>
    <Segment SegmentId="TD5"/>
    <Segment SegmentId="TD3"/>
    <Segment SegmentId="TD4"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
    <Segment SegmentId="CUR"/>
    <Segment SegmentId="V1"/>
    <Segment SegmentId="PER"/>
    <Loop LoopId="LOAD" Usage="Required" LoopRepeat="1">
      <Name>LOAD DETAIL</Name>
      <StartingSegment SegmentId="CLD" Usage="Required" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="200"/>
      <Segment SegmentId="DTP"/>
    </Loop>
  </HierarchicalLoop>
</TransactionSpecification>