terça-feira, 8 de abril de 2014

Sterling B2B Integrator Enveloping an EDI message Part 1 - Creating the UNB envelope

This topic follows the previous entry to DeEnvelope a message. The message to be enveloped will be again a simple CONTRL EDIFACT message for it's simplicity but the principle can be applied to any EDI enveloping. We are going through both the immediate and deferred mode.

Lets start by creating the Outbound envelope UNH at level.


The envelope type for this tutorial will be using EDIFACT standard.


This is an Outbound UNB level.



There is no base Envelope.



It's being named GENERIC_UNB_UNZ_ENVELOPE_OUTBOUND, it's a good practice to name envelopes for type and direction, if it is for particular sender/receiver pair also specify it.



Use correlation overrides so you can set values like sender/receiver at BP level, this way the envelope can be more generic. The only settings we are inserting is Syntax Identifier and version.


Lets use the control number generated in the DeEnvelope tutorial.


There is no limit settings for this envelope but it can be restricted on size or number of UNH messages.


Leaving default delimiters and including the delimiter definition segment UNA, which is place at the top of the EDI message, e.g., UNA:+.? '


No encoding on the scope of tutorial.


For each document enveloped we want a BP to process that file therefore the option Specifying a business process.


The BP will be created on part 3 of tutorial alter this setting once the BP is created.


As stated before we are creating a BP to process the enveloped messages, the other options allow deliver the message directly using SFG with the option of extract to mailbox or put the message to the file system specified directory (The following substitution tokens are supported: %y (2 digit year), %Y (4 digit year), %m (month name), %M (month as a decimal number), %d (day name), %D (day of the month as a decimal number), %H (hour in 24-hour format), %N (minutes), %S (seconds), %P (process ID), %K (document ID))  


Verify and confirm.




Finish the first part of the tutorial next part we are configuring the UNH envelope level.



sexta-feira, 4 de abril de 2014

Sterling B2B Integrator DeEnvelope an EDIFAC document part 3 DeEnvelope Service applied in a BP

At this stage the envelopes are set we can now have a look at the BPs.

The first BP is the one that receives the raw EDI file and is responsible to call identify the correct envelope. We are going to run this manually and set upload an init PrimaryDocument, therefore it simple has a EDIFACT DeEnvelope service. This is being called GENERIC_DEENVELOPE.



We can also have a BP to process the translated files (the GENERIC_DEENVELOPE_PROCESS used in part 2), we use the default configured file system adapter that points to ..\install\ediinbound\extract



Once you have the BPs deployed in Sterling we can start testing to see results.
This will be the test EDI, it has to be an CONTRL message as specified on part 2 for UNH level. The elements present in the envelope are marked in bold. The sender/receiver pair was set with a * so they can have any value. Note that Sterling first looks for existing envelopes with sender receiver value in the input message and only after that it goes for the * marked envelope, as for the scope of the tutorial we don't have any more envelopes set but one can play around with the concept.

UNA:+.? '
UNB+UNOA:1+SENDER+RECEIVER+090520:0638+157'
UNH+115700001+CONTRL:2:1:UN'
UCI+200905200086+SENDER+RECEIVER+7'
UCM+905201914+IFTMBC:D:99B:UN+4++FTX'
UCS+8+15'
UCM+905201915+IFTMBC:D:99B:UN+4++FTX'
UCS+8+7'
UNT+7+115700001'
UNZ+1+157'

Applying this file as input to the GENERIC_DEENVELOPE input.

This should be the result. Note all the metadata that is inserted into process data, this can be used for further processing as per sending mail alert messages of file arrival.

If you have deployed the BP GENERIC_DEENVELOPE_PROCESS and the map DT_MAP_GENERIC_CONTRL_D99B_UN_TO_XML, the DeEnvelope service should have started a second BP. If there is nothing more running on Sterling it should be available in the current processes.
Note the parent/child relationship. You can use <message_to_child> on process data of GENERIC_DEENVELOPE to send information to child process, just like as using Invoke service.

Finally the file should have been dropped in the extraction folder, by the GENERIC DEENVELOPE.

Here is the file output.


A final note if you use a file with multiple UNH level you should get multiple BPs being started. Testing with the same UNH replicated twice in the input file (just changed the reference number).

