DEV Community

challan116-ux
challan116-ux

Posted on

The EDIFACT APERAK, Decoded: The Message That Tells You Your Message Was Wrong

The EDIFACT APERAK, Decoded: The Message That Tells You Your Message Was Wrong

Most EDIFACT conversations look polite on the surface. An ORDERS arrives, an ORDRSP commits, a DESADV announces the shipment, an INVOIC asks for money. Then one day a different message shows up — short, blunt, and easy to ignore until a partner's orders quietly stop flowing: the APERAK.

APERAK is the Application Error and Acknowledgement Message. It is EDIFACT's equivalent of X12's 824 Application Advice, with a touch of the 997's job mixed in: it reports that a message you sent was received, and then it tells you — at the application level — what was wrong with it. Not "the file would not parse." Worse: "the file parsed fine, and the business content still failed."

Where APERAK sits in the stack

EDIFACT acknowledgements come in layers, and confusing them is the first operational mistake.

  • CONTRL is the syntax layer. It says your interchange was structurally readable — segments in order, envelopes balanced — or it rejects it with syntax errors. It says nothing about whether the order inside made sense.
  • APERAK is the application layer. It says the receiving application processed your message and found errors in the content: a missing reference, an unknown product code, a date in the past, a price that does not match the agreement.
  • A functional response like ORDRSP is the business layer. It accepts, changes, or rejects the order itself.

If CONTRL is "we could read it" and ORDRSP is "we will ship it," APERAK is "we read it, we understood it, and here is the list of reasons it cannot enter our system." Treating an APERAK as a transport receipt is how errors age into chargebacks and cancelled orders.

What a real APERAK contains

An APERAK opens with UNH and BGM, where BGM names the function: an acknowledgement, an error notification, or both. Then comes DTM for the timing, and the segments that do the real work:

  • RFF ties the APERAK back to the original message — its reference number, and usually the original document number, so you can find the exact ORDERS or INVOIC being complained about without guessing.
  • ERC carries the application error code. In the classic pattern it sits inside a segment group with FTX, so the code says what class of error occurred and the free text says where: which segment, which element, which line item.
  • FTX is the human-readable part. Good partners write FTX text an operator can act on ("Line 20: unknown GTIN, not in catalogue as of 2026-11-01"). Weak implementations send a bare code and leave you to phone someone.

The discipline that matters: one APERAK can report several errors against one original message, and the absence of an error group is the positive acknowledgement. If your integration only checks "did an APERAK arrive?" and not "did it contain ERC segments?", you have built a system that reads bad news as good news.

The four failures APERAK exists to catch

  1. Reference failures. The INVOIC references an order number the buyer never issued, or a DESADV references a shipment the ORDERS never authorised. The document is valid EDIFACT and commercially meaningless.
  2. Catalogue failures. GTINs, buyer item numbers, and unit-of-measure codes that do not exist in the receiver's master data. These spike after every assortment change — the sender updated their catalogue, the receiver did not, or the reverse.
  3. Agreement failures. Prices, tax rates, and payment terms that contradict the contract the messages are supposed to execute. An INVOIC priced 4% above the agreed line price parses perfectly and fails here.
  4. Sequence failures. A second DESADV for the same shipment with different quantities, an INVOIC sent before any DESADV exists, a cancellation referencing a message already acknowledged as processed. Order matters, and APERAK is where disorder gets reported.

Notice what is not on that list: syntax. If your file is malformed, you should get a CONTRL rejection, not an APERAK. Partners who send APERAK for syntax errors — and some do — are telling you their stack collapses the layers, and your error handling has to cope with both dialects.

What to do when one lands

First, stop the line, not the relationship. An APERAK against an ORDERS usually means no order was created downstream. Resending the identical file buys you a second identical APERAK. Fix the referenced data first.

Second, route by error class, not by partner. Catalogue failures go to whoever owns master data; agreement failures go to commercial; reference failures are usually a sequencing bug in your own system. The ERC code is the routing key — build the runbook around it before go-live, not after the first incident.

Third, acknowledge the acknowledgement loop in your monitoring. The healthy pattern is symmetrical: every outbound business message should end in exactly one terminal state — accepted (functional response), rejected with errors (APERAK/CONTRL), or escalated as unacknowledged after an agreed timeout. "Sent and silent" is not a state; it is a debt.

Fourth, keep the APERAK with the original message forever. Audits, disputes, and chargeback defence all turn on being able to show what you sent, what they said about it, and when. A screenshot of a portal is not that record.

Why this obscure message matters more in 2026

As more EDIFACT traffic is generated and translated by software — APIs in front, JSON inside, EDIFACT only at the edge — the syntax layer gets more reliable and the application layer gets less reliable. Machines are excellent at producing well-formed segments carrying stale catalogue data at scale. APERAK is the feedback signal that catches exactly that failure mode, which is why mature programmes monitor its rate the way API teams monitor 4xx rates: a sudden rise is rarely the partner's parser breaking; it is somebody's data drifting.

Build for it accordingly: parse APERAK automatically, surface ERC codes in the same dashboard as your other integration errors, and never let a human discover one by opening a mailbox on Monday morning.


I'm Chris, founder of SignalEDI — we build AI-assisted EDI onboarding where acknowledgement handling (CONTRL, APERAK, 997, 999, 824) is treated as a first-class workflow, not an afterthought, because the errors that cost money almost always arrive as acknowledgements someone ignored. More on how we approach that at signaledi.com.

Next in this series: the EDIFACT RECADV — the receiving advice that closes the loop between what shipped and what actually arrived.

Top comments (1)

Collapse
 
hiredov profile image
Dov at HireDov •

Good breakdown of the layers. One practical point from the buyer side: map APERAK ERC codes to an owner and an SLA, not just a log line. Master-data errors (unknown item code, price mismatch against the agreement) belong to whoever maintains the catalog, while date or reference errors usually belong to whoever creates the order. Routing them differently, and alerting when an order has no ORDRSP or APERAK within a set window, helps catch silent stalls early. Do you see partners that send APERAK for every line error versus one summary message, and does that change how you design retries?