Acumatica EDI Integration
Introduction
Electronic Data Interchange (EDI) enables businesses to exchange documents electronically with trading partners. Integrating Acumatica with EDI allows automated processing of purchase orders, invoices, and shipping notices.
EDI Document Types
Common EDI transaction sets used in Acumatica integrations:
- 850 - Purchase Order
- 810 - Invoice
- 856 - Advance Ship Notice
- 940 - Warehouse Shipping Order
- 945 - Warehouse Shipping Advice
- 997 - Functional Acknowledgment
EDI Parsing
Parse EDI documents into usable data structures:
class EDIParser {
parse(ediContent) {
const segments = ediContent.split('~');
const transaction = {
type: null,
controlNumber: null,
elements: []
};
for (const segment of segments) {
const elements = segment.trim().split('*');
const segmentId = elements[0];
switch (segmentId) {
case 'ST':
transaction.type = elements[1];
transaction.controlNumber = elements[2];
break;
case 'SE':
transaction.elementCount = elements[1];
transaction.controlNumber = elements[2];
break;
default:
transaction.elements.push({
id: segmentId,
data: elements.slice(1)
});
}
}
return transaction;
}
}
Purchase Orders (850)
Process incoming EDI 850 purchase orders:
async function processPurchaseOrder850(ediData) {
const orderData = {
VendorID: { value: ediData.ref14 },
OrderType: { value: 'PO' },
Location: { value: 'RECEIVING' },
Details: ediData.lineItems.map(item => ({
InventoryID: { value: item.productID },
Qty: { value: item.orderQty },
UnitCost: { value: item.unitPrice }
}))
};
const result = await createSalesOrder(
baseUrl,
token,
'PO301000',
orderData
);
await sendEDI997(baseUrl, ediData.controlNumber, 'AC');
return result;
}
Invoices (810)
Generate EDI 810 invoices from Acumatica sales:
async function generateEDI810(invoice) {
const invoiceData = await getInvoiceDetails(invoice.RefNbr);
let edi = 'ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER *';
edi += formatDate(new Date()) + '*1200*U*00401*' + invoice.controlNumber + '*0*P*>~';
edi += 'ST*810*' + invoice.controlNumber + '~';
edi += 'BIG*' + formatDate(invoice.Date) + '*' + invoice.RefNbr + '**' + invoice.CustomerID + '~';
for (const line of invoiceData.Details) {
edi += 'IT1*' + line.LineNbr + '*' + line.Qty + '*EA*' + line.UnitPrice + '**UP*' + line.InventoryCD + '~';
}
edi += 'CTT*' + invoiceData.Details.length + '~';
edi += 'SE*' + calculateSegmentCount(edi) + '*' + invoice.controlNumber + '~';
edi += 'GE*1*' + invoice.controlNumber + '~';
edi += 'IEA*1*' + invoice.controlNumber + '~';
return edi;
}
Shipments (856)
Create EDI 856 advance ship notices:
async function generateEDI856(shipment) {
const shipmentData = await getShipmentDetails(shipment.ShipmentNbr);
let edi = 'ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER *';
edi += formatDate(new Date()) + '*1200*U*00401*' + shipment.controlNumber + '*0*P*>~';
edi += 'ST*856*' + shipment.controlNumber + '~';
edi += 'BSN*00*' + shipment.ShipmentNbr + '*' + formatDate(shipment.ShipDate) + '*' + shipment.ShipTime + '*0001~';
for (const line of shipmentData.Details) {
edi += 'SN1**' + line.Qty + '*EA~';
edi += 'PRF*' + line.OrderNbr + '~';
}
edi += 'CTT*' + shipmentData.Details.length + '~';
edi += 'SE*' + calculateSegmentCount(edi) + '*' + shipment.controlNumber + '~';
return edi;
}
Complete Integration Example
class AcumaticaEDIIntegration {
constructor(acumaticaConfig, vanConfig) {
this.acumatica = acumaticaConfig;
this.van = vanConfig;
}
async processInboundEDI(ediContent) {
const parser = new EDIParser();
const transaction = parser.parse(ediContent);
switch (transaction.type) {
case '850':
return await this.processPurchaseOrder(transaction);
case '860':
return await this.processOrderChange(transaction);
case '940':
return await this.processWarehouseOrder(transaction);
default:
console.log('Unhandled EDI type:', transaction.type);
}
}
async sendOutboundEDI(documentType, acumaticaDocId) {
let edi;
switch (documentType) {
case '810':
edi = await this.generateEDI810(acumaticaDocId);
break;
case '856':
edi = await this.generateEDI856(acumaticaDocId);
break;
}
await this.van.send(edi);
}
}
Summary
EDI integration with Acumatica enables automated document exchange with trading partners. By implementing the patterns in this guide, you can process purchase orders, generate invoices, and create shipment notices electronically.
For more information, check out our other tutorials on 3PL Integration and REST API Integration.