Mapping of HL segment in inbound EDI 856


I have to map an inbound EDI 856 document. The HL segment will contain information for 4 levels, say S, O,P and I.
There can be multiple O within a S, multiple P within an O, and multiple I within a P.
I have to insert this data in a table, such that one combinaiton of S,O,P and I goes as one row in the table.
For this, I am trying to form an array. Each iteration of this array should contain one combination of S,P,O and I.
I tried several things like looping on HL, and branching on HL03, but its not working.
Can someone please help me out in this regard?


856 HL mapping is lit tricky though…explaining is also tough.

You mean always you want to extract only the first iterations of O,P and I for your header table???

what you can try doing is branch on HL03 as you did and based once you are in the HL03=S then extract the first iteration ($iteration=0) of O and P from the HL/S hierarchy and map it a seperate document which your table expects and later map the I (Items) to the detail table loop first iteration P but loop all iterations of I to extract the Item details.

BTW,you got to debug throughly and try various mapping combinations to extract the HL hierarchy loop referencing the HL02 and HL03 elements.


Thanks for your suggestion.

Anyways, I meant I want to put all unique combinations of S,O,P,I as different rows in my detail table.