December 9, 2014

SAP PI for Beginners - Lesson 1

Introduction
This document represents the hands-on lesson 1 of document SAP PI for Beginners

Hands-on
1_ Create a software component on the SLD
Get into your SLD, in my case I connected to the local PI SLD:
http://piserver:8100/sld

Then go to
And create a new component by clicking   and then


Then you have to fill the following fields with the information of the software component you want to create:


2_ Enterprise service repository
Go to http://piserver:8100/dir and open the enterprise service repository (From now on ESR)
You will see your component listed on the left, right click on the component version and select new:

Then create a new namespace, this namespace is where you will create your interfaces mappings message types and data type, components that you will you later to create the communication channels and integrated scenarios.

 

Once you have typed the name of the namespace just click create and then 

On the same list your component and component version were listed you will see now the new namespace you created inside the component version.
Right click on it and select new

The first thing we will create now is the data type


The data type is a template of how your message is conformed. In this case we are talking about a simple XML, so it will be easy to understand.
We assign a name to it and then we select the namespace where it will be created.
Once it was created you will see on the screen a blank list with only one element that is in fact the root of your XML, now we have to add all the sub elements that conform our xml, this data type will be used to pi to understand the XML and process it.

To add sub elements you have to click on the  button and select sub element.
At the end it should look like this:

It is important that you use the correct type and that the elements are in the same order than the XML file.
Again, once everything is confirmed just save .
Now we have to create the message type, start by right clicking your namespace and clicking new, then select Message Type under Interface Objects:
Assign a name, select the namespace and click create.
This one is easy to complete, just select the data type you created and save .


Finally we have to create to service interfaces, one for the outbound and one for the inbound:
Under your namespace create a new service interface:

This one is the inbound interface, you can use whatever name you want, but in SAP notation IA means inbound assignment. I decided to start with this interfaces:
Ensure the interface is set as inbound

Select the message type you created under your namespace

Confirm and save 
Time to create the outbound interface:

OA this time stand for outbound assignments.
Set the interface as outbound:

Configure the message type:

And save 
That's all we have to do in the enterprise server repository. It is now time to save the changes and getting them activated.
Go to the "Change lists" tab 

Find your changes, right click on them and select activate

If you want you can assign a name to the changes performed, in our case that was not really important so we used the name that is set by default.

3_ We can now go to the integration builder and start building our communication channels.

Open the integration builder and change to folder view using the following button:



Create a new folder on the under the root one:

And in our case to keep some order there I created the following folders un ZZ_TestScenarios




Now we can proceed with creating the business component that will be joining together the interfaces, and the communication channels. Right click on the last folder you created, select new and then create the business component:



Now the first thing you have to do is select the inbound interface:

Now you can move to the sender tab  and select the sender (or outbound) interface:

Click apply and the respective fields will be completed with this interface

Save  and let's create the first communication channel.

Again, right click on your folder, new, and create a communication channel:


Select the communication component you created before

Put a name and click create:

 First thing now is to select the adapter type, in our case it is a file adapter as it will be picking a file from somewhere and putting it somewhere else (Yes, you are  guessing right both communication channels will be of the same type, in other more complex cases you normally have one type on the sender and other type on the receiver):

 Then is just specifying the path where the files will be stored, and the file name:

We check the processing, but in our case we are leaving it as it comes by default:

And save.
Let's now create the sender communication channel, again create a new communication channel:

As said before select the file adapter as adapter type.
Complete the path, and the file name.
And save. By this moment your are probably wondering about a little mistake I have made, and yes I made it for real but I just leave it there because this kind of mistakes usually happen, so if before reading this you already noticed the issue that's good for you

Let's correct my mistake.
The receiver interface was wrongly configured as sender:


Let's change it to receiver and adjust the parameters:

In the processing tab, as required by the instructor on the original lesson, we have to put the timestamp, and in fact that is what PI does by default:

Now let's continue with creating the integrated scenario so finally we can merge everything and get this working.

You will initially have to select the outbound interface and it will automatically fill the namespace, if not, just select it and click create:

Start by adjusting the inbound processing parameters:
As you can see below it is just selecting the communication channel and moving to the next tab:

For reasons that are difficult to explain we have to remove the software component from the inbound processing parameters to make it work, otherwise it will be created but it will just fail:

On the receiver tab we just have to select the business component we created:

And then the receiver interface (we have only one so it is pretty easy):

Then select the communication channel on the outbound processing tab and save:

Go to your changes list tab and activate all the changes you have done:

And then you will see how in the directories you have configured the files start being processed.
To have a more detailed view you can use the PI monitoring workbench, in our case we will use it now to stop the channel and avoid getting thousand of files being created forever.
Start by opening http://piserver:8100/pimon
On the message monitoring tab open adapter engine and select "communication channel monitor":

Filter out your channels, select them and simply click stop: