DevToolCase
Sign in Sign in

EDIFACT APERAK: the application acknowledgement message

The EDIFACT APERAK message: how a recipient confirms or rejects a message it processed, its error codes, segments and an annotated D96A example.

Where APERAK fits in the exchanges

What is the APERAK message for?

APERAK answers a message once the recipient’s application has processed it: accepted, or rejected because of business errors (an unknown GLN or GTIN, a wrong price, an order already received…). It can answer any message: an order, a despatch advice, an invoice…

Do not confuse it with CONTRL, the syntax acknowledgement, which only says whether the interchange could be read. APERAK refers to the message answered (RFF), then lists the errors (ERC), each with a text (FTX) and the reference of the line concerned. D.96A has no document code for it: code 305 (application error and acknowledgement) only came with later directories, such as D.01B.

Sender: Recipient. Recipient: Sender.

Structure of the APERAK message

Its main segments, in the order of the D.96A directory. M means mandatory and C conditional, followed by the maximum number of repetitions; for the first segment of a segment group (SG), they apply to the whole group. Rarely used segments are left out.

SegmentGroupStatusWhat it carries
UNH Message header—M 1Message header: the message reference and its type, APERAK:D:96A:UN.
BGM Beginning of message—M 1Acknowledgement number, and what it says: accepted or not accepted.
DTM Date/time/period—C 9Date of the acknowledgement.
FTX Free text—C 9Free text about the whole message.
CNT Control total—C 9Control totals.
RFF ReferenceSG1C 9The message answered: its reference.
DTM Date/time/periodSG1C 9Date of that message.
NAD Name and addressSG2C 9Parties: sender and recipient.
ERC Application error informationSG3C 999An error, by its code.
FTX Free textSG3C 1The error, explained in words.
RFF ReferenceSG3 › SG4C 1Where the error is: the reference of the line concerned.
UNT Message trailer—M 1Message trailer: number of segments and message reference.

Codes worth knowing

SegmentData elementCodeMeaning
BGM122527Not accepted: the message is rejected
BGM122529Accepted without amendment
RFF1153ACWReference of the previous message: the one answered
RFF1153LILine item reference number
DTM2005171Reference date: date of the message answered
NAD3035MSSender of the acknowledgement
NAD3035MRMessage recipient
FTX4451AAOError description (free text)

Example of APERAK message

UNA:+.? '
UNB+UNOC:3+5412345000013:14+8712345000011:14+261128:1105+APK0001'
UNH+1+APERAK:D:96A:UN'
BGM++APK0001+27'
DTM+137:202611281105:203'
RFF+ACW:INV2026001'
DTM+171:20261128:102'
NAD+MS+5412345000013::9'
NAD+MR+8712345000011::9'
ERC+12'
FTX+AAO+++Unknown VAT number for the buyer'
UNT+10+1'
UNZ+1+APK0001'
Convert it to JSON

The example, segment by segment

SegmentMeaning
BGM++APK0001+27Acknowledgement APK0001, without a document code (none exists in D.96A): the message answered is not accepted (27).
RFF+ACW:INV2026001The message answered: invoice INV2026001…
DTM+171:20261128:102…dated 28 November 2026.
ERC+12The error, as a code of the list agreed with the partner.
FTX+AAO+++Unknown VAT number for the buyerThe same error in words (AAO, error description).
UNT+10+1End of the message: the number of segments from UNH to UNT included, then the reference given in UNH.

Related messages

In the ANSI X12 standard, used mostly in North America, the equivalent of APERAK is the 824 transaction set (Application Advice), which you can read with the X12 viewer.

Add this browser’s favorites to your account?

This browser has 0 favorites that your account does not have:

Either way, this browser keeps its favorites: you find them again after signing out.