Life Cycle of a Purchase Order: EDI X12, XML and PDF

 

Most of the business transactions B to C (Business to Consumer) today are done by credit card over the web. On the B to B (Business to Business) the volume and the velocity require a different approach, where computer systems do most of the work. These systems are called supply chain networks and their job is to connect buyers and sellers electronically to exchange goods of any kind.

Supply chain networks have existed for many years but were difficult and costly to integrate, which restricted their market to the elite. Their inability to accept medium and small businesses forced a large portion of the supply chain networks out of business.

The survivors learned the lesson and started to offer a scaled down version of their services, increasing the size of their customer base. The larger the network, the greater the chance of success, especially in growing markets such as China and India.

Computer hardware evolves at a fast pace, as Moore’s law states: every two years CPU makers double the number of transistors in a silicon die, improving the lithography process. While IT organizations tend to upgrade their servers every 3 years, data architects are slow to move from time-tested successful standards.  These standards provide the back bone of systems’ interoperability.

One of greatest examples of successful standards for data interchange format is Electronic Data Interchange (EDI), created by the National Institute of Standards and Technology (NIST) in 1996.  EDI’s goals were simple: a text based format with a well-defined structure, which allows two entities to exchange information.

The beginning of the formal definition reads: <<”the computer-to-computer interchange of strictly formatted messages that represent documents other than monetary instruments.”>>.

EDI was an instant hit. A variety of standard bodies specialized in industry verticals creating their own dialects. Here are a few examples: 

·         Accredited Standards Committee X12

·         United Nations/Electronic Data Interchange For Administration, Commerce and Transport (UN/EDIFACT)

·         Health Insurance Portability and Accountability Act of 1996 (HIPAA).

EDI is the legacy format that supply chain systems still use today.  Industry specific EDI dialects perform millions of transactions per day.  EDI standards boards have also come out with an XML version of the dialects but the legacy format is still the de-facto standard.

Now in order to participate in these  markets, you have to understand how to interpret EDI transactions, and how to respond to a partner.  Walmart uses EDI to allow it to scale its business, requiring all suppliers to interact with them using EDI to send documents such as Purchase Orders and Invoices. http://www.walmartstores.com/Suppliers/248.aspx

Before we start, let’s refresh our memory on  the definition of a Purchase Order. Wikipedia states:
<<”A purchase order (PO) is a commercial document issued by a buyer to a seller, indicating types, quantities, and agreed prices for products or services the seller will provide to the buyer.”>>

In the following image we see a Purchase Order formatted according to EDI X12 850 in its raw form.

Company “Office Supply” wants to purchase digital pens and appropriate paper blocks from company “Smart Pen” and deliver the products to company “OfficeY”.

Unfortunately, this is not like XML.  You may guess that fields are separated by a special character but there is no markup around them, therefore is very difficult to interpret the values. In the following image we see the same EDI transaction in the Stylus Studio EDI to XML Module.  This is a very useful tool for analyzing EDI documents. We can click anywhere and Stylus Studio shows us which field we are on, thanks to its vast EDI repository. When we right click on a value that represents a code, we can see the description.

Now that the purchase order is in XML we can take advantage of several technologies to manipulate and to store the data.

The EDI to XML module can be used to validate both the structure and the code list values. If errors should occur, it provides suggestions to work around the problem. For example, it’s quite common to encounter a transaction in which some mandatory fields are missing or the field type does not match the specification. In these situations Stylus Studio flags the error and allows the user to overwrite the field definition to accommodate such customizations.

In Stylus Studio, almost any format can be represented as XML. In the screenshot below the XML Editor is used to edit our purchase order.

The XML representation can be customized with a variety of parameters. You may decide to generate a very verbose form with long element names. You may also use informative comments that provide a detailed description for each field. When looking at code values in the raw form, they are usually very cryptic terms made of a few characters, which can now be associated with detailed descriptions.  The example below shows you that the code value BP stands for “Paid by Buyer”.

 

When an EDI transaction comes in, the first thing we want to do is to archive it in a database. Often there are regulations that require electronic copies to be maintained for several years and storing the transaction in a relation database is the most common place where it can be archived. The following screenshot shows how the Stylus Studio XQuery mapping tool can help you to onboard the transaction into a database. In our example we are using Microsoft SQL Server 2008.

We would like to point out a benefit of using the DataDirect XQuery engine, bundled with Stylus Studio. This combination allows you to store primitive types such as the order id and the order date as well as the entire input document into an XML type column.

 

After the XQuery execution we can see a new record has been created in the table.

EDI and XML share similar benefits. They are great for making computer systems communicate, but human beings need some help to make this information easy to interpret. The following screenshot shows how Stylus Studio XML Publisher can be used to produce an appealing PDF document that can be used to display on the screen and on printed paper.

 

We hope you enjoyed reading this article. If you have any questions, do not hesitate to contact us.

You can download the Project Zip file by clicking here.

- Stylus Studio Team

 Technical Support
 Follow us on Twitter
 Connect on Facebook  

PURCHASE STYLUS STUDIO ONLINE TODAY!!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Try Stylus Powerful XQuery IDE

Download a free trial of our award-winning IDE for XQuery today!

What's New for Stylus Studio® X16?

New XQuery & Web Services Tools, Support for MySQL, PostgreSQL, HL7 EDI, Microsoft .NET Code Generation and much more!

Ask Someone You Know

Does your company use Stylus Studio? Do your competitors? Engineers from over 100,000 leading companies use Stylus Studio, and now you can ask someone from your own organization about their experiences using Stylus Studio.

Top Ten XQuery Trends

Read about the top 10 XQuery Trends and how they will impact change the way enterprise software applications are built.

 
Free Stylus Studio XML Training:
W3C Member