Friday, 19 April 2013

migrate Communication Channels from SAP PI 7.0 to SAP PI 7.31 using Directory API

1.- Explaining the Idea.

If you are just about to start a migration project between SAP PI 7.0 to SAP PI 7.31, this document may be useful for you. There are differents approach to achive this, but if you are going to have new installation with new SAP PI 7.31, one of the different task you need to do will be migrate objects from old to the new system. You can do this using export/import tpz files for repository and directory. This approach works except for Communication Channels. When you try to import Communication Channels from 7.0 into 7.31 you are going to get a pop-up screen like this:
11.JPG
com.sap.aii.ib.core.roa.RoaObjectAccessException:Attempt to read object Adapter Metadata SOAP |http://sap.com/xi/XI/System, type AdapterMetaData from application REPOSITORY on system REPOSITORY failes. Object does not exist. Detailed information: Software component version with name SAP BASIS 7.00 not found.

Why do you have this error when you try to import your Communication Channels from your old SAP PI 7.0 in your new SAP PI 7.31? Because new PI system use new version of Adapter Metadata belongs to SAP BASIS 7.31 software component, and your tpz files from your old SAP PI System still use Adapter Metadata from SAP BASIS 7.00. New PI can not translate one into another. But this can be done with a little of work from your side. When you close this pop-up (and you should close it several times), you are going to lose all information in your new Communication Channel, so export/import tpz files for Communicationi Channels is not very useful. You have to create new Communication Channels manually. And the risk in your project increase. That’s the reason why I write this blog. Directory API and PI can help you to do this automatically. You are about to use PI to implement one interface to create objects inside PI. We always create interfaces to the rest of the users to avoid manual taks, this is the first time you can do it for yourself. And of course, if you only have a few number of communication channels in your landscape, maybe this blog is not for you, but if you have a big number , this implementation help you to save time, money and will increase the quality of your migration project. Keep in mind that sometimes you have different configuration of your Communication Channels in Development, Quality and Production. This means that you have to do all versions manually, and of course you are going to have problems because you have to set all parameters, modules, File content Conversions and more.
First thing is download Communication Channels from your SAP PI 7.0 system using Directory API. To do this easily you can use the fantastic tool :
You can download this tool from :
Maybe you are asking yourself about, what is the meaning of download Communication Channels? Let me explain later about this. So far continue reading.
I did some changes inside code of this Excel in order to have unique name for all xml files generated. Let me explain how this Lets Excel works. This Excel connect to your PI system and execute 2 webservices. First one is to get all list of your communication channel. Second webservice is to read every single communication channel and get all information and parameters. The idea of this blog is using this xml files with all information about your communication channels to create a copy in your new PI system automatically without manual intervention. The only thing you have to set is passwords if needed.


So if you open Let’s Excel and pres Alt + F11 you can access to the code inside. Then go to DownloadCCXML Module and change this line with this content:

Open tempStore & "\" & PartyID & "_" & compid & "_" & chanid & ".xml" For Output As #1

I renamed the name of file in order to have unique name per channel.

13.JPG

