Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a really simple way to process EDIFACT for example D96A?

Tags:

edifact

We are a modern company using modern technology like XML interfaces, but many of our customers want for example electronic invoices from us in an EDIFACT format like D96A.

No we cannot use already existing libraries, as they are not written in the C/AL programming language our Navision software uses.

So in order to parse it in C/AL I need to understand its specification. But it looks extremely difficult and complicated.

So can someone give me an overview how to interpret say D96A and how to parse it?

like image 900
user1315373 Avatar asked Jul 02 '12 14:07

user1315373


People also ask

What is EDIFACT d96a?

A message claiming payment for goods or services supplied under conditions agreed between the seller and the buyer. The United Nations Standard Invoice Message, with correct data qualification, serves also as the specification for Debit Note and Credit Note messages.

What is EDIFACT format?

XML/EDIFACT is an Electronic Data Interchange (EDI) format used in Business-to-business transactions. It allows EDIFACT message types to be used by XML systems. EDIFACT is a formal machine-readable description of electronic business documents. It uses a syntax close to delimiter separated files.

Is EDIFACT EDI?

EDIFACT stands for Electronic Data Interchange For Administration, Commerce and Transport. EDIFACT is accepted as the international EDI standard that has been adopted by organisations wishing to trade in a global context. A standard set of syntax rules have been ratified by the United Nations.

Between which segments actual business message is placed in EDIFACT?

The message is a summary of all EDIFACT segments that are required to represent a business transaction, such as an invoice. The message is identified by the specifications in the message header segment (UNH). It is closed with the message end segment (UNT).


2 Answers

Parsing EDIFACT is actually not that complicated. Just split at the sytax chars: first at ' to get the segments, than at + to get data elements of that segments and at : to get the individual components. You need to take care of escaped seperator chars, of course. The chars used here are only the default, they can be changed at the beginning of the message by the optional UNA-segment. Actually the wikipedia article on EDIFACT gives a pretty good (but brief) introduction to that. And the format is documented with detail on the UN's UNECE site (yes, that's a lot and hard to read).

The tricky part is to get the information out of that and into your application (and verifying it's valid, leave alone creating good error messages). If you really plan to write a comlete parser out of nothing for all that in any language, then: No, there is no easy way to do this. Nor is there for any other flexible data representation. That is a difficult task and always will be.

But here's an idea: if you are into XML that much (or any other "modern technology" as you like to call it...). It would be a relatively easy task to write some program that converts EDIFACT messages into some unified XML-EDIFACT-Format (which is a pretty horrible thing and would most likely freak me out). You can convert every EDIFACT segment into one XML tag, maybe like this:

ERC+A7V:1:AMD'
IFT+3+NO MORE FLIGHTS'

In XML:

<segment qualifier="ERC">
    <element>
        <component>A7V</component>
        <component>1</component>
        <component>AMD<component>
    </element>
</segment>
<segment qualifier="IFT">
   <element>
       <component>3</component>
   </element>
   <element>
       <component>NO MORE FLIGHTS</component>
   </element>
</segment>

Then you can unleash the power of your XML tools and libraries on it to validate/evaluate it.

You could also do it more specific, like this:

<segment_ERC>
    <element>
        <component>A7V</component>
        <component>1</component>
        <component>AMD<component>
    </element>
</segment_ERC>
<segment_IFT>
   <element>
       <component>3</component>
   </element>
   <element>
       <component>NO MORE FLIGHTS</component>
   </element>
</segment_IFT>

This could make validation via XSD easier. You can get of course as specific as you want with this conversation, but you would sooner or later come to a point, where you would need to put information on the structure of your currently parsed message into the converter (since it is not trivial to know which segments are nested into other segments grouping them. There's not just UNG, UNH and such, but also some segment groups that you don't see directly).

Still, you will have to create specific evaluation programs/schemas/whatevers for the messages you receive, according to the EDIFACT-handbooks you should get as documentation.

like image 85
kratenko Avatar answered Sep 27 '22 19:09

kratenko


I suggest searching and perusing through GitHub or SourceForge repos. A quick search with keywords: +EDIFACT +D96A provided several libraries to choose from. In fact this looks promising for your case:

  • Bots open source edi translator, http://sourceforge.net/projects/bots/. Project's description says it's a complete translator for EDI (Electronic Data Interchange).

You could always evaluate and check out Oracle B2B 11g which is part of Oracle SOA Suite 11gR1: - http://www.oracle.com/technetwork/middleware/soasuite/downloads/downloads-085394.html#11g. It has UN/EDIFACT OTD library which I guess you could use at least for parsing.

Generally your best bet is to pick up existing library and either port it to NAV or use through external interface where data flows into your NAV database. If you're able to call .NET code then a plethora of existing libraries should exist and simply by referencing assembly gets you there. As it I'm not familiar with NAV development but using some sort of REST/JSON whatever your data transfer object calling mechanism is should be possible - where your component B does the heavy job and your NAV component pulls parsed UN/EDIFACT messages through your XML interface.

There was another similar question and couple answers as well that could suit you as well: Is there any good open source EDIFACT parser in Java?.

edifact navision x12 xml edi d96a

Cheers!

like image 36
Slideep Avatar answered Sep 27 '22 19:09

Slideep