Missing mandatory segment in EDI file. Segment <segment id> is expected but segment <segment id> is encountered.
Description
A mandatory segment is missing at the required position as defined by the implementation guideline. A segment reference in a transaction set/message defined as "MANDATORY" for its standard requirement, and/or "MUST USE" for its user requirement must be present at the corresponding position in the document.
For example, consider the following ASC/X12 implementation guideline (simplified):
TAG Name Req. Max Use Repeat
ST - Transaction Set Header ------------------- M 1 ----------------+
BEG - Beginning Segment For Purchase Order M 1 |
PER - Administrative Communications Contact O 3 |
FOB - F.O.B Related Instructions O >1 |
N1 - Name ------------------------------------- O 1 ----- 200 --+ |
N3 - Address Information O 2 | |
N4 - Geographic Location O 2 | |
----------------------------------------------------------------------+--+
The segment references ST and BEG are mandatory because their standard requirement is "M" (Mandatory). Now consider the following document processed by the guideline.
ST*850*24001
PER*OC**FX*8009909999 <<< ----- Expecting BEG in this position.
FOB*PP
N1!BY!ABC INC.
N3*555 N. Figueroa Street
N4*Los Angeles*CA*90012
Because BEG is mandatory as defined by the implementation guideline, it is expected at the position immediately following the ST in the document. Instead we encounter the data segment PER, which is actually the segment following BEG according to the guideline. Thus the document generates the following error.
"Missing mandatory segment in EDI file. Segment BEG is expected but segment PER is encountered."