SAP PI : Handling EDI Scenario in SAP PI

This blog is focused on PI beginners to understand how to develop an interface to handle EDI messages from an EDI customer via SAP PI. Here we will illustrate step by step approach for handling EDI Scenario in SAP PI( AS2 To File scenario).

This blog will cover only the design and configuration objects required to build the interface and not the administration section.

Scenario

We will use a scenario where we will develop an interface to accept Purchase Order information (ANSI X12 format) from third party EDI customer into FTP server . The interface will use the PI architecture to transfer the data from using Seeburger AS2 Adapter to Target File System.

Design Time Objects – Integration Repository

Import the predefined Software Components of Seeburger into IR to access the readily available standard EDI objects.

 Create Datatype for EDI ANSI X12 850 structure:

Since it is a standard EDI structure, it can be imported from Seeburger as an XSD under External Definitions.

EDI Scenario in SAP PI

Outbound Asynchronous Service Interface:

Create an Outbound Asynchronous Service Interface and choose the above External Definition as the request message.

Create Datatype for PO Flat File structure:

Create a datatype based on the structure of the PO flat file, as required by the client.

Create Message type for PO Flat File structure:

Create a corresponding message type for the above datatype.

Create Inbound Asynchronous Service Interface:

Create an Inbound Asynchronous Service Interface and choose the above Message Type as the request message.

Create Message Mapping:

Create a message mapping taking the External Definition as the source message and the PO message type as the receiver message. Remember to map all the mandatory fields so as to avoid errors at runtime.

Create Operation Mapping:

Create an operation mapping taking the outbound service interface as the source operation and inbound service interface as the target operation. Choose the above message mapping for the mapping program.

Create Datatype for Functional Acknowledgement structure:

Since it is a standard FA structure, it can be imported from Seeburger as an XSD under External Definitions.

Create Inbound Asynchronous Service Interface:

Create an Inbound Asynchronous Service Interface and choose the above External Definition as the request message.

Create Message Mapping:

Create a message mapping taking the functional Acknowledgement External Definition as the source message and the EDI ANSI X12 997 External Definition as the receiver message. Remember to map all the mandatory fields so as to avoid errors at runtime. You may also use the standard mapping program FunctionalAcknowledgement_to_A_997_ALL available under Seeburger software component.

Create Operation Mapping:

Create an operation mapping taking the outbound service interface as the source operation and inbound service interface as the target operation. Choose the above message mapping for the mapping program.

Configuration – Integration Directory

In order to categorize your configuration objects, create Configuration scenarios based on your requirement.

Create Party:

Create 2 parties; one for the third party EDI customer  and the other for the customer receiving the POs in their FTP server.

Remember to have the EDI Customer IDs handy from the client so as to maintain them as the Identifiers while configuring the parties. Add the entries under identifiers tab as shown below –

Maintain appropriate identifiers.

Create Business Component:

Create 2 Business Components  –

  • One component to send messages

Attach the corresponding Func Ack Outbound interface under ‘Sender’ tab and EDI 997 Inbound interface under ‘Receiver’ tab.

  • One component to split messages (in case of multiple EDI messages within a single envelope)

Similarly add the corresponding EDI 850 outbound interface under ‘Sender’ tab.

Create 2 Business Components for Party –

  • One component to receive Purchase Order messages

Add corresponding 2 inbound interfaces (one for PO and another for the EDI 997 acknowledgement) under ‘Receiver’ tab.

  • One component to send the acknowledgement messages

Add the corresponding EDI 997 outbound interface under ‘Sender’ tab to send the EDI acknowledgement to UNISOURCE.

Create Communication Channel:

Create 4 Communication Channels for UNISOURCE –

One sender communication channel to process the incoming EDI file (which contains the Functional Acknowledgement message and EDI 850 file as attachment) from the customer. Since the customer sends it via AS2 server, we will configure Seeburger provided AS2 sender adapter to solve our purpose.

Use Identifiers tab to specify the agency and schema

Implement the BIC module available in Seeburger workbench to convert the incoming EDI file to corresponding EDI-XML payload for further processing.

The module processing sequence should be as follows –

