EANCOM ORDRSP Purchase Order Response

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.

At a glance

Standard
EANCOM
Version
D96A EAN009
Sent by
Supplier to buyer
Responses
CONTRL
ediFabric .NET template
TSORDRSP in EdiFabric.Templates.Edifact
OpenEDI definition
View ORDRSP in the spec library

ORDRSP structure

The 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
UNHMessage headerMandatory1
BGMBeginning of messageMandatory1
DTMDate/time/periodMandatory35
PAIPayment instructionsOptional1
ALIAdditional informationOptional5
FTXFree textOptional99
RFF loopReferenceOptional10
RFFReferenceMandatory1
DTMDate/time/periodOptional5
NAD loopName and addressOptional99
NADName and addressMandatory1
LOCPlace/location identificationOptional25
RFF loopReferenceOptional10
RFFReferenceMandatory1
CTA loopContact informationOptional5
CTAContact informationMandatory1
COMCommunication contactOptional5
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
CUX loopCurrenciesOptional5
CUXCurrenciesMandatory1
DTMDate/time/periodOptional5
PAT loopPayment terms basisOptional10
PATPayment terms basisMandatory1
DTMDate/time/periodOptional5
PCDPercentage detailsOptional1
MOAMonetary amountOptional1
TDT loopDetails of transportOptional10
TDTDetails of transportMandatory1
LOC loopPlace/location identificationOptional10
LOCPlace/location identificationMandatory1
TOD loopTerms of delivery or transportOptional5
TODTerms of delivery or transportMandatory1
LOCPlace/location identificationOptional2
ALC loopAllowance or chargeOptional15
ALCAllowance or chargeMandatory1
ALIAdditional informationOptional5
DTMDate/time/periodOptional5
QTY loopQuantityOptional1
QTYQuantityMandatory1
RNGRange detailsOptional1
PCD loopPercentage detailsOptional1
PCDPercentage detailsMandatory1
RNGRange detailsOptional1
MOA loopMonetary amountOptional2
MOAMonetary amountMandatory1
RNGRange detailsOptional1
RTE loopRate detailsOptional1
RTERate detailsMandatory1
RNGRange detailsOptional1
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
LIN loopLine itemOptional200000
LINLine itemMandatory1
PIAAdditional product idOptional25
IMDItem descriptionOptional99
MEAMeasurementsOptional5
QTYQuantityOptional10
DTMDate/time/periodOptional35
MOAMonetary amountOptional10
GINGoods identity numberOptional1000
QVRQuantity variancesOptional1
FTXFree textOptional99
PRI loopPrice detailsOptional25
PRIPrice detailsMandatory1
CUXCurrenciesOptional1
RFF loopReferenceOptional999
RFFReferenceMandatory1
DTMDate/time/periodOptional5
PAC loopPackageOptional10
PACPackageMandatory1
PCI loopPackage identificationOptional5
PCIPackage identificationMandatory1
RFFReferenceOptional1
DTMDate/time/periodOptional5
GINGoods identity numberOptional99
LOC loopPlace/location identificationOptional9999
LOCPlace/location identificationMandatory1
QTYQuantityOptional1
DTMDate/time/periodOptional5
TAX loopDuty/tax/fee detailsOptional10
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
NAD loopName and addressOptional99
NADName and addressMandatory1
CTA loopContact informationOptional5
CTAContact informationMandatory1
COMCommunication contactOptional5
ALC loopAllowance or chargeOptional99
ALCAllowance or chargeMandatory1
ALIAdditional informationOptional5
DTMDate/time/periodOptional5
QTY loopQuantityOptional1
QTYQuantityMandatory1
RNGRange detailsOptional1
PCD loopPercentage detailsOptional1
PCDPercentage detailsMandatory1
RNGRange detailsOptional1
MOA loopMonetary amountOptional2
MOAMonetary amountMandatory1
RNGRange detailsOptional1
RTE loopRate detailsOptional1
RTERate detailsMandatory1
RNGRange detailsOptional1
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
TDT loopDetails of transportOptional10
TDTDetails of transportMandatory1
UNSSection controlMandatory1
MOAMonetary amountOptional12
CNTControl totalOptional10
UNTMessage trailerMandatory1

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.

Sample ORDRSP file

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'

The same ORDRSP as JSON

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"
  }
}

Parse and validate an ORDRSP file

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'

Generate an ORDRSP file

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'

ORDRSP questions

How does ORDRSP accept or change an order?

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.

Is ORDRSP the same as CONTRL?

No. CONTRL only confirms receipt and syntax. ORDRSP is the business answer to the order.

What is the X12 equivalent?

The X12 855 purchase order acknowledgment.

How do I parse and generate EANCOM ORDRSP files in .NET?

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.

Parse your first ORDRSP in five minutes

The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud.