In this blog post, I will explain how to read and understand an EDI file. EDI stands for Electronic Data Interchange. There are mainly two standards: X12 and EDIFACT. X12 is primarily used in North America, especially in the United States, whereas EDIFACT is predominantly used in Europe. This blog post will focus on X12 syntax only.
Common EDI Transactions:
- EDI 850: Buyer sends Purchase Order to Supplier
- EDI 855: Supplier confirms to Buyer whether the order can be fulfilled
- EDI 856: Supplier provides advance notice of a shipment (ASN)
- EDI 810: Supplier sends invoice to Buyer
Each line of the file is referred to as a segment. Each EDI file starts with ISA (Interchange Control Header) segment and ends with IEA (Interchange Control Trailer) segment.
There can be ‘n’ number of GS/GE segment pair. Each GS segment can have ‘n’ number of transaction set (SE/ST segment pair) of same type.
ISA (Interchange Control Header) Segment
ISA is fixed length positional.
ISA*00* *00* *ZZ*SRCA *ZZ*DSTB *231116*1700*U*00401*000001000*0*T*>
Element Name | Usage | Sample Value |
ISA01 | Authorization Info Qualifier. Fixed length – 2. Code ’00’ indicates that no authorization information present in ISA02 | 00 |
ISA02 | Authorization Information. Fixed length – 10 | Ten spaces |
ISA03 | Security Info Qualifier. Fixed length – 2. Code ’00 ‘indicates that no security information present in ISA04. | 00 |
ISA04 | Security Information. Fixed length – 10 | Ten spaces |
ISA-01 through ISA-04 are hardly used anymore and that is why these are kept as 00 and blank now-a-days.
Element Name | Usage | Sample Value |
ISA05 | Interchange Sender ID Qualifier. Fixed length -2 . Used to define the ID sent in the ISA06. | ZZ |
ISA06 | Interchange Sender ID. Fixed length – 15 | SRCA |
ISA07 | Interchange Receiver ID Qualifier. Fixed length – 2. Used to define the ID sent in the ISA08. | ZZ |
ISA08 | Interchange Receiver ID. Fixed length – 15 | DSTB |
The commonly used qualifiers for ISA05/ISA07 are –
- 01 (DUNS: Dun & Bradstreet’s master Data Universal Numbering System)
- 12 (Telephone number)
- ZZ (Mutually Defined)
Element Name | Usage | Sample Value |
ISA09 | Interchange Date. Fixed length – 6. Format – YYMMDD | 231116 |
ISA10 | Interchange Time. Fixed length – 4. Format – HHMM | 1700 |
ISA11 | Code to identify the agency responsible for the control standard used by the message. Fixed length – 1. ‘U’ stands for ‘U.S. EDI Community of ASC X12’ | U |
ISA12 | EDI Version Number. Fixed length – 5 | 00401 |
ISA13 | Control number for tracking purpose. It must match with IEA02. Fixed length – 9 | |
ISA14 | Acknowledgement Requested (TA1). Code ‘0’ indicates that no acknowledgment has been requested. | |
ISA15 | Usage Indicator. Code ‘P’ indicates that the interchange envelope contains production data. ‘T’ indicates non-prod data | |
ISA16 | Component/Sub Element Separator. The delimiter used to separate component data elements within a composite data structure; this value must be different than the data element separator and the segment terminator. |
In the above example, * is element separator.
CRLF is segment separator.
Sub element separator
PID*F****CNT HSN10201>700
PID represents product description.
PID01 = F, which means free-form
PID05 is using component separator. It has 2 parts. 1st part is CNT HSN10201, 2nd part is 700. This is just an example for showing how to use sub element separator. Always refer to partner’s EDI implementation guidelines for actual usage.
IEA (Interchange Control Trailer) Segment
IEA*1*000001000
Element Name | Value |
IEA01 | Count of the GS segments |
IEA02 | Must match with ISA13 |
GS (Functional Group Header) Segment
GS*PO*SRCA*DSTB*20231116*1700*1000*X*004010
Element Name | Description | Sample Value |
GS01 | Functional Identifier Code | PO |
GS02 | Application Sender’s Code | SRCA |
GS03 | Application Receiver’s Code | DSTB |
GS04 | Date (CCYYMMDD) | 20231116 |
GS05 | Time (HHMM) | 1700 |
GS06 | Group Control Number | 1000 |
GS07 | Responsible Agency Code | X |
GS08 | Version / Release / Industry Identifier | 004010 |
GE (Functional Group Trailer) Segment
GE*1*1000
Element Name | Description | Sample Value |
GE01 | Number of Transaction Sets Included | 1 |
GE02 | Group Control number. Must match GS06 | 1000 |
ST (Transaction Set Header) Segment
ST*850*000000010
Element Name | Description | Sample Value |
ST01 | Transaction Set Identifier Code | 850 |
ST02 | Transaction Set Control Number |
SE (Transaction Set Trailer) Segment
SE*20*000000010
Element Name | Description | Sample Value |
SE01 | Total number of segments included in a transaction set including ST and SE segments | 20 |
SE02 | Transaction Set Control Number. Must Match ST02. |
Understanding Sample EDI File
The below is a sample EDI 850 file.
ISA*00* *00* *ZZ*SRCA *ZZ*DSTB *231116*1700*U*00401*000001000*0*T*>
GS*PO*SRCA*DSTB*20231116*1700*1000*X*004010
ST*850*000000010
BEG*00*SA*08292233294**20231116
REF*DP*038
ITD*14*3*2**45**46
DTM*002*20231125
PKG*F*68***PALLETIZE SHIPMENT
PKG*F*66***REGULAR
TD5*A*92*P3**SEE XYZ RETAIL ROUTING GUIDE
N1*ST*XYZ RETAIL*9*0003947268292
N3*91875 SOLON RD
N4*SOLON*OH*44139*US
PO1*1*120*EA*9.25*TE*CB*065322-117*PR*RO*VN*AB3542
PID*F****SMALL WIDGET
PO4*4*4*EA*PLT94**3*LR*15*CT
PO1*2*220*EA*13.79*TE*CB*066850-116*PR*RO*VN*RD5322
PID*F****MEDIUM WIDGET
PO4*2*2*EA
PO1*3*126*EA*10.99*TE*CB*060733-110*PR*RO*VN*XY5266
PID*F****LARGE WIDGET
PO4*6*1*EA*PLT94**3*LR*12*CT
PO1*4*76*EA*4.35*TE*CB*065308-116*PR*RO*VN*VX2332
PID*F****NANO WIDGET
PO4*4*4*EA*PLT94**6*LR*19*CT
PO1*5*72*EA*7.5*TE*CB*065374-118*PR*RO*VN*RV0524
PID*F****BLUE WIDGET
PO4*4*4*EA
PO1*6*696*EA*9.55*TE*CB*067504-118*PR*RO*VN*DX1875
PID*F****ORANGE WIDGET
PO4*6*6*EA*PLT94**3*LR*10*CT
CTT*6
AMT*1*13045.94
SE*32*000000010
GE*1*1421
IEA*1*000003438
Here,
- This is an original (BEG01 -> 00) and stand-alone (BEG02 -> SA) purchase order
- 08292233294 is the PO number (BEG03) and PO date is 16th Nov, 2023 (BEG05)
- Reference Department (REF01) is 038 (REF02)
- Requested delivery date (DTM01 -> 002) is 25th Nov, 2023 (DTM02)
- Ship To (N101) XYZ RETAIL (N102), Ship to Address is 91875 SOLON RD (N301), SOLON (N401), Ohio (N402), ZIP code – 44139 (N403), US (N404)
- 6 PO line items (CTT01 – is the accumulation of the number of PO1 segments)
Qualifier List
In the above example, I have mentioned some of the qualifiers. All the list of values are present in Code list of Integration Advisor.
BEG01: 00
BEG02: SA
REF01: DP
DTM01: 002
N101: ST
How to convert EDI to XML format?
Use ‘EDI to XML Converter’ and the schema should be downloaded from Integration Advisor.
You can specifically select the required segments or ‘Select All’.
Use the schema from the downloaded zip file in EDI to XML Converter.
Output XML:
<?xml version="1.0" encoding="ISO-8859-1"?><ns0:Interchange xmlns:ns0="urn:sap.com:typesystem:b2b:116:asc-x12:004010">
<S_ISA>
<D_I01>00</D_I01>
<D_I02> </D_I02>
<D_I03>00</D_I03>
<D_I04> </D_I04>
<D_I05_1>ZZ</D_I05_1>
<D_I06>SRCA </D_I06>
<D_I05_2>ZZ</D_I05_2>
<D_I07>DSTB </D_I07>
<D_I08>231116</D_I08>
<D_I09>1700</D_I09>
<D_I10>U</D_I10>
<D_I11>00401</D_I11>
<D_I12>000001000</D_I12>
<D_I13>0</D_I13>
<D_I14>T</D_I14>
<D_I15>></D_I15>
</S_ISA>
<FunctionalGroup>
<S_GS>
<D_479>PO</D_479>
<D_142>SRCA</D_142>
<D_124>DSTB</D_124>
<D_373>20231116</D_373>
<D_337>1700</D_337>
<D_28>1000</D_28>
<D_455>X</D_455>
<D_480>004010</D_480>
</S_GS>
<M_850>
<S_ST>
<D_143>850</D_143>
<D_329>000000010</D_329>
</S_ST>
<S_BEG>
<D_353>00</D_353>
<D_92>SA</D_92>
<D_324>08292233294</D_324>
<D_373>20231116</D_373>
</S_BEG>
<S_REF>
<D_128>DP</D_128>
<D_127>038</D_127>
</S_REF>
<S_ITD>
<D_336>14</D_336>
<D_333>3</D_333>
<D_338>2</D_338>
<D_351>45</D_351>
<D_386>46</D_386>
</S_ITD>
<S_DTM>
<D_374>002</D_374>
<D_373>20231125</D_373>
</S_DTM>
<S_PKG>
<D_349>F</D_349>
<D_753>68</D_753>
<D_352>PALLETIZE SHIPMENT</D_352>
</S_PKG>
<S_PKG>
<D_349>F</D_349>
<D_753>66</D_753>
<D_352>REGULAR</D_352>
</S_PKG>
<S_TD5>
<D_133>A</D_133>
<D_66>92</D_66>
<D_67>P3</D_67>
<D_387>SEE XYZ RETAIL ROUTING GUIDE</D_387>
</S_TD5>
<G_N1>
<S_N1>
<D_98>ST</D_98>
<D_93>XYZ RETAIL</D_93>
<D_66>9</D_66>
<D_67>0003947268292</D_67>
</S_N1>
<S_N3>
<D_166>91875 SOLON RD</D_166>
</S_N3>
<S_N4>
<D_19>SOLON</D_19>
<D_156>OH</D_156>
<D_116>44139</D_116>
<D_26>US</D_26>
</S_N4>
</G_N1>
<G_PO1>
<S_PO1>
<D_350>1</D_350>
<D_330>120</D_330>
<D_355>EA</D_355>
<D_212>9.25</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>065322-117</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>AB3542</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>SMALL WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>4</D_356>
<D_357>4</D_357>
<D_355>EA</D_355>
<D_103>PLT94</D_103>
<D_384>3</D_384>
<D_355_2>LR</D_355_2>
<D_385>15</D_385>
<D_355_3>CT</D_355_3>
</S_PO4>
</G_PO1>
<G_PO1>
<S_PO1>
<D_350>2</D_350>
<D_330>220</D_330>
<D_355>EA</D_355>
<D_212>13.79</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>066850-116</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>RD5322</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>MEDIUM WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>2</D_356>
<D_357>2</D_357>
<D_355>EA</D_355>
</S_PO4>
</G_PO1>
<G_PO1>
<S_PO1>
<D_350>3</D_350>
<D_330>126</D_330>
<D_355>EA</D_355>
<D_212>10.99</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>060733-110</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>XY5266</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>LARGE WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>6</D_356>
<D_357>1</D_357>
<D_355>EA</D_355>
<D_103>PLT94</D_103>
<D_384>3</D_384>
<D_355_2>LR</D_355_2>
<D_385>12</D_385>
<D_355_3>CT</D_355_3>
</S_PO4>
</G_PO1>
<G_PO1>
<S_PO1>
<D_350>4</D_350>
<D_330>76</D_330>
<D_355>EA</D_355>
<D_212>4.35</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>065308-116</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>VX2332</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>NANO WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>4</D_356>
<D_357>4</D_357>
<D_355>EA</D_355>
<D_103>PLT94</D_103>
<D_384>6</D_384>
<D_355_2>LR</D_355_2>
<D_385>19</D_385>
<D_355_3>CT</D_355_3>
</S_PO4>
</G_PO1>
<G_PO1>
<S_PO1>
<D_350>5</D_350>
<D_330>72</D_330>
<D_355>EA</D_355>
<D_212>7.5</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>065374-118</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>RV0524</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>BLUE WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>4</D_356>
<D_357>4</D_357>
<D_355>EA</D_355>
</S_PO4>
</G_PO1>
<G_PO1>
<S_PO1>
<D_350>6</D_350>
<D_330>696</D_330>
<D_355>EA</D_355>
<D_212>9.55</D_212>
<D_639>TE</D_639>
<D_235>CB</D_235>
<D_234>067504-118</D_234>
<D_235_2>PR</D_235_2>
<D_234_2>RO</D_234_2>
<D_235_3>VN</D_235_3>
<D_234_3>DX1875</D_234_3>
</S_PO1>
<G_PID>
<S_PID>
<D_349>F</D_349>
<D_352>ORANGE WIDGET</D_352>
</S_PID>
</G_PID>
<S_PO4>
<D_356>6</D_356>
<D_357>6</D_357>
<D_355>EA</D_355>
<D_103>PLT94</D_103>
<D_384>3</D_384>
<D_355_2>LR</D_355_2>
<D_385>10</D_385>
<D_355_3>CT</D_355_3>
</S_PO4>
</G_PO1>
<G_CTT>
<S_CTT>
<D_354>6</D_354>
</S_CTT>
<S_AMT>
<D_522>1</D_522>
<D_782>13045.94</D_782>
</S_AMT>
</G_CTT>
<S_SE>
<D_96>32</D_96>
<D_329>000000010</D_329>
</S_SE>
</M_850>
<S_GE>
<D_97>1</D_97>
<D_28>1421</D_28>
</S_GE>
</FunctionalGroup>
<S_IEA>
<D_I16>1</D_I16>
<D_I12>000003438</D_I12>
</S_IEA>
</ns0:Interchange>
Message Headers
The below message headers are generated by EDI to XML converter step.
Thank you for reading this blog post. Please feel free to share your feedback or thoughts in the comments section or ask any questions in the Q&A tag below.
Regards,
Priyanka Chakraborti
Be the first to comment