The module parameters are as follows –

  • One sender communication channel under split communication component to split and process only EDI 850 messages to corresponding PO flat file.

Since this will involve splitter configuration in Seeburger Workbench to identify the sender agreement, we will use standard Seeburger provided Split997 adapter.

  • One receiver communication channel to temporarily place the EDI ANSI X12 997 acknowledgement files in PI application server to be sent back to UNISOURCE.

Since we need to place the files as proper EDI structure, we will use BIC module to convert the EDI-XML 997 files to appropriate EDI format.

One receiver communication channel to place the EDI ANSI X12 997 acknowledgement files back to UNISOURCE AS2 server.

Since it connects the EDI customer’s AS2 server, we need to provide the identifiers as well.

To successfully execute the receiver AS2 adapter, we need a module configuration as shown below –

Create 2 Communication Channels for target –

  1. One receiver file adapter to place the PI generated PO flat files in Target FTP server. Use dynamic configuration technique to have the file naming convention at runtime from message payload, else specify as required under ‘File Name Scheme’.

In order to create the files as pipe delimited files, we need to use File Content Conversion as per file structure.

2. One sender file adapter to send the EDI acknowledgements from temporary location of PI application server back to UNISOURCE AS2 server.

Remember to specify the Processing Mode as ‘Delete’, otherwise it will keep processing all existing files in the directory, leading to duplicate file generation.

Create Sender Agreement:
Create 3 Sender Agreements as follows –
1) One sender agreement for the AS2 sender adapter to pick up files from the UNISOURCE AS2 server.
Since we are using a Seeburger provided AS2 adapter in our agreement, we need to provide the certificate details under adapter specific attributes. This is a secure process of data encryption.
The certificate details can be available in Netweaver Administrator –
Link: http://’hostname’:’Port’/nwa
Under Configuration Management/Security/Certificates and Keys, check out the Private Key and Certificate maintained for both PI and EDI customer’s AS2 server. The EDI certificate will be provided by the customer and similarly, we need to provide them our PI certificate for them to import at their end.
Remember to re-import valid certificate once the existing one expires, otherwise message processing through AS2 server will start failing.

One sender agreement for the Split997 adapter to specifically process the EDI 850 messages

3. One sender agreement for the File adapter to process the EDI ANSI X12 997 acknowledgement messages from PI application server back to UNISOURCE.

Create Interface Determination:

Create 3 Interface Determinations as follows –

  1. One to identify the inbound EDI 997 interface to process the EDI 997 acknowledgement files from Functional Acknowledgement messages.

2. Second one to identify the PO inbound interface to generate the flat files from EDI ANSI X12 850 messages.

3. Third one from OPTIVISION’s end to identify the inbound EDI 997 interface to process the acknowledgement messages.

Note: We do not have any message mapping for this determination as we are just passing the same EDI 997 files from PI application server to UNISOURCE.

Create Receiver Determination:

Create 3 Receiver Determinations as follows –

  1. One for the EDI 997 acknowledgement messages to be sent to UNISOURCE.

2. Second one for the Purchase Orders to OPTIVISION FTP server

 

3. Third one for the acknowledgement messages back to UNISOURCE AS2 server.

Create Receiver Agreement:

Create 3 Receiver Agreement as follows –

  1. One for the receiver file adapter to place the acknowledgement files in PI application server.
  2. Second one for the receiver file adapter to place the PO flat files in OPTIVISION FTP server.
  3. Third one for the receiver AS2 adapter to place the EDI 997 acknowledgement messages in UNISOURCE AS2 server.

             Note: This time, we need to specify PI server’s key details as the sender attribute and the EDI customer’s certificate details as the receiver attribute.

Configuration – Seeburger Workbench
In order to make the message split work, we need to configure the message splitter at frontend. This helps to choose the appropriate sender agreement based on the EDI envelope ID provided by the customer.
To achieve, goto http://’hostname’:’port’/seeburger and follow Message Splitter. Create a new entry for the EDI customer as shown below:

Maintain a similar entry with the same EDI envelope ID as the sender but change the state to ‘Partly Accepted’.

This ends our configuration.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.