UNA:+.? '
UNB+UNOA:1+SENDER+RECEIVER+090520:0638+157'
UNH+115700001+CONTRL:2:1:UN'
UCI+200905200086+SENDER+RECEIVER+7'
UCM+905201914+IFTMBC:D:99B:UN+4++FTX'
UCS+8+15'
UCM+905201915+IFTMBC:D:99B:UN+4++FTX'
UCS+8+7'
UNT+7+115700001'
UNH+115700002+CONTRL:2:1:UN'
UCI+200905200086+SENDER+RECEIVER+7'
UCM+905201914+IFTMBC:D:99B:UN+4++FTX'
UCS+8+15'
UCM+905201915+IFTMBC:D:99B:UN+4++FTX'
UCS+8+7'
UNT+7+115700002'
UNZ+1+157'

There should be a second BP, you can use  
Batch transactions received within a functional group into one output document
on the UNH envelope to stack files over each other in the ourput document and only have one children BP.
There's plenty of options to explore and each can be applied as the best stratagy for a certain situation but this is the basic flow of work for DeEnveloping (and translate) an EDI document in Sterling. On next tutorials I'll be looking at the Enveloping side.




Sterling B2B Integrator DeEnvelope an EDIFAC document part 2 UNH level

We are trying to DeEnvelope a EDIFACT CNTRL message, I chosed this type of document for it's simplicity and it's pretty much the same process for more complex documents.

Navigate to Trading Partner > Document Envelopes > Envelopes and hit new.
This is a UNH inbound.

There's no base envelope.

Give a name to the envelope.


As in the UNB this will be generic and therefore the star * sign.
Message Type: CONTRL (there's a typo on the screen).
Message Version Number: 2
Message Release Number: 1.
Controlling Agency, Coded: UN.

Select a control number see part bottom to check how to generate one.


Generate an error or no at BP level, check part 3.

Choose translate and the messages will be sent to a new BP already translated, if you leave you will get the raw content, if you select retain enclosing envelope on first option screen it will output original document to process data but you get metadata relative to it, useful for simle routing with no translation.

You can generate a map name from properties of the envelope, don't really find this very useful but it is an option we are using a specific map for the purpose.

Select the map from the ones available, this is the same map I use to explain the map EDI to XML in previous blog entries. 

 Specify if you want to validate the translation and raise an error in case of invalid translation.
We are using a business process to process our translated document and it should be invoked for each translated document. If you check the second radio in the For each document option you will get a set of documents in the BP Document Area. 

Select the business process to execute for each document. This BP will be shown in part 3.

Besides or instead of calling a business process you can immediatly resend the document to a mailbox (and route it on FilleGateway) or store it in a folder.

 For error documents you can route them to an error BP to be handled.
Specify the error BP, this is not covered in the tutorial so lets leave it blank.

Set security if necessary for use with EDI security settings.

Confirm the envelope.

That's it finish and we are done with the envelopes part, check the third part of the tutorial to see the BPs in action.



quinta-feira, 3 de abril de 2014

Sterling B2B Integrator DeEnvelope an EDIFAC document part 1 UNB level and Control Number

This is the first part of a set of three entries that hopefully will allow reader to get a better understanding on how the EDI DeEnvelope is processed in Sterling B2B Integrator, I will try to keep simple flow and use a basic EDI message the EDIFACT CONTRL. Note that the process of DeEnveloping a message in other standards is analogous, with the information present one should be able to adapt to apply this to other message types. 

Navigate to Trading Partner > Document Envelopes > Envelopes


Start by selecting the envelope type in this case EDIFACT, to follow tutorial purposes.

This is an inbound envelope, remember we are receiving an envelope from a virtual partner.
There is no base envelope this is build from scratch!
It will be called Generic as it as the Sender and Receiver are being identified with start marks, or otherwise this applies to any Sender/Receiver pair.
As told before lets keep it simple and this will have no filters, this is an UNB DeEnvelope setting therefore it will apply to any EDIFACT we are receiving in Sterling.
We are just leaving the default setting to don't escape further from the scope of the tutorial. Note that we can specify a BP to handle an exceptional noncompliance situation, but that is only relative to bad formation of UNB headers.

The referred Exception BP will be called if the handling of non-compliante messages is set to reject. Here you can set to create an CNTRL message to be delivered to partner on response. 
Specify an Interchange Control Reference (see at bottom how to  create one)
Here you can specify level of detail to be included in CNTRL message.
Review all the settings and confirm.

Generate the Control Number

To generate the control number navigate to Trading Partner > Document Envelopes > Control Numbers > New Control Number
After hitting Go fill the form as bellow, you can specify any Sender/Receiver pair Sterling. So how is this used? Well if you want to count for every DeEnvelope for a SenderReceiver pair and use that counter in the Enveloping service that's the way to go. You specify again this value in the Outbound Envelope and that will be number used on the outbound UNB. 
Now the easy part confirm...
and check out!
And this the End of Part 1 next lets see the UNH level.