ORDRSP is the purchase order response. The supplier sends it after an ORDERS to accept, change or reject the order, in whole or line by line. This sample follows EANCOM, the GS1 subset of EDIFACT D96A.
BGM 231 identifies a purchase order response and references the order, and each LIN group carries an action code with the confirmed quantities, prices and delivery dates.
D96A EAN009TSORDRSP in EdiFabric.Templates.EdifactThe full EANCOM ORDRSP layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 32 loops and 83 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.
| Segment / loop | Name | Usage | Max use |
|---|---|---|---|
UNH | Message header | Mandatory | 1 |
BGM | Beginning of message | Mandatory | 1 |
DTM | Date/time/period | Mandatory | 35 |
PAI | Payment instructions | Optional | 1 |
ALI | Additional information | Optional | 5 |
FTX | Free text | Optional | 99 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| NAD loop | Name and address | Optional | 99 |
NAD | Name and address | Mandatory | 1 |
LOC | Place/location identification | Optional | 25 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
| CTA loop | Contact information | Optional | 5 |
CTA | Contact information | Mandatory | 1 |
COM | Communication contact | Optional | 5 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| CUX loop | Currencies | Optional | 5 |
CUX | Currencies | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| PAT loop | Payment terms basis | Optional | 10 |
PAT | Payment terms basis | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
PCD | Percentage details | Optional | 1 |
MOA | Monetary amount | Optional | 1 |
| TDT loop | Details of transport | Optional | 10 |
TDT | Details of transport | Mandatory | 1 |
| LOC loop | Place/location identification | Optional | 10 |
LOC | Place/location identification | Mandatory | 1 |
| TOD loop | Terms of delivery or transport | Optional | 5 |
TOD | Terms of delivery or transport | Mandatory | 1 |
LOC | Place/location identification | Optional | 2 |
| ALC loop | Allowance or charge | Optional | 15 |
ALC | Allowance or charge | Mandatory | 1 |
ALI | Additional information | Optional | 5 |
DTM | Date/time/period | Optional | 5 |
| QTY loop | Quantity | Optional | 1 |
QTY | Quantity | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| PCD loop | Percentage details | Optional | 1 |
PCD | Percentage details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| MOA loop | Monetary amount | Optional | 2 |
MOA | Monetary amount | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| RTE loop | Rate details | Optional | 1 |
RTE | Rate details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| LIN loop | Line item | Optional | 200000 |
LIN | Line item | Mandatory | 1 |
PIA | Additional product id | Optional | 25 |
IMD | Item description | Optional | 99 |
MEA | Measurements | Optional | 5 |
QTY | Quantity | Optional | 10 |
DTM | Date/time/period | Optional | 35 |
MOA | Monetary amount | Optional | 10 |
GIN | Goods identity number | Optional | 1000 |
QVR | Quantity variances | Optional | 1 |
FTX | Free text | Optional | 99 |
| PRI loop | Price details | Optional | 25 |
PRI | Price details | Mandatory | 1 |
CUX | Currencies | Optional | 1 |
| RFF loop | Reference | Optional | 999 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| PAC loop | Package | Optional | 10 |
PAC | Package | Mandatory | 1 |
| PCI loop | Package identification | Optional | 5 |
PCI | Package identification | Mandatory | 1 |
RFF | Reference | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
GIN | Goods identity number | Optional | 99 |
| LOC loop | Place/location identification | Optional | 9999 |
LOC | Place/location identification | Mandatory | 1 |
QTY | Quantity | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
| TAX loop | Duty/tax/fee details | Optional | 10 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| NAD loop | Name and address | Optional | 99 |
NAD | Name and address | Mandatory | 1 |
| CTA loop | Contact information | Optional | 5 |
CTA | Contact information | Mandatory | 1 |
COM | Communication contact | Optional | 5 |
| ALC loop | Allowance or charge | Optional | 99 |
ALC | Allowance or charge | Mandatory | 1 |
ALI | Additional information | Optional | 5 |
DTM | Date/time/period | Optional | 5 |
| QTY loop | Quantity | Optional | 1 |
QTY | Quantity | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| PCD loop | Percentage details | Optional | 1 |
PCD | Percentage details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| MOA loop | Monetary amount | Optional | 2 |
MOA | Monetary amount | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| RTE loop | Rate details | Optional | 1 |
RTE | Rate details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| TDT loop | Details of transport | Optional | 10 |
TDT | Details of transport | Mandatory | 1 |
UNS | Section control | Mandatory | 1 |
MOA | Monetary amount | Optional | 12 |
CNT | Control total | Optional | 10 |
UNT | Message trailer | Mandatory | 1 |
Mandatory segments must be sent, Optional ones only when the data applies. Trading partners often add their own rules in companion guides - ediFabric templates can be adjusted to match. Open the element-level definition in the EdiNation spec library.
An EANCOM order response with line-level confirmations. Paste it into EdiNation to see every element named and validated.
UNB+UNOB:1+SENDER1:16:ZZUK+RECEIVER1:01:ZZUK+071101:1701+131++ORDRSP++1++1' UNH+ME000001+ORDRSP:D:96A:UN:EAN009' BGM+231+ORSP12856+4' DTM+137:20020330:102' RFF+ON:652744' DTM+171:20020325:102' NAD+BY+5412345000013::9' RFF+VA:452282' NAD+SU+4012345500004::9' RFF+VA:87765432' LIN+1+5+3312345501102:SRV' LIN+2+3+3312345501003:SRV' PIA+1+ABC1234:SA' IMD+C++TU::9' QTY+21:48' DTM+2:20020910:102' MOA+203:26400' PRI+AAA:550:CT:AAA' PAC+4+1+CS' TAX+7+VAT+++:::17.5+S' MOA+124:4620' TDT+20++30++31' LIN+3+7+3312345501096:SRV' UNS+S' CNT+2:3' UNT+25+ME000001' UNZ+1+131'
ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.
{
"UNH": {
"MessageReferenceNumber_01": "ME000001",
"MessageIdentifier_02": {
"MessageType_01": "ORDRSP",
"MessageVersionNumber_02": "D",
"MessageReleaseNumber_03": "96A",
"ControllingAgencyCoded_04": "UN",
"AssociationAssignedCode_05": "EAN009"
}
},
"BGM": {
"DOCUMENTMESSAGENAME_01": {
"Documentmessagenamecoded_01": "231"
},
"DOCUMENTMESSAGENUMBER_02": "ORSP12856",
"MESSAGEFUNCTIONCODED_03": "4"
},
"DTM": [
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "137",
"Datetimeperiod_02": "20020330",
"Datetimeperiodformatqualifier_03": "102"
}
}
],
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "ON",
"Referencenumber_02": "652744"
}
},
"DTM": [
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "171",
"Datetimeperiod_02": "20020325",
"Datetimeperiodformatqualifier_03": "102"
}
}
]
}
],
"NADLoop": [
{
"NAD": {
"PARTYQUALIFIER_01": "BY",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "5412345000013",
"Codelistresponsibleagencycoded_03": "9"
}
},
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "VA",
"Referencenumber_02": "452282"
}
}
}
]
},
{
"NAD": {
"PARTYQUALIFIER_01": "SU",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "4012345500004",
"Codelistresponsibleagencycoded_03": "9"
}
},
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "VA",
"Referencenumber_02": "87765432"
}
}
}
]
}
],
"LINLoop": [
{
"LIN": {
"LINEITEMNUMBER_01": "1",
"ACTIONREQUESTNOTIFICATIONCODED_02": "5",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "3312345501102",
"Itemnumbertypecoded_02": "SRV"
}
}
},
{
"LIN": {
"LINEITEMNUMBER_01": "2",
"ACTIONREQUESTNOTIFICATIONCODED_02": "3",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "3312345501003",
"Itemnumbertypecoded_02": "SRV"
}
},
"PIA": [
{
"PRODUCTIDFUNCTIONQUALIFIER_01": "1",
"ITEMNUMBERIDENTIFICATION_02": {
"Itemnumber_01": "ABC1234",
"Itemnumbertypecoded_02": "SA"
}
}
],
"IMD": [
{
"ITEMDESCRIPTIONTYPECODED_01": "C",
"ITEMDESCRIPTION_03": {
"Itemdescriptionidentification_01": "TU",
"Codelistresponsibleagencycoded_03": "9"
}
}
],
"QTY": [
{
"QUANTITYDETAILS_01": {
"Quantityqualifier_01": "21",
"Quantity_02": "48"
}
}
],
"DTM": [
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "2",
"Datetimeperiod_02": "20020910",
"Datetimeperiodformatqualifier_03": "102"
}
}
],
"MOA": [
{
"MONETARYAMOUNT_01": {
"Monetaryamounttypequalifier_01": "203",
"Monetaryamount_02": "26400"
}
}
],
"PRILoop": [
{
"PRI": {
"PRICEINFORMATION_01": {
"Pricequalifier_01": "AAA",
"Price_02": "550",
"Pricetypecoded_03": "CT",
"Pricetypequalifier_04": "AAA"
}
}
}
],
"PACLoop": [
{
"PAC": {
"NUMBEROFPACKAGES_01": "4",
"PACKAGINGDETAILS_02": {
"Packaginglevelcoded_01": "1"
},
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "CS"
}
}
}
],
"TAXLoop": [
{
"TAX": {
"DUTYTAXFEEFUNCTIONQUALIFIER_01": "7",
"DUTYTAXFEETYPE_02": {
"Dutytaxfeetypecoded_01": "VAT"
},
"DUTYTAXFEEDETAIL_05": {
"Dutytaxfeerate_04": "17.5"
},
"DUTYTAXFEECATEGORYCODED_06": "S"
},
"MOA": {
"MONETARYAMOUNT_01": {
"Monetaryamounttypequalifier_01": "124",
"Monetaryamount_02": "4620"
}
}
}
],
"TDTLoop": [
{
"TDT": {
"TRANSPORTSTAGEQUALIFIER_01": "20",
"MODEOFTRANSPORT_03": {
"Modeoftransportcoded_01": "30"
},
"CARRIER_05": {
"Carrieridentification_01": "31"
}
}
}
]
},
{
"LIN": {
"LINEITEMNUMBER_01": "3",
"ACTIONREQUESTNOTIFICATIONCODED_02": "7",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "3312345501096",
"Itemnumbertypecoded_02": "SRV"
}
}
}
],
"UNS": {
"SECTIONIDENTIFICATION_01": "S"
},
"CNT": [
{
"CONTROL_01": {
"Controlqualifier_01": "2",
"Controlvalue_02": "3"
}
}
],
"UNT": {
"NumberofSegmentsinaMessage_01": "25",
"MessageReferenceNumber_02": "ME000001"
}
}Read the file into typed objects with ediFabric .NET, or post it to the ediFabric Cloud REST API from any language and get JSON back.
using EdiFabric.Templates.EdifactD96A; License.SetSerial("YOUR_SERIAL_KEY"); using (var stream = File.OpenRead(@"C:\edi\PurchaseOrderResponse.txt")) using (var reader = new EdifactReader(stream, "EdiFabric.Templates.Edifact")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TSORDRSP>()) { if (transaction.IsValid(out MessageErrorContext errors)) Console.WriteLine($"{transaction.UNH.MessageReferenceNumber_01} is valid"); else Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten())); } }
curl -X POST 'https://api.edination.com/v2/edifact/read' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/octet-stream' \ --data-binary '@PurchaseOrderResponse.txt'
Populate a TSORDRSP object in .NET, or post JSON in the shape shown above to ediFabric Cloud, and get a valid ORDRSP file back.
using EdiFabric.Templates.EdifactD96A; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TSORDRSP(); // Message header transaction.UNH = new UNH(); transaction.UNH.MessageReferenceNumber_01 = "0001"; transaction.UNH.MessageIdentifier_02 = new S009(); transaction.UNH.MessageIdentifier_02.MessageType_01 = "ORDRSP"; transaction.UNH.MessageIdentifier_02.MessageVersionNumber_02 = "D"; transaction.UNH.MessageIdentifier_02.MessageReleaseNumber_03 = "96A"; transaction.UNH.MessageIdentifier_02.ControllingAgencyCoded_04 = "UN"; // Order response number ORSP12856, accepted with proposals for change transaction.BGM = new BGM(); transaction.BGM.DOCUMENTMESSAGENAME_01 = new C002(); transaction.BGM.DOCUMENTMESSAGENAME_01.Documentmessagenamecoded_01 = "231"; transaction.BGM.Documentmessagenumber_02 = "ORSP12856"; transaction.BGM.Messagefunctioncoded_03 = "4"; // Repeating DTM transaction.DTM = new List<DTM>(); // ... set the remaining loops and segments the same way // SegmentBuilders is in the Common project of the example repository using (var stream = new MemoryStream()) { using (var writer = new EdifactWriter(stream)) { writer.Write(SegmentBuilders.BuildUnb("1")); writer.Write(transaction); } Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray())); }
# the JSON returned by /read, edited or produced by your application curl -X POST 'https://api.edination.com/v2/edifact/write' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/json' \ --data-binary '@PurchaseOrderResponse.json' \ -o 'PurchaseOrderResponse.txt'
BGM03 gives the message function for the whole response, and LIN02 on each line uses action codes such as 5 accepted without amendment, 3 changed or 7 not accepted.
No. CONTRL only confirms receipt and syntax. ORDRSP is the business answer to the order.
The X12 855 purchase order acknowledgment.
In .NET, install EdiFabric and EdiFabric.Templates.Edifact, read the file with EdifactReader into TSORDRSP objects and write them back with EdifactWriter. From any other language, post the file to the ediFabric Cloud REST API, which returns the same structure as JSON and converts JSON back to EANCOM.