RequirementsThe general requirement for this utility is to convert one or more XML instance documents, each representing a single logical document, into an X12 transaction set. The transaction sets are bundled into one functional group and interchange. Here's a summary of the required functionality.
Again, in keeping with the basic functionality required in most trading situations, we must go a bit beyond simple file format conversion. Many major EDI users audit the control numbers used in interchanges and functional groups and reject interchanges with duplicate control numbers. Some also check with a trading partner if there is a missing number in a sequence of control numbers. So, we're including minimal support for sequence number generation. Running the UtilityThis section provides instructions for running the XML to X12 utility from the command line. For Java:
or
Note : The -D option for the Java virtual machine defines the BBHOME system property. Replace BBHomeDirectory with the directory path on your system for the Babel Blaster Home directory. The utility uses this path to retrieve the EDIControl.xml file. For C++ on Win32:
or
Note : The BBHOME environment variable must be set to the directory path on your system for the Babel Blaster Home directory. The utility uses this path to retrieve the EDIControl.xml file. As we did in Chapter 5, we're using a system property in Java and an environment variable in C++. Refer back to that chapter for a more detailed discussion of the rationale and how to set environment variables . Options follow the parameters except for the help option, which may be specified by itself. Parameters:
Options:
Since a specific file description document file name is passed to the utility, there are no restrictions on how the file is named. Note : This utility requires that at least the skeleton EDIControl.xml file be present in a directory pointed to by the BBHOME system property in the Java implementation or by the operating system environment variable in the C++ implementation. Restrictions: The restrictions are the same as those specified for the X12 to XML utility, plus the following.
Sample Input and Output: 810 InvoiceBig Daddy's big customers who are sending orders by X12 EDI also want the invoices to be sent to them by X12 EDI. Big Daddy doesn't want to pay the $25 to $100 penalty for each invoice those customers have to process manually. So, Big Daddy needs to create X12 810 Invoices from his system. Table 9.2 shows a summary of a typical 810 implementation. Note : The Segment Group column is empty if the segment is not part of a segment group. Table 9.2. Sample X12 810 Invoice Implementation Guide
As with the sample implementation guide for our 850 Purchase Order, only the N1 segment is transmitted; there isn't a full N1 loop. Like the PO1 segment, the IT1 segment has only a single product code. Though you would think that major buyers could get by with just one product identifier, I have seen some implementation guides that require three. In addition to a standard UPC code they require their own internal identifier and their vendor's catalog identifier. Sellers don't have much choice but to comply if they want to keep the business. Here are two invoice instance documents that correspond to the 810 Invoice. As noted earlier I use a naming convention based on segment ID and data element position. You may choose whatever Element names you like. Sample Input (X12Invoice01.xml)<?xml version="1.0" encoding="UTF-8"?> <X12Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="X12Invoice.xsd"> <BIG> <BIG01>2003-01-27</BIG01> <BIG02>2003030</BIG02> <BIG04>4497-0561</BIG04> </BIG> <N1Header> <N1> <N101>ST</N101> <N102>BIG BOX - STORE #97</N102> <N103>92</N103> <N104>001234567S097</N104> </N1> </N1Header> <N1Header> <N1> <N101>RE</N101> <N102>BIG DADDY'S GOURMET COCOA</N102> <N103>9</N103> <N104>987651234</N104> </N1> </N1Header> <ITD> <ITD01>01</ITD01> <ITD03>5</ITD03> <ITD04>2003-02-27</ITD04> <ITD05>30</ITD05> <ITD06>2003-02-27</ITD06> <ITD07>31</ITD07> </ITD> <IT1Group> <IT1> <IT101>1</IT101> <IT102>10</IT102> <IT103>CA</IT103> <IT104>30.36</IT104> <IT106>UP</IT106> <IT107>35790000122</IT107> </IT1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Mint flavor</PID05> </PID> </IT1Group> <IT1Group> <IT1> <IT101>2</IT101> <IT102>30</IT102> <IT103>CA</IT103> <IT104>31.08</IT104> <IT106>UP</IT106> <IT107>35790000724</IT107> </IT1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Vanilla flavor</PID05> </PID> </IT1Group> <TDS> <TDS01>1236.00</TDS01> </TDS> <CTT> <CTT01>2</CTT01> </CTT> </X12Invoice> Sample Input (X12Invoice02.xml)<?xml version="1.0" encoding="UTF-8"?> <X12Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="X12Invoice.xsd"> <BIG> <BIG01>2003-01-27</BIG01> <BIG02>2003030</BIG02> <BIG04>4445-0323</BIG04> </BIG> <N1Header> <N1> <N101>ST</N101> <N102>BIG BOX - STORE #45</N102> <N103>92</N103> <N104>001234567S045</N104> </N1> </N1Header> <N1Header> <N1> <N101>RE</N101> <N102>BIG DADDY'S GOURMET COCOA</N102> <N103>9</N103> <N104>987651234</N104> </N1> </N1Header> <ITD> <ITD01>01</ITD01> <ITD03>5</ITD03> <ITD04>2003-02-27</ITD04> <ITD05>30</ITD05> <ITD06>2003-02-27</ITD06> <ITD07>31</ITD07> </ITD> <IT1Group> <IT1> <IT101>1</IT101> <IT102>20</IT102> <IT103>CA</IT103> <IT104>30.36</IT104> <IT106>UP</IT106> <IT107>35790000122</IT107> </IT1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Mint flavor</PID05> </PID> </IT1Group> <IT1Group> <IT1> <IT101>2</IT101> <IT102>40</IT102> <IT103>CA</IT103> <IT104>31.08</IT104> <IT106>UP</IT106> <IT107>35790000641</IT107> </IT1> <PID> <PID01>F</PID01> <PID05> Instant Hot Cocoa Mix - Dutch Chocolate flavor </PID05> </PID> </IT1Group> <TDS> <TDS01>1850.40</TDS01> </TDS> <CTT> <CTT01>2</CTT01> </CTT> </X12Invoice> Here is the resulting interchange. Sample Output (Invoices.X12)ISA*00* *00* *12*9727839573 *ZZ* BIGBOX *030125*1058*U*00401*000000006*0*P*~ GS*IN*9727839573*BIGBOX*X*20030125*1058*6*004010~ ST*810*0001~ BIG*20030127*2003030**4497-0561~ N1*ST*BIG BOX - STORE #97*92*001234567S097~ N1*RE*BIG DADDY'S GOURMET COCOA*9*987651234~ ITD*01**5*20030227*30*20030227*31~ IT1*1*10*CA*30.36**UP*35790000122~ PID*F****Instant Hot Cocoa Mix - Mint flavor~ IT1*2*30*CA*31.08**UP*35790000724~ PID*F****Instant Hot Cocoa Mix - Vanilla flavor~ TDS*123600~ CTT*2~ SE*12*0001~ ST*810*0002~ BIG*20030127*2003030**2003-01-23~ N1*ST*BIG BOX - STORE #45*92*001234567S045~ N1*RE*BIG DADDY'S GOURMET COCOA*9*987651234~ ITD*01**5*20030227*30*20030227*31~ IT1*1*20*CA*30.36**UP*35790000122~ PID*F****Instant Hot Cocoa Mix - Mint flavor~ IT1*2*40*CA*31.08**UP*35790000641~ PID*F****Instant Hot Cocoa Mix - Dutch Chocolate flavor~ TDS*185040~ CTT*2~ SE*12*0002~ GE*2*6~ IEA*1*000000006~ Again, the line breaks (and indentation on the continuation of the ISA segment) would not appear in actual usage and are included only to improve readability. |