clear * CREATES EDI DOCUMENT OBJECT oEdiDoc = createobject("fredi.ediDocument") * THIS MAKES CERTAIN THAT FREDI ONLY USES THE SEF FILE PROVIDED, AND THAT IT DOES * NOT USE ITS BUILT-IN STANDARD REFERENCE TABLE TO GENERATE THE EDI FILE. oSchemas = oEdiDoc.GetSchemas oSchemas.EnableStandardReference = .F. * ENABLES FORWARD WRITE, AND INCREASES BUFFER I/O TO IMPROVE PERFORMANCE oEdiDoc.CursorType = 2 oEdiDoc.Property(1002) = 200 * SET TERMINATORS oEdiDoc.SegmentTerminator = "~{13:10}" oEdiDoc.ElementTerminator = "*" oEdiDoc.CompositeTerminator = ">" * LOADS SEF FILE oSchema = oEdiDoc.LoadSchema("211_003070.SEF", 0) * CREATES THE ISA SEGMENT oInterchange = oEdiDoc.CreateInterchange("X","003070") oSegment = oInterchange.GetDataSegmentHeader oSegment.DataElementValue(1) = "00" && Authorization Information Qualifier oSegment.DataElementValue(2) = " " && Authorization Information oSegment.DataElementValue(3) = "00" && Security Information Qualifier oSegment.DataElementValue(4) = " " && Security Information oSegment.DataElementValue(5) = "ZZ" && Interchange ID Qualifier oSegment.DataElementValue(6) = "AABB " && Interchange Sender ID oSegment.DataElementValue(7) = "01" && Interchange ID Qualifier oSegment.DataElementValue(8) = "112233445 " && Interchange Receiver ID oSegment.DataElementValue(9) = "080304" && Interchange Date oSegment.DataElementValue(10) = "1116" && Interchange Time oSegment.DataElementValue(11) = "U" && Interchange Control Standards Identifier oSegment.DataElementValue(12) = "00307" && Interchange Control Version Number oSegment.DataElementValue(13) = "000017859" && Interchange Control Number oSegment.DataElementValue(14) = "0" && Acknowledgment Requested oSegment.DataElementValue(15) = "P" && Usage Indicator oSegment.DataElementValue(16) = ">" && Component Element Separator * CREATES THE GS SEGMENT oGroup = oInterchange.CreateGroup("003070") oSegment = oGroup.GetDataSegmentHeader oSegment.DataElementValue(1) = "BL" && Functional Identifier Code oSegment.DataElementValue(2) = "AABB" && Application Sender's Code oSegment.DataElementValue(3) = "112233445" && Application Receiver's Code oSegment.DataElementValue(4) = "080304" && Date oSegment.DataElementValue(5) = "1116" && Time oSegment.DataElementValue(6) = "1" && Group Control Number oSegment.DataElementValue(7) = "X" && Responsible Agency Code oSegment.DataElementValue(8) = "003070" && Version / Release / Industry Identifier Code * CREATES THE ST SEGMENT oTransactionset = oGroup.CreateTransactionSet("211") oSegment = oTransactionset.GetDataSegmentHeader oSegment.DataElementValue(1) = "211" && Transaction Set Identifier Code oSegment.DataElementValue(2) = "000010001" && Transaction Set Control Number * BOL - BEGINNING SEGMENT FOR THE MOTOR CARRIER BILL OF LADING oSegment = oTransactionset.CreateDataSegment("BOL") oSegment.DataElementValue(1) = "SCAC" && Standard Carrier Alpha Code oSegment.DataElementValue(2) = "PP" && Shipment Method of Payment oSegment.DataElementValue(3) = "12345" && Shipment Identification Number oSegment.DataElementValue(4) = "990501" && Date oSegment.DataElementValue(6) = "1231234561" && Reference Identification * B2A - SET PURPOSE oSegment = oTransactionset.CreateDataSegment("B2A") oSegment.DataElementValue(1) = "00" && Transaction Set Purpose Code * MS2 - EQUIPMENT OR CONTAINER OWNER AND TYPE oSegment = oTransactionset.CreateDataSegment("MS2") oSegment.DataElementValue(1) = "SCAC" && Standard Carrier Alpha Code oSegment.DataElementValue(2) = "123456" && Equipment Number * N1 - NAME oSegment = oTransactionset.CreateDataSegment("N1\N1") oSegment.DataElementValue(1) = "SH" && Entity Identifier Code oSegment.DataElementValue(2) = "SHIPPER NAME" && Name oSegment.DataElementValue(3) = "93" && Identification Code Qualifier oSegment.DataElementValue(4) = "123456789" && Identification Code * N3 - ADDRESS INFORMATION oSegment = oTransactionset.CreateDataSegment("N1\N3") oSegment.DataElementValue(1) = "9999 SHIPPER STREET" && Address Information oSegment.DataElementValue(2) = "ADDITIONAL ADDRESS LINE" && Address Information * N4 - GEOGRAPHIC LOCATION oSegment = oTransactionset.CreateDataSegment("N1\N4") oSegment.DataElementValue(1) = "SHIPPER CITY" && City Name oSegment.DataElementValue(2) = "ST" && State or Province Code oSegment.DataElementValue(3) = "00000" && Postal Code * N1 - NAME oSegment = oTransactionset.CreateDataSegment("N1(2)\N1") oSegment.DataElementValue(1) = "CN" && Entity Identifier Code oSegment.DataElementValue(2) = "CONSIGNEE NAME" && Name * N3 - ADDRESS INFORMATION oSegment = oTransactionset.CreateDataSegment("N1(2)\N3") oSegment.DataElementValue(1) = "9999 CONSIGNEE STREET" && Address Information oSegment.DataElementValue(2) = "ADDITIONAL ADDRESS LINE" && Address Information * N4 - GEOGRAPHIC LOCATION oSegment = oTransactionset.CreateDataSegment("N1(2)\N4") oSegment.DataElementValue(1) = "CONSIGNEE CITY" && City Name oSegment.DataElementValue(2) = "ST" && State or Province Code oSegment.DataElementValue(3) = "99999" && Postal Code * G61 - CONTACT oSegment = oTransactionset.CreateDataSegment("N1(2)\G61") oSegment.DataElementValue(1) = "DC" && Contact Function Code oSegment.DataElementValue(2) = "DELIVERY CONTACT NAME" && Name oSegment.DataElementValue(3) = "TE" && Communication Number Qualifier oSegment.DataElementValue(4) = "5559999999" && Communication Number * AT1 - BILL OF LADING LINE ITEM NUMBER oSegment = oTransactionset.CreateDataSegment("AT1\AT1") oSegment.DataElementValue(1) = "1" && Lading Line Item Number * L11 - BUSINESS INSTRUCTIONS AND REFERENCE NUMBER oSegment = oTransactionset.CreateDataSegment("AT1\L11") oSegment.DataElementValue(1) = "999" && Reference Identification oSegment.DataElementValue(2) = "AE" && Reference Identification Qualifier * AT4 - BILL OF LADING DESCRIPTION oSegment = oTransactionset.CreateDataSegment("AT1\AT4") oSegment.DataElementValue(1) = "COMMODITY 1" && Lading Description * AT2 - BILL OF LADING LINE ITEM DETAIL oSegment = oTransactionset.CreateDataSegment("AT1\AT2\AT2") oSegment.DataElementValue(1) = "5" && Lading Quantity oSegment.DataElementValue(2) = "CTN" && Packaging Form Code oSegment.DataElementValue(3) = "N" && Weight Qualifier oSegment.DataElementValue(4) = "L" && Weight Unit Code oSegment.DataElementValue(5) = "210" && Weight oSegment.DataElementValue(9) = "999999-01" && Commodity Code * MAN - MARKS AND NUMBERS oSegment = oTransactionset.CreateDataSegment("AT1\AT2\MAN") oSegment.DataElementValue(1) = "GM" && Marks and Numbers Qualifier oSegment.DataElementValue(2) = "00000858050113093100" && Marks and Numbers * MAN - MARKS AND NUMBERS oSegment = oTransactionset.CreateDataSegment("AT1\AT2\MAN(2)") oSegment.DataElementValue(1) = "GM" && Marks and Numbers Qualifier oSegment.DataElementValue(2) = "00000858050113093101" && Marks and Numbers * MAN - MARKS AND NUMBERS oSegment = oTransactionset.CreateDataSegment("AT1\AT2\MAN(3)") oSegment.DataElementValue(1) = "GM" && Marks and Numbers Qualifier oSegment.DataElementValue(2) = "00000858050113093102" && Marks and Numbers * MAN - MARKS AND NUMBERS oSegment = oTransactionset.CreateDataSegment("AT1\AT2\MAN(4)") oSegment.DataElementValue(1) = "GM" && Marks and Numbers Qualifier oSegment.DataElementValue(2) = "00000858050113093103" && Marks and Numbers * MAN - MARKS AND NUMBERS oSegment = oTransactionset.CreateDataSegment("AT1\AT2\MAN(5)") oSegment.DataElementValue(1) = "GM" && Marks and Numbers Qualifier oSegment.DataElementValue(2) = "00000858050113093104" && Marks and Numbers * SPO - SHIPMENT PURCHASE ORDER DETAIL oSegment = oTransactionset.CreateDataSegment("AT1\AT2\SPO") oSegment.DataElementValue(1) = "PO123567" && Purchase Order Number oSegment.DataElementValue(2) = "RF1144" && Reference Identification oSegment.DataElementValue(3) = "CP" && Unit or Basis for Measurement Code oSegment.DataElementValue(4) = "12" && Quantity * SPO - SHIPMENT PURCHASE ORDER DETAIL oSegment = oTransactionset.CreateDataSegment("AT1\AT2\SPO(2)") oSegment.DataElementValue(1) = "PO456789" && Purchase Order Number oSegment.DataElementValue(2) = "RF1144" && Reference Identification oSegment.DataElementValue(3) = "CP" && Unit or Basis for Measurement Code oSegment.DataElementValue(4) = "15" && Quantity * TRAILING SEGMENTS ARE AUTOMATICALLY CREATED * DISPLAY EDI STRING ? oEdiDoc.GetEdiString() * SAVE THE EDI DOCUMENT OBJECT INTO AN EDI FILE. oEdiDoc.Save("211Output.X12",0) ? ? "Done"