Pages

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:+,? '
UNB+UNOC:3+8712423009097:14+8716867999990:14+080928:1347+1001'
UNH+1001+APERAK:D:96A:UN:EDINE1'
BGM+12E::9+A_200508030000603782+27'
DTM+137:200508031112:203'
DTM+178:200508031113:203'
DTM+735:2:805'
RFF+AAN:T200508031110N002'
NAD+GRP+8716867999990::9'
NAD+GRU+8712423009097::9'
ERC+00023::60'
FTX+AAO+++In period 199904112015 199904112030 your changes are not yet approved: because of inconsistency between other PRCs in the given period'
UNT+11+1001'
UNZ+1+1001'

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.

UNH+1001+APERAK:D:96A:UN:EDINE1'

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.




8 comments:

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

    ReplyDelete
    Replies
    1. Hi,

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

      thanks

      Delete
  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?

    Ingrid

    ReplyDelete
    Replies
    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.

      thanks

      Delete
  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 adapter.is it possible?.could you please advice me.

    ReplyDelete
    Replies
    1. Hi,

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

      Thans

      Delete
  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!

    J.

    ReplyDelete
    Replies
    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

      Thanks

      Delete