Quantcast
Channel: Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 741

One Communication Channel for placing file into two different directories

$
0
0

The purpose of this document is to show the step by step process of  placing one file in two different directories using single receiver communication channel in SAP PI 7.1.

Design Process:

·         Open the ESR and ID Components.

·         Create the Data Types, Message Types and Service Interfaces.

·         Create Message Mapping and Operation Mapping.

As Per the requirement we have to create 2 data types, 2 messgae types, 3 service interfaces (1 for sender and 2 for receiver), 1 message mapping and 2 operation mappings.

DATA TYPE :

Create a data type for sender and receiver as below

Sender /Source Data Type:DT_Sender_Test

 

Sender DT.jpg

Receiver/Target Data Type:DT_Receiver_Test

 

Receiver DT.jpg

 

MESSAGE TYPE:

Here we need to define/create one source and one target message type with respect to data types created.

Source Message Type:

MT_Sender_Test                      

Target Message Type:

MT_Receiver_Test                   

Service Interface:

We have to define/create one sender service interface and two receiver service interface. In this case we are creating two interfaces one for each directory.

 

Source Service Interface:

 

Servi ce Interface for Receiver 1: SI_Receiver_In

 

Receiver SI1.jpg

 

Service Interface for Receiver 2: SI_Receiver_In_1

 

ReceiverSI2.jpg

 

Message Mapping :

All are 1-1 mapping except Row

Row having below mapping as shown below,

Here using dynamic configuration for passing “directory” and replacing “+” with “\” (check in Receiver interfaces tab of “Integrated Configuration” to find the  purpose of replacing).

 

MM.jpg

 

 

Parameter: Go to signature tab and add parameter as shown below.

Use the below code in Dynamic Configuration for Directory:

---------------------------------------------------------------------------------------------------------------------------

Dynamic Configuration:

try {

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

 

DynamicConfigurationKey targetDirectorykey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");

 

  1. conf.put(targetDirectorykey,targetDirectory);

 

return targetDirectory;

}

catch(Exception e)

{

     String exception = e.toString();

      return exception;

}-------------------------------------------------------------------------------------------------------------

Operation Mappings:

We need to create two operation mappings. Because we have  created two interfaces, one for placing file in one directory and two for different directory.

Operation Mapping 1:

 

OP1.jpg

 

Operation Mapping 2:

Pass the parameter as Directory, select category as Simple, type as xsd: string, parameter as Import.

 

OP2.jpg

 

 

Integration Directory :

●      Configure the designed objects, interfaces created in the ESR.

●      Configure communication channels for sender and receiver.

●      File channel configuration we have to specify Source directory and File Name information.

●      Receiver channel configuration we have to specify the receiver path and file name details.

●      We need to specify the parameters value in Receiver interfaces TAB

 

 

Sender Communication Channel:

 

Create sender file communication channel and assign it in Inbound Processing TAB

 

Inb.png

 

 

Receiver Tab:

 

Add Receiver in this tab

 

rec.jpg

 

Receiver interfaces TAB:

 

Add two Operation mappings in this tab, one for first directory and another for different directory, first directory which is already mentioned in Communication channel for second directory which we are passing at runtime by using Dynamic configuration.

and pass the parameter and its value is

For second directory:

Ex: testing/receiver/sap/pi/      if this is your directory, then you have to pass the directory as mentioned below

++testing+receiver+sap+pi++

 

RCV Inter.jpg

 

Outbound Processing:

Add two receiver interfaces and Receiver communication channel in this tab.

 

Outbnd.jpg

 

After testing you will find same message id in two different directories.


Viewing all articles
Browse latest Browse all 741

Trending Articles