Tuesday, March 14, 2023

#955 OIC B2B - Anatomy of a simple X12 P850 doc

This post is more of a note for myself, but it may also interest some of you out there. In this case, I am receiving purchase orders from my trading partner Commiskey_Inc. My OIC B2B Host configuration is as follows - 

The Trading Partner and document configuration - 

I regularly do OIC demos including B2B, using a very simple X12 P850 document - 

ISA*00*          *00*          *ZZ*Commiskey_IID  *ZZ*MyCompany_IID     *230314*1204*U*00401*000000027*0*P*:~
PO1*HOTD TShirt*30*EA*30~
PO1*HOTD Mug*1*EA*10~
PO1*HOTD Cap*5*EA*15~

Naturally, the B2B demo goes like a dream, but what do these fields mean?

ISA - Interchange Control Header - identifies the interchange - 

ISA01 - Authorization Information Qualifier - '00' means no authorization info present i.e. next field is empty.
ISA03 - Security Information Qualifier - '00' = No Security Information Present.
Net, net, ISA01 to ISA04 are hardly ever used.

ISA05 - Interchange ID Qualifier - is a 2 char code, in my case ZZ.
ISA06 - Interchange Sender ID - this is my trading partner EDI Interchange ID, in my case, Commiskey_IID.
ISA07 - Interchange ID Qualifier, is a 2 char code, in my case ZZ.
ISA08 - Receiver Id, This identifies your partner's sender ID in outgoing messages. In my case this is MyCompany_IID.
ISA09 - Interchange Date - format is YYMMDD. My date is 23rd March 2023 so the value is 230314.
ISA10 - Interchange Time - format is HHMM, in my case, 1204.
ISA11 - Identifier - a single character code value "U" meaning "U.S. EDI Community of ASC X12, TDCC, and UCS".
ISA12 -  the EDI standard published version number. In my case this is set to 00401. 
ISA13 - This is a 9 digit control number used for tracking purposes. This number must match IEA-02 (Interchange Envelope Trailer). In my case, both are set to 000000027.
ISA14 - Acknowledgement Request Indicator, usually set to 0.
ISA15 - Data sent can be for Test (T), Production (P) or Information (I). We're doing this for real so I set this to 'P'.
ISA16 - is the delimiter used to separate compent data elements, within a composite structure. I set this to ':', but, as you can see, it is not used in this simple PO850 doc. 

GS - Functional Group Header - 

GS01 - Functional Identifier Code, PO for Purchase Order.
GS02 - Application Sender’s Code, sames as ISA06, so, in my example, Commiskey_IID. 
GS03 - Receiver's Id, should be the same as ISA08, so, in my example, MyCompany_IID.
GS04 - Transaction Date - format CCYYMMDD, in my case, 20230314.
GS05 - Time in HHMM format.
GS06 - Group control Number - not to be confused with ISA13.
GS07 - EDI standards Agency, 'X' stands for X12.
GS08 - EDI Version - in my case, 004010.

ST segment - Transaction Set Header - first field is the Transaction Set Identifier Code, in my case 850 for purchase order. The second field is the Transaction Set Control Number -  the control number that must be unique within the transaction set, in my case, 1027.  

BEG segment - 

BEG01 - First field, with the value '00' is the X12 TRANSACTION SET PURPOSE.
Valid values include - 
  • 00 Original
  • 01 Cancellation
  • 06 Confirmation
  • 07 Duplicate
Full list available here

BEG02 - Purchase Order Type Code, with the value 'NE'.
Valid values include - 
  • NE New Order
  • NS New Store
  • SA Standalone PO
  • BK Blanket PO

Full list available here

BEG03 - Purchase Order Nr, with the value '8310138'. This field can be up to 22 chars.

BEG04 - optional

BEG05 - PurchaseOrderDate, with the value 20230314 (YYYYMMDD)

CUR - the Currency Segment -

CUR01 - Code identifying an organizational entity, a physical location, property or an individual, in my case '2L' which translates to Corporation.
Full list available here  

CUR02 - Currency Code, in my case 'USD',  
CUR03 - Exchange Rate, in my case 1:1.

PO1 - Purchase Order Item details - the first field is the assigned identification, in my case, 'Bearing'.
The next field is the quantity ordered, in my case, 30. The following field is Unit of Basis for Measurement Code for the quantity, e.g single item or case of items. So my first line is for 30 Hare of the Dog T-Shirts, each costing $30.

CTT - Transaction Totals - first field is he number of line items, in my case 3. The second field is the total order value, in my case - (30 * 30) + (1 * 10) + (5 * 15) = 985 

SE - Transaction Set Trailer - indicates end of transaction set and contains a count of the transmitted segments (incl. ST and SE), in my case, 8. The second field is a unique Transaction Set Control Number (min 4 digits), in my case 1027.

GE - Functional Group trailer - First field contains the number of transaction sets included in the message, in my case, 1. Field 2 is Group Control Number, assigned by the sender. 

IEA - Interchange Control Trailer - first field in the number of included functional included groups, in my case, 1. The second field, Interchange Control Number is a mandatory 9 digit number, in my case, 000000027.       

A very helpful resource for me, when compiling this blog, was the EDI Academy Blog. Check it out here.


No comments: