EDI Enveloping Part Four (The ST)
The 3rd layer of the EDI envelope is the ST segment. The ST segment contains a Document Identifier, and a control number. The ST and its partner the SE segment define the beginning and ending of the Document. The SE segment contains a counter of segments within the document, and the corresponding control number to the ST. Relatively simple compared to the ISA and the GS.
Document Identifier
The document Identifier is not encoded. That is to say, for an 850 the ST document ID is “850″. For an 810, the Document Identifier is “810″ and so on. Thus if you open an EDI file, and don’t recognize the GS_01, skip to the ST_01 and it will tell you what standard you will need to find to read this document.
Good form would dictate that the GS_01 and the ST_01 would specify the same type of document. The GS would specify it on a functional level, and the ST on the standard level. Thus they would not be identical strings but would indeed convey the same message about what the document(s) would be. Some EDI translator or processing software will validate this relationship and some may not. But in the end consistency is the best policy.
Control Number
The control number is different for the ST than we saw in both the ISA and GS. The ST_02 is a 3 to 9 digit number. This means that it will start with 001 not 000000001. Of course you can still use a 000000001 but don’t be surprised when you see less than 9 digits in the ST-SE control number. Whichever you chose, you must do the same for both the ST and SE.
(Using 000 or 000000000 may be allowed, but is not recommended as any application that trims the zeroes will get an empty string and produce an error. Be nice and only use values greater than zero.)
Segment Counter
The SE segment counter is the part of the ST-SE that gives people hand editing an EDI document the most trouble. If the counter is inaccurate it indicates that the document is corrupted. This should fail in all good translators as processing a corrupt EDI file is saying, “Its okay if we get bad data.” This counter represents the number of segment between the ST and before the SE.
And it is just that simple. Remember that you can have more than one GS-GE envelope inside an ISA-IEA, and you can have more than one ST-SE inside a GS-GE, but you can only have one document of one type in side a ST-SE envelope.
–
For an overview of Enveloping go here.
Looking for the ISA enveloping page?
Looking for the GS enveloping page?
Looking for something else relating to EDI? Check out the EDI Primer post
Subscribe to "The Integration Engineer" by Email
Find out about the tools and services available at The Integration Engineer's Consulting site.












December 21st, 2009 at 10:54 am
[...] Looking for the ST enveloping page? [...]