DESADV is the despatch advice - the EDIFACT advance ship notice. Suppliers send it when goods leave so the receiver can prepare and scan the delivery. This sample follows EANCOM D96A.
CPS groups build the packing hierarchy: consignment, pallets and cartons, each with PAC packaging and GS1 SSCC identifiers, and LIN groups list the items and quantities they contain.
D96A EAN007TSDESADV in EdiFabric.Templates.EdifactThe full EANCOM DESADV layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 20 loops and 49 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 | Optional | 10 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 1 |
| NAD loop | Name and address | Optional | 10 |
NAD | Name and address | Mandatory | 1 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
| CTA loop | Contact information | Optional | 10 |
CTA | Contact information | Mandatory | 1 |
COM | Communication contact | Optional | 5 |
| TOD loop | Terms of delivery or transport | Optional | 10 |
TOD | Terms of delivery or transport | Mandatory | 1 |
LOC | Place/location identification | Optional | 5 |
| 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 |
| EQD loop | Equipment details | Optional | 10 |
EQD | Equipment details | Mandatory | 1 |
MEA | Measurements | Optional | 5 |
SEL | Seal number | Optional | 25 |
| CPS loop | Consignment packing sequence | Optional | 9999 |
CPS | Consignment packing sequence | Mandatory | 1 |
| PAC loop | Package | Optional | 9999 |
PAC | Package | Mandatory | 1 |
MEA | Measurements | Optional | 10 |
QTY | Quantity | Optional | 10 |
| HAN loop | Handling instructions | Optional | 10 |
HAN | Handling instructions | Mandatory | 1 |
| PCI loop | Package identification | Optional | 1000 |
PCI | Package identification | Mandatory | 1 |
RFF | Reference | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
| GIN loop | Goods identity number | Optional | 99 |
GIN | Goods identity number | Mandatory | 1 |
| LIN loop | Line item | Optional | 9999 |
LIN | Line item | Mandatory | 1 |
PIA | Additional product id | Optional | 10 |
IMD | Item description | Optional | 25 |
MEA | Measurements | Optional | 10 |
QTY | Quantity | Optional | 10 |
DLM | Delivery limitations | Optional | 100 |
DTM | Date/time/period | Optional | 5 |
FTX | Free text | Optional | 5 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 1 |
| LOC loop | Place/location identification | Optional | 100 |
LOC | Place/location identification | Mandatory | 1 |
DTM | Date/time/period | Optional | 1 |
QTY | Quantity | Optional | 10 |
| PCI loop | Package identification | Optional | 9999 |
PCI | Package identification | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
MEA | Measurements | Optional | 10 |
QTY | Quantity | Optional | 1 |
| GIN loop | Goods identity number | Optional | 10 |
GIN | Goods identity number | Mandatory | 1 |
DLM | Delivery limitations | Optional | 100 |
| HAN loop | Handling instructions | Optional | 10 |
HAN | Handling instructions | Mandatory | 1 |
| QVR loop | Quantity variances | Optional | 10 |
QVR | Quantity variances | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
CNT | Control total | Optional | 5 |
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 despatch advice with a packing hierarchy and line items. Paste it into EdiNation to see every element named and validated.
UNB+UNOB:1+SENDER1:1+RECEIVER1:1+071101:1701+131++INVOIC++1++1' UNH+ME000001+DESADV:D:96A:UN:EAN007' BGM+351+DES587441+9' DTM+137:20020401:102' DTM+11:20020403:102' DTM+358:20020403:102' RFF+ON:12332' DTM+171:20020325:102' NAD+SU+5411234512309::9' RFF+VA:6558774' NAD+BY+5412345000013::9' RFF+VA:7002474' NAD+DP+5412345123453::9' RFF+VA:800800' NAD+SH+5412345000105::9' CPS+1' PAC+2++201::9' CPS+2+1' PAC+1++201::9' MEA+PD+AAB+KGM:263.2' MEA+PD+WD+MMT:800' MEA+PD+LN+MMT:1200' PCI+33E' GIN+BJ+354107380000001051' PAC+20++CT' LIN+1++5410738000152:SRV' QTY+12:20' CPS+3+1' PAC+1++201::9' MEA+PD+AAB+KGM:305.1' PCI+33E' GIN+BJ+354107380000001068' PAC+20++CT' LIN+2++5410738000169:SRV' QTY+12:5' LIN+3++5410738000176:SRV' QTY+12:3' LIN+4++5410738000183:SRV' QTY+12:12' CNT+2:4' UNT+40+ME000001' UNZ+2+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": "DESADV",
"MessageVersionNumber_02": "D",
"MessageReleaseNumber_03": "96A",
"ControllingAgencyCoded_04": "UN",
"AssociationAssignedCode_05": "EAN007"
}
},
"BGM": {
"DOCUMENTMESSAGENAME_01": {
"Documentmessagenamecoded_01": "351"
},
"DOCUMENTMESSAGENUMBER_02": "DES587441",
"MESSAGEFUNCTIONCODED_03": "9"
},
"DTM": [
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "137",
"Datetimeperiod_02": "20020401",
"Datetimeperiodformatqualifier_03": "102"
}
},
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "11",
"Datetimeperiod_02": "20020403",
"Datetimeperiodformatqualifier_03": "102"
}
},
{
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "358",
"Datetimeperiod_02": "20020403",
"Datetimeperiodformatqualifier_03": "102"
}
}
],
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "ON",
"Referencenumber_02": "12332"
}
},
"DTM": {
"DATETIMEPERIOD_01": {
"Datetimeperiodqualifier_01": "171",
"Datetimeperiod_02": "20020325",
"Datetimeperiodformatqualifier_03": "102"
}
}
}
],
"NADLoop": [
{
"NAD": {
"PARTYQUALIFIER_01": "SU",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "5411234512309",
"Codelistresponsibleagencycoded_03": "9"
}
},
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "VA",
"Referencenumber_02": "6558774"
}
}
}
]
},
{
"NAD": {
"PARTYQUALIFIER_01": "BY",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "5412345000013",
"Codelistresponsibleagencycoded_03": "9"
}
},
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "VA",
"Referencenumber_02": "7002474"
}
}
}
]
},
{
"NAD": {
"PARTYQUALIFIER_01": "DP",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "5412345123453",
"Codelistresponsibleagencycoded_03": "9"
}
},
"RFFLoop": [
{
"RFF": {
"REFERENCE_01": {
"Referencequalifier_01": "VA",
"Referencenumber_02": "800800"
}
}
}
]
},
{
"NAD": {
"PARTYQUALIFIER_01": "SH",
"PARTYIDENTIFICATIONDETAILS_02": {
"Partyididentification_01": "5412345000105",
"Codelistresponsibleagencycoded_03": "9"
}
}
}
],
"CPSLoop": [
{
"CPS": {
"HIERARCHICALIDNUMBER_01": "1"
},
"PACLoop": [
{
"PAC": {
"NUMBEROFPACKAGES_01": "2",
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "201",
"Codelistresponsibleagencycoded_03": "9"
}
}
}
]
},
{
"CPS": {
"HIERARCHICALIDNUMBER_01": "2",
"HIERARCHICALPARENTID_02": "1"
},
"PACLoop": [
{
"PAC": {
"NUMBEROFPACKAGES_01": "1",
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "201",
"Codelistresponsibleagencycoded_03": "9"
}
},
"MEA": [
{
"MEASUREMENTAPPLICATIONQUALIFIER_01": "PD",
"MEASUREMENTDETAILS_02": {
"Measurementdimensioncoded_01": "AAB"
},
"VALUERANGE_03": {
"Measureunitqualifier_01": "KGM",
"Measurementvalue_02": "263.2"
}
},
{
"MEASUREMENTAPPLICATIONQUALIFIER_01": "PD",
"MEASUREMENTDETAILS_02": {
"Measurementdimensioncoded_01": "WD"
},
"VALUERANGE_03": {
"Measureunitqualifier_01": "MMT",
"Measurementvalue_02": "800"
}
},
{
"MEASUREMENTAPPLICATIONQUALIFIER_01": "PD",
"MEASUREMENTDETAILS_02": {
"Measurementdimensioncoded_01": "LN"
},
"VALUERANGE_03": {
"Measureunitqualifier_01": "MMT",
"Measurementvalue_02": "1200"
}
}
],
"PCILoop": [
{
"PCI": {
"MARKINGINSTRUCTIONSCODED_01": "33E"
},
"GINLoop": [
{
"GIN": {
"IDENTITYNUMBERQUALIFIER_01": "BJ",
"IDENTITYNUMBERRANGE_02": {
"Identitynumber_01": "354107380000001051"
}
}
}
]
}
]
},
{
"PAC": {
"NUMBEROFPACKAGES_01": "20",
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "CT"
}
}
}
],
"LINLoop": [
{
"LIN": {
"LINEITEMNUMBER_01": "1",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "5410738000152",
"Itemnumbertypecoded_02": "SRV"
}
},
"QTY": [
{
"QUANTITYDETAILS_01": {
"Quantityqualifier_01": "12",
"Quantity_02": "20"
}
}
]
}
]
},
{
"CPS": {
"HIERARCHICALIDNUMBER_01": "3",
"HIERARCHICALPARENTID_02": "1"
},
"PACLoop": [
{
"PAC": {
"NUMBEROFPACKAGES_01": "1",
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "201",
"Codelistresponsibleagencycoded_03": "9"
}
},
"MEA": [
{
"MEASUREMENTAPPLICATIONQUALIFIER_01": "PD",
"MEASUREMENTDETAILS_02": {
"Measurementdimensioncoded_01": "AAB"
},
"VALUERANGE_03": {
"Measureunitqualifier_01": "KGM",
"Measurementvalue_02": "305.1"
}
}
],
"PCILoop": [
{
"PCI": {
"MARKINGINSTRUCTIONSCODED_01": "33E"
},
"GINLoop": [
{
"GIN": {
"IDENTITYNUMBERQUALIFIER_01": "BJ",
"IDENTITYNUMBERRANGE_02": {
"Identitynumber_01": "354107380000001068"
}
}
}
]
}
]
},
{
"PAC": {
"NUMBEROFPACKAGES_01": "20",
"PACKAGETYPE_03": {
"Typeofpackagesidentification_01": "CT"
}
}
}
],
"LINLoop": [
{
"LIN": {
"LINEITEMNUMBER_01": "2",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "5410738000169",
"Itemnumbertypecoded_02": "SRV"
}
},
"QTY": [
{
"QUANTITYDETAILS_01": {
"Quantityqualifier_01": "12",
"Quantity_02": "5"
}
}
]
},
{
"LIN": {
"LINEITEMNUMBER_01": "3",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "5410738000176",
"Itemnumbertypecoded_02": "SRV"
}
},
"QTY": [
{
"QUANTITYDETAILS_01": {
"Quantityqualifier_01": "12",
"Quantity_02": "3"
}
}
]
},
{
"LIN": {
"LINEITEMNUMBER_01": "4",
"ITEMNUMBERIDENTIFICATION_03": {
"Itemnumber_01": "5410738000183",
"Itemnumbertypecoded_02": "SRV"
}
},
"QTY": [
{
"QUANTITYDETAILS_01": {
"Quantityqualifier_01": "12",
"Quantity_02": "12"
}
}
]
}
]
}
],
"CNT": [
{
"CONTROL_01": {
"Controlqualifier_01": "2",
"Controlvalue_02": "4"
}
}
],
"UNT": {
"NumberofSegmentsinaMessage_01": "40",
"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\DespatchAdvice.txt")) using (var reader = new EdifactReader(stream, "EdiFabric.Templates.Edifact")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TSDESADV>()) { 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 '@DespatchAdvice.txt'
Populate a TSDESADV object in .NET, or post JSON in the shape shown above to ediFabric Cloud, and get a valid DESADV file back.
using EdiFabric.Templates.EdifactD96A; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TSDESADV(); // Message header transaction.UNH = new UNH(); transaction.UNH.MessageReferenceNumber_01 = "0001"; transaction.UNH.MessageIdentifier_02 = new S009(); transaction.UNH.MessageIdentifier_02.MessageType_01 = "DESADV"; transaction.UNH.MessageIdentifier_02.MessageVersionNumber_02 = "D"; transaction.UNH.MessageIdentifier_02.MessageReleaseNumber_03 = "96A"; transaction.UNH.MessageIdentifier_02.ControllingAgencyCoded_04 = "UN"; // Despatch advice number DES587441 transaction.BGM = new BGM(); transaction.BGM.DOCUMENTMESSAGENAME_01 = new C002(); transaction.BGM.DOCUMENTMESSAGENAME_01.Documentmessagenamecoded_01 = "351"; transaction.BGM.Documentmessagenumber_02 = "DES587441"; transaction.BGM.Messagefunctioncoded_03 = "9"; // 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 '@DespatchAdvice.json' \ -o 'DespatchAdvice.txt'
Each CPS group is one level in the packing hierarchy, with its parent in CPS02. PAC gives the package type and PCI/GIN the SSCC printed on the label.
A CONTRL for syntax and, when agreed, a RECADV receiving advice with the quantities actually received.
The X12 856 ship notice/manifest.
In .NET, install EdiFabric and EdiFabric.Templates.Edifact, read the file with EdifactReader into TSDESADV 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.