Transaction set guide
EDI 997 Functional Acknowledgement
The 997 is the receipt your trading partner sends back after they parse your transaction. It tells you the syntax was valid, partially valid, or rejected. A successful 997 does not mean the business content was accepted. It only means the syntax parsed.
The 997 segment hierarchy
| Segment | Purpose |
|---|---|
| AK1 | Functional group response header. Identifies the GS being acknowledged. |
| AK2 | Transaction set response header. Identifies the ST being acknowledged. Repeats once per transaction. |
| AK3 | Data segment note. Reports a segment-level error (only present on rejections). |
| AK4 | Data element note. Reports an element-level error inside an AK3-flagged segment. |
| AK5 | Transaction set response trailer. Acceptance code per transaction. |
| AK9 | Functional group response trailer. Acceptance code for the whole group. |
The acceptance codes
AK5 / AK9 acceptance codes
- A — Accepted. Syntax valid.
- E — Accepted with errors. Some segments had problems but the transaction was processed.
- P — Partially accepted. Some transactions in the group succeeded, others didn't (AK9 only).
- R — Rejected. Syntax errors caused the transaction to be discarded.
- M — Rejected, message authentication code failed.
- W — Rejected, assurance failed validity tests.
- X — Rejected, content after decryption could not be analyzed.
AK3 segment-level error codes (common values)
- 1 — Unrecognized segment ID.
- 2 — Unexpected segment.
- 3 — Required segment missing.
- 4 — Loop occurs over maximum times.
- 5 — Segment exceeds maximum use.
- 6 — Segment not in defined transaction set.
- 7 — Segment not in proper sequence.
- 8 — Segment has data element errors (drill into AK4).
AK4 element-level error codes (common values)
- 1 — Required data element missing.
- 2 — Conditional required data element missing.
- 3 — Too many data elements.
- 4 — Data element too short.
- 5 — Data element too long.
- 6 — Invalid character in data element.
- 7 — Invalid code value.
- 8 — Invalid date.
- 9 — Invalid time.
- 10 — Exclusion condition violated.
Reading a rejection 997
AK1*PO*1~ AK2*850*0001~ AK3*REF*5***3~ AK4*1*128*1~ AK5*R*5~ AK9*R*1*1*0~
- AK1 — acknowledging the GS for purchase orders, group control number 1.
- AK2 — acknowledging the 850, transaction control number 0001.
- AK3 — segment
REFat position 5 is the problem; error code 3 = required segment missing. - AK4 — element 1 of REF (the qualifier), reference 128, error code 1 = required element missing.
- AK5 — transaction rejected (R), error code 5 = one or more segments in error.
- AK9 — group rejected (R), 1 transaction included, 1 received, 0 accepted.
Translation: "Your 850 is missing a required REF segment with the right qualifier."
997 vs 999
The 999 is the modern replacement for the 997 in HIPAA and some retail flows. Same idea, more granular error reporting, references implementation guide rules (not just X12 syntax). If your partner accepts 999 and you support it, prefer 999.
What 997 does NOT tell you
- Whether the order will be paid. An accepted 810 (via 997 AK5*A) can still be deducted, short-paid, or charged back.
- Whether the goods will arrive on time. An accepted 856 (via 997 AK5*A) can still be late.
- Whether the buyer agrees with the price. Pricing disagreements happen at AP review, not at 997 parsing.
Reading a 997 in EDI-X12
- Paste the 997 in the validator.
- Click Explain with AI. The AI walks through every AK segment and translates the error codes into a sentence per problem.
Related
- 850 — what you'd typically be acknowledging
- 856 — chargeback risks beyond the 997
- 810 — accepted via 997 doesn't mean paid
- Glossary — AK, segment, element
Got a rejection 997 you can't decipher?
Paste it in. AI translates AK3/AK4 error codes into plain English in seconds.
Open the validator