When you execute this and connect with your PI system, (Please read http://scn.sap.com/community/pi-and-soa-middleware/blog/2011/11/10/lets-excel-enhanced-communication-channel-search-in-sap-pi to understasnd this part of this blog) this program download xml files with all description of your communication channels. All of these files will be stored in folder \PICCD of your filesystem. (search in your Temporary folders)
If you system ID is XID you can find folder PICCD\XID with all xml files

14.JPG

15.JPG
This Tool use CommunicationChannelServiceVi and read operation to get read response like this:

16.JPG
In this file you will find all parameters of your communication channels.
You can map this xml to request of CommunicationChannelServiceVi and create operation easily, with a couple of changes. 

2.- Directory API.


1.1.-We have all xml files with all description of our communication channel from our old system SAP PI 7.0. We have also in SAP PI 7.31 Directory API where we can use webservice to create Communication Channels. You need to design one interface to pick up files, translate SoftwareComponentID from 7.0 to 7.31,  call a webservice and save the log with results in one folder.
You can test Directory API to understand how it works in Webservice Navigator.
You can use CommunicationChannelServiceVi. Then you can see different operations.
17.JPG
In our case we will use create operation to create new Communication Channels.
18.JPG
To get wsdl of this webservice go to your SAP PI 7.0 Integration Repository and find this External Definition:
Software Component SAP BASIS 7.00
External Definitions: CommunicationChannelService
19.JPG

Below you can see readOut_doc message. This message is same format that our xml files generated by Let’s Excel. Also you can find below createIn_doc. This is the message we need to use in order to create Communication Channel in SAP PI 7.31 without losing any information.

20.JPG
Now you more or less know which is the approach of this blog. Reuse this useful information obtained with Let’s Excel to create easily our communication channels in our new PI without any manual intervention.

3.- Describing the proccess.

21.JPG
ccBPM has the following steps:
  1. 1.     Receiver xml file with Communication Channel structure
  2. 2.     Mapping to delete Soap header and to transfer all information to request message of webservice.
  3. 3.     Synchronous call to webservice CommunicationChannelServiceVi ->create
  4. 4.     Send response of webservice to save it as a logfile in order to check the results.



  1. 1.- If you take a look into xml file generated by Let’s Excel tool you can see that payload is almost the same than request message to create Communication Channel. But we need to delete SOAP header. I will use xslt mapping later to Delete Soap header. I will explain this later.
22.JPG


  1. 2.- Second thing to take into account is to create a Communication Channel using Directory API. You need to have Change List ID in order to assign generated object  to a change list like we do in normal way when we create communication channel in Integration Directory. You can create manually one Change List and get easily ID. But you need to set this ID in your mapping. To do that you can use Import parameter in your Operation Mapping and then you can set this Change List ID in Integration Directory. I will explain this in more detail later.
23.JPG
24.JPG
The value of the Key will be used as value of import parameter in our Operation Mapping. This is a mandatory field in request of creation of Communication Channel as you can see below:

25.JPG

3.- Integration Respository.



Now we are able to start working in Integration Repository in your new SAP PI 7.31.
Create your own Software Component or reuse existing one.
Create your own namespace to create all objects needed to build this interface.
You can do this in different ways. This is my proposal.

External Definition
obtained from SAP PI 7.0 CommunicationChannelService.wsdl

Data Types:

1.- logRow:

26.JPG

2.- logFile

27.JPG

Message Types

1.- Logfile

28.JPG

Service Interfaces

1.-LogFile_In : Inbound, Asynchronous and using Logfile message type
2.-ReadOut_Out: Outbound, Asynchronous and using readOut_doc from
CommunicationChannelService External Definition.
3.-ReadOut_Abs: Abstract, Asynchronous and using readOut_doc from
                CommunicationChannelService External Definition
4.-CreateOut_Abs: Abstract, Asynchronous and using createOut_doc from
                CommunicationChannelService External Definition
5.-CreateIn_Abs: Abstract, Asynchronous and using createOut_doc from
                CommunicationChannelService External Definition

6.-CreateComChannelSync_Abs: Abstract, Synchronous using
                For request: createIn_doc from CommunicationChannelService External Definition
                For response: createOut_doc from CommunicationChannelService External Definition

Imported Archives

DeleteSoapHeader xslt mapping
To delete Soap header we can use xlst mapping to do it simple.
29.JPG
     Imported Archive DeleteSoapHeader

          SOAP_readResponse_To_readResponse.xsl
     <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" indent="no" />
      <xsl:strip-space elements="*" />
        <xsl:template match="/">
      <rpl:readResponse xmlns:rpl="urn:CommunicationChannelServiceVi"xmlns:rn1="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:rn0="urn:com.sap.aii.ib.server.api.types"xmlns:rn3="urn:com.sap.aii.ibdir.server.api.types"
          xmlns:rn2="java:sap/standard">
                <xsl:for-each select="//rpl:Response">
                        <xsl:copy-of select="." />
             </xsl:for-each>
      </rpl:readResponse>
      </xsl:template>
     </xsl:transform>

Message Mappings


1.- MM_readOut_TO_readOut_Abs.
This mapping is only used to take Import Parameter (Change List ID) from Integration Directory to use it inside ccBMP.


43.JPG
You can map target message using buttom remarked in yellow below:
30.JPG
But in field : /ns0:readResponse/ns0:Response/ns1:LogMessageCollection/ns1:LogMessage/ns1:LogMessageItem/ns1:Message/ns1:value
you can map with Constant and select import parameter to use in next steps. (I use this field as a temporary variable, because is not used in this step)
31.JPG

2.- MM_readOut_TO_createIn71 .
This mapping would be used to map readOut message with createIn message in order to create communication channel. Take into account the following field:

32.JPG

To set /ns0:create/ns0:CommunicationChannelCreateRequest/ns1:ChangeListID with Import parameter assign to /ns0:readResponse/ns0:Response/ns1:LogMessageCollection/ns1:LogMessage/ns1:LogMessageItem/ns1:Message/ns1:value (used in step before as temporary variable to save import parameter with Change List ID)

Other important field is
/ns0:create/ns0:CommunicationChannelCreateRequest/ns1:CommunicationChannel/ns1:AdapterMetadata/ns1:SoftwareComponentVersionID
Old version has GUID for SAP BASIS 7.00. To create new communication channel in your new SAP PI 7.31 system you need to use new SoftwareComponentVersion ID. This is the error with pop up in the beginning of this blog. Please check in your Software Component and try to find something similar to this:

35.JPG
Map with this ID found in your own Software Component Version(This is not a constant you should have a different value of ID in your own system)
field /ns0:create/ns0:CommunicationChannelCreateRequest/ns1:CommunicationChannel/ns1:AdapterMetadata/ns1:SoftwareComponentVersionID
The rest of the mapping can be done easily name by name.

44.JPG

3.- MM_createOut_TO_LogFile
This mapping is used to get log information from the response of webservice about the result of creation of communication channel.
The main idea here is use this mapping described below taken all fields from LogMessageCommunicationChannel and format them into content field in LogFile.
36.JPG

Operation Mappings


1.- OM_readOut_TO_readOut_Abs
Source Operation: ReadOut_Out
Target Operation: ReadOut_Abs
Mapping Program:
                SOAP_readResponse_To_readResponse XSL
                MM_readOut_TO_readOut_Abs
Parameter:
                ChangeListID type string and Import type


37.JPG
2.- OM_readOut_TO_createIn_Abs
Source Operation : Read_Out
Target Operation:  CreateIn_Abs
Mapping Program: MM_readOut_TO_createIn71

38.JPG

3.- OM_createOut_TO_LogFile
Source Operation: CreateOut_Abs
Target Operation: LogFile_In
Mapping Program: MM_createOut_TO_LogFile

39.JPG

2.- Integration Process.


To implement this interface we need to use ccBPM.
IP_JTI_GO_ALL_PI_CreateCommunicationChannel.jpg

Container
40.JPG
In this ccBPM you can see 4 steps.
  1. 1.- ReceiverReadOut: Message readOut
  2. 2.- Operation Mapping: OM_readOut_TO_createIn_Abs
  3. 3.- Send: (Webservice call to create channel)
            Mode: Synchronous
            Synchronous Interface: CreateComChannelSync_Abs
  1. 4.- Send:(Send response from webservice to map to LogFile and save it into a folder)
            Mode: Asynchronous
            Message: createOut


3.- Integration Directory.

  1. Create a new Scenario for this interface.

41.JPG
2.- Business Component
            BC_PI700: For SAP PI 7.0
            BC_PI731: For SAP PI 7.31
3.- Communication Channels:
            CC_File_Sender_AutomaticMigration700 where you have to configure the source folder where you are going to put xml file with Communication Channel description.
            CC_File_Receiver_AutomaticMigration700 where you have to configure the target folder to put log file with errors of process
            CC_SOAP_Receiver_ComChnelService: where you have to configure to call webservice of Directory API.
42.JPG
Tartet URL: http://<PI 7.31 server>:50000/CommunicationChannelService/HTTPBasicAuth?style=document
SOAP Action : create

Special attention in Interface Determination with Import Parameter to set Change List ID
45.JPG

7.- Running Interface.

Steps to run the interface
  1. Open Lets Excel - Communication Channel Search v1.1.xlsm
  2. Connect Lets Excel with your SAP PI 7.0 systems.
  3. Download the files of your Communication Channels from your SAP PI 7.0.
  4. Go to Integration Directory of your SAP PI 7.31 system. Create a Change List manually and take ID to set it in Integration Determination as shown in above ilustration.
  5. Move the files to folder configured in your File Sender Channel.
  6. Monitor messages in sxmb_moni.
  7. Check in the change list if you can see communication channels created. Take into account that you have to create first Parties, Business Service, or Business Component related to your communication channels. What I did in my case was import all scenario from SAP PI 7.0 using tpz files and delete all communication channels from XI import list. Then I activated Parties, Business Services and Business Component, and after that, upload Communication channels using this interface. Finally you need to activate Channels and after that you can activate the rest of objects of imported scenario.
  8. Check LogFile in case of errors. Sometimes there are some parameters that they are not compatible with new Adapter Metadata version. You can delete them manually inside the file and reprocess again.
  9. Don’t forget to set password if needed in your communication channels created by this interface.
Hope this blog help you to increase quality and improve timing in your migration project.
Don’t hesitate to contact me in case of you have some questions.

No comments:

Post a Comment