X12 segment reference
SE — Transaction Set Trailer
X12 SE segment closes each transaction set: segment count and ST control number echo for integrity checks.
SE segment facts
- SE01 segment counts must include both ST and SE — off-by-one errors are a frequent outbound generator defect.
- SE02 must exactly match ST02 or 997 acknowledgements cannot correlate to the intended transaction set.
- The EDI validator tool flags SE mismatches before documents leave your sandbox.
What the SE segment does
SE ends each ST..SE envelope. SE01 counts segments including ST and SE; SE02 must match ST02.
Loop: Once per transaction set
Key elements
| Element | Name | Description |
|---|---|---|
| SE01 | Number of included segments | Includes ST and SE; miscounts break 997 validation. |
| SE02 | Transaction set control number | Must equal ST02. |
Example SE segment
SE*42*0001~
Parse and validate samples with the free EDI validator or send JSON via the JSON→X12 mapping guide.
Related reference
FAQ
Frequently asked questions
Partners and validators reject interchanges when SE01 does not match actual segment counts — a common generator bug.