LS Loop Header

To indicate that the next segment begins a loop

Position
Element
Name
Type
Requirement
Min
Max
Repeat
LS01
Loop Identifier Code
Identifier (ID)
Mandatory
1
4
-
Code identifying a loop within the transaction set which is bounded by the related LS and LE segments (corresponding LS and LE segments must have the same value for loop identifier). (Note: The loop ID number given on the transaction set diagram is recommended as the value for this data element in segments LS and LE.)
LS is a control segment. LS is always used in conjunction with a corresponding loop trailer (end) - LE, as illustrated below. The LS and LE indicate the start and end of a loop but are not part of the iteration of the loop. LOOP NESTING Loop "A" Header (LS "A") Loop "B" Header (LS "B") Loop "C" Header (LS "C") Loop "C" Trailer (LE "C") Loop "D" Header (LS "D") Loop "D" Trailer (LE "D") Loop "B" Trailer (LE "B") Loop "A" Trailer (LE "A") Neither LS nor LE is used if the data within the loop is not used.
One loop may be nested (contained) within another loop, provided the inner (nested) loop terminates before the outer loop. When specified by the standard setting body as ``mandatory'', this segment in combination with ``LE'', must be used. It is not to be used if not specifically set forth for use. The loop identifier in the loop header and trailer must be identical. The preferred value for the identifier is the segment ID of the required loop beginning segment.

Figures Appendix

Following is a figure detailing the use of the LS and LE segments in conjunction.

LS is a control segment. LS is always used in conjunction with a corresponding loop trailer (end) - LE, as illustrated below. The LS and LE indicate the start and end of a loop but are not part of the iteration of the loop.

LOOP NESTING

Loop "A" Header (LS "A")
            Loop "B" Header (LS "B")
                        Loop "C" Header (LS "C")
                        Loop "C" Trailer (LE "C")
                        Loop "D" Header (LS "D")
                        Loop "D" Trailer (LE "D")
            Loop "B" Trailer (LE "B")
Loop "A" Trailer (LE "A")

Neither LS nor LE is used if the data within the loop is not used.

Stedi is a registered trademark of Stedi, Inc. Stedi's EDI Reference is provided for marketing purposes and is free of charge. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.