Wednesday, March 14, 2012

Processing EDIFACT documents in Oracle B2B

In my previous blogpost I already showed you how to process custom xml documents in Oracle B2B and pass it to the Oracle SOA Suite. In part two we will try to process an EDIFACT document. This time we need to use the Oracle Document Editor where we change the EDIFACT guideline, analyze the EDI documents against this guideline and do an export which we can import into Oracle B2B.

Here is an example of an EDIFACT document which is used in the dutch energy world (an EDIFACT dialect called EDINE). It is an acknowledgement document called APERAK.

UNA:+,? '
FTX+AAO+++In period 199904112015 199904112030 your changes are not yet approved: because of inconsistency between other PRCs in the given period'

Before we can start we need to have the Message Implementation Guide ( MIG ) of this APERAK message and off course study the general EDIFACT Guidelines which explains the UNA,UNB,UNT and UNZ segments.

First we need to identify the message. For this we need to analyze the UNH segment.


The Message type is APERAK and version pluis release is D96A. These values are important for the Oracle Document Editor, this way we can detect and select the right EDIFACT APERAK definition and register it in Oracle B2B.

Now we can startup the Oracle Document Editor ( this can be downloaded in the Prerequisites & Recommended Install Process of the SOA Suite download on OTN, for EDIFACT we only need B2B Document Editor Part 1 )

Create a new guideline where we open the EDIFACT part and go to D96A node and select the APERAK message

This is the default implementation of the Aperak Message.

Because we are using an EDIFACT dialect we need to study the message implementation guide and change this guideline so it matches with the MIG. Delete Segments , Element Groups , Elements and add your own values in the element standard lists.

When we are finished with the modifying part we can export this guideline. Click on Export ( File menu )  and select Oracle 2.0

Select Show advanced options.

 Provide your own namespace

Suppress Enumeration in XSD

Then finish the export.

Next step is to use the Analyzer so we can test the created guideline on our EDIFACT test message.

Select the test message and select Show Advanced options ( else we can't generate a xml output based on this test message).

Choose From a guideline file and select your created guideline.

Our test message does not contain a functional group segment so choose for Syntax 3 - no functional group.

Oracle Document Editor can also generate a XML output but we need to enable this option.

The guideline and test message does not have any errors so we are ready to use it in Oracle B2B

To see the generated XML based on this test message we can press the XDATA button. This is the XML which can be processed by Oracle SOA Suite.

The next step is to register the APERAK guideline in Oracle B2B. For this we need go to the Administration part of the B2B application.

Go to the Document Tab and create a new version under EDI_EDIFACT. This version should be called D96A.
Also when we look at this line of our test EDIFACT message UNB+UNOC:3+8712423009097:14+8716867999990:14+080928:1347+1001'
Then we should use UNOC as syntax identifier and the version is 3

Also we don't use a functional group and UN is the Controlling Agency.

Create the APERAK Document Type and use FA as Function Group Identifier Code.
When we take a look at the UNH record of the test message we see that UN is our Controlling Agency and EDINE1 is the Transaction Association. UNH+1001+APERAK:D:96A:UN:EDINE1'

Create the APERAK Document Definition and upload the XSD definition and ECS file.

Next step is to add the EDI identifiers to all the involved Parties. This will be used to identify the agreement.
To know your sender or receiver identifications we can look at the UNB record.

Add the EDI Interchange ID and Qualifier identifiers to all the involved Parties.

Create the Aperak agreement between two parties where we add the EDI identifiers and select Validate and Translate options.

Add a listening channel, so B2B will listen for new EDIFACT files.

We should see the APERAK messages in the Business Messages

And at last this is how the translated XML message looks like.


  1. Is B2B automatically generate the APERAK transaction when you receive a inbound transaction.

    1. Hi,

      Only in case of an aperak error and when you registered this definition in B2B. It cannot check your application values.


  2. Hi Edwin;

    Can you lend some related advice, this is about the EDIFACT INVOIC edi message.... To our trading partner we send only one Invoice per transmission. they have asked that we include the Invoice number in the UNB segment. How can you accomplish this in Oracle B2B? We attempted to customize the UNB segment in our BPEL flow however the transmission then included 2 UNB segments. Can we somehow supress the one created by B2B or can we somehow customize one of the values in it? Maybe using JavaScript?

    Thanks in advance for your advice?


    1. Hi,

      you can set the interchange fields in a xlst from soa suite to Oracle B2B , I also do this in this blogpost. Javascript won't on the server side.


  3. I want to ignore the UNB segment values coming from the b2b console.just want to pass the UNB segment values(some hard code values) from XSLT through b2b it possible?.could you please advice me.

    1. Hi,

      Do you mean from a composite and a b2b adapter and what do you want to change.


  4. Hi Edwin,

    I wonder if you could share some architectural advice.
    We are facing the challenge to convert EDIFACT / IFTSTA messages to a custom XML format based on an XSD using OSB only (without SOA Suite).

    Do you see any better way than manually creating an MFL file based on the IFTSTA documentation?
    I guess the Oracle Document Editor isn't much help here, correct?

    thanks for your input!


    1. Hi,

      indeed but a few months ago I used Altova mapforce to create a mapping ( very easy) , generate java code and used this in a OSB java call out. Easy, cheap and fast


  5. Hi Edwin,
    I'm trying to do the below,
    EDI to XML - [EDI850-Inbound PO] &
    XML to EDI - [EDI810- Outbound Invoice]

    did setup 2 trading partners,
    compA(default trading partner) - receives EDI850
    compB(created) - sends EDI810

    This EDI850, its not able transform from EDI to XML. how is this translation takes place?

    please let me know for any samples on x12, v4010, edi850

    thank you,