Search code examples
xmlbiztalkedi

EDI 945 N9 not nesting W12 Loop


I am trying to create a EDI 945 from a internal shipping info XML file.

I need the N9 line above each W12 line

I have tried using a Table Mapping Functoid to no avail.

BizTalk creates the line items like this

  LX*1~  
    N9*LI*1~  
    N9*LI*2~  
    W12*CC*1*1*0*EA*Par1*VC~  
    W12*CC*2*2*0*EA*Par2*VC

I need it to be this

 LX*1~  
    N9*LI*1~  
    W12*CC*1*1*0*EA*Par1*VC~ 
    N9*LI*2~
    W12*CC*2*2*0*EA*Par2*VC 

here is XML

`<OrderNumber xmlns="">2988069</OrderNumber>
  <ShipDate xmlns="">20150715</ShipDate>
  <ShipToAddress1 xmlns="">SANTANDER 000</ShipToAddress1>
  <ShipToAddress2 xmlns="">211 NORTH MAIN STREET,</ShipToAddress2>
  <ShipToCity xmlns="">ANDOVER</ShipToCity>
  <ShipToPlaceStateAbbreviation xmlns="">NY</ShipToPlaceStateAbbreviation>
  <ShipToPostalCode xmlns="">01810-0000</ShipToPostalCode>
  <ShippingCompanyName xmlns="">SANTANDER 6017</ShippingCompanyName>
  <TrackingNumber xmlns="">1Z09A0000346000075</TrackingNumber>
  <ShippingCost xmlns="">0.00</ShippingCost>
  <ShipperDetails xmlns="">
    <ShipperDetail>
      <CompleteShipmentCode>CC</CompleteShipmentCode>
      <OrderQty>2</OrderQty>
      <ShipQty>2</ShipQty>
      <UOM>EA</UOM>
      <ItemNumber>PAN001</ItemNumber>
      <LineNumber>1</LineNumber>
    </ShipperDetail>
    <ShipperDetail>
      <CompleteShipmentCode>CC</CompleteShipmentCode>
      <OrderQty>2</OrderQty>
      <ShipQty>2</ShipQty>
      <UOM>EA</UOM>
      <ItemNumber>PAN002</ItemNumber>
      <LineNumber>2</LineNumber>
    </ShipperDetail>
  </ShipperDetails>
  <TotalWeight xmlns="">1</TotalWeight>
</WarehouseShippingAdvice>`

Solution

  • I believe "LI" goes in the N9 after W12, i.e. N9_3. If your specs say otherwise then they are not following the standard so you will need to manually edit the schema to match the requirements.

    So I can produce this:

    LX*1~
    W12*CC*2*2**EA*PAN001*VC~
    N9*LI*1~
    W12*CC*2*2**EA*PAN002*VC~
    N9*LI*2~
    

    with this

    enter image description here