Adding a Data Segment
Creating an EDI document is easy with the EDIDocument component. Simply create an instance of the EDIDocument, set its loops, and call its GenerateFile() procedure. EDIDocument is based on a loop hierarchy. Loops contain segments and other loops. Segments contain elements. Element contains data and composite elements.
Creating a data segment is very simple!
// Instantiate an instance of EDIDocument and set the name of the file to be created
EDIDocument sampleEDIFile = new EDIDocument(“C:\\My837EDIFile.txt”);
// Create an interchange loop. This loop will contain all other loops in the EDI structure
Loop interchangeHeaderLoop = new Loop(“Interchange Header”);
// Create an ISA segment in the interchange loop
DataSegment isa = interchangeHeaderLoop.CreateSegment(“ISA”);
Now add elements with data to the ISA segment