X12 segment reference
CTT — Transaction Totals
X12 CTT segment: transaction line count used with SE segment integrity checks on 850, 856, and 810 documents.
CTT segment facts
- CTT01 miscounts are a frequent generator bug when lines are filtered or merged after the count is computed.
- 856 documents with HL hierarchy require careful CTT rules — some partners count shipment-level loops, not carton HLs.
- The EDI validator flags CTT/SE mismatches before outbound send.
What the CTT segment does
CTT01 reports the number of line items in the transaction set. Validators compare CTT01 to actual PO1/IT1/HL counts — mismatches trigger 997 rejects.
Loop: Once before SE trailer
Key elements
| Element | Name | Description |
|---|---|---|
| CTT01 | Number of line items | Count of PO1, IT1, or top-level HL loops per partner definition. |
Example CTT segment
CTT*12~
Parse and validate samples with the free EDI validator or send JSON via the JSON→X12 mapping guide.
Common CTT errors
- CTT01 off by one after line cancellation
- Counting nested HL loops incorrectly on 856
Related reference
FAQ
Frequently asked questions
No — CTT counts line items only, not envelope or header segments.