XI/PI: Designing with Integration Repository
Integration Repository is a design time tool where we can design and develop different objects involved in XI Integration. This helps us create integration scenarios, message types, data types, interfaces and mapping objects and designing integration processes. These objects are organized under the software component versions. These SWC versions hence need to be imported from SLD before we can begin IR development.
In the previous article, we discussed the scenario and SLD settings required for the same. Here we will understand the IR part.
Go to XI Start Page (Transaction SXMB_IFR) and choose Integration Repository.
- Go to menu path Tools -> Transfer from System Landscape Directory -> Import Software Component Versions…
- Select your SWC and click ‘Import’
- The newly created SWC should now appear in the left frame. Expand the SWC, and double-click on the version
- On the Definition tab, select the Interface Import option as ‘Import of RFC and IDoc Interfaces from SAP Systems Permitted’
- Specify the System name and Client of the SAP system
- Add a namespace to the SWC to hold the repository objects
- Namespaces can be defined in two ways:
- URI format – http://abc.com/xi/scenarios
- URN format – urn:abc-com:xi:scenarios
- Namespaces can be defined in two ways:
Import IDoc Interface from SAP System
- Expand the SWC and right-click on Imported Objects
- Choose to Import RFCs and IDocs
- Provide Logon credentials
- Choose the IDoc ZRZSO_MT.ZRZORDER, and continue
- Click ‘Finish’ to import the IDoc
Define Data Types

- Under ‘Interface Objects’ within your namespace, right-click on ‘Data types’ and select ‘New…’
- Define four data types – SalesItem_DT, SalesHeader_DT, Customer_DT, and Orders_DT as shown
- Save the objects
Create Message Type
- In the left frame, right-click on ‘Message Types’ and select ‘New…’
- Note that the root element of the XML business document must match the message type exactly (case-sensitive)
- For the section ‘Data Type Used’ select the data type Orders_DT
- Save the object
Create Message Interface
The message interfaces in the integration repository can be of three types – Outbound Interface, Inbound interface and Abstract Interface. Outbound interfaces are used to communicate with XI, which receives messages from senders. XI in turn uses Inbound interfaces to route the messages to receivers. The Abstract interfaces are used for communication between integration server and ccBPM.
Interfaces can further be classified into Asynchronous and Synchronous depending on the direction of message flow. Asynchronous interfaces allow unidirectional message flow, while synchronous ones can communicate bidirectionally (request and response).
- From the left frame create a new message interface object called ‘Orders_out’
- The interface should be outbound and asynchronous
- Specify the message type as ‘Orders’
- Save the object
Create Message Mapping
SAP XI supports four kinds of mapping Graphical Mapping, Java Mapping, ABAP Mapping and XSLT mapping to map the source message to the receiver message. We will create a Graphical Message Mapping in this example.
- Expand ‘Mapping Objects’ under your namespace and right-click on ‘Message Mappings’ to create a new message mapping called Orders_ZRZORDERS
- Select ‘Orders’ as source message and ZRZSO_MT.ZRZORDER as target message
- Define mappings rules using the graphical mapping editor
- Disable the IDoc control segment as it will be populated automatically by the adapter
- Use the arithmetic function ‘counter’ to map the SEGMENT fields of IDoc segments
- Assign a constant ‘1’ to BEGIN field of the IDoc
- Save the object
- Mapping rules applied are as shown below
- To test the mapping, select ‘Generate Instance’ on the Test tab
- Fill in the values in the XML instance. Alternatively, you may upload an XML file containing data from your desktop
- Click on ‘Execute Mapping’
- In the right-hand side, you should see the IDoc populated with appropriate values
- Integration Engine converts the input XML document into XML-IDoc format based on the mapping rules. The conversion is shown below

Create Interface Mapping
- Create an object of type ‘Interface Mappings’ named ‘Orders_out_ZRZORDERS’
- Specify source interface, target interface and the mapping program as shown below
- Save the object

Finally, go to the change list tab and activate it. Thus, we are done with Repository part. In the next part of this series, we shall understand the configuration aspects using XI Integration Directory.



subramanyam says:
April 22nd, 2008 at 10:57 am
thanks. and it is very good idea, very useful to abapers.
Riyaz says:
April 22nd, 2008 at 2:52 pm
Thanks Subramanyam for the compliments
komal says:
July 22nd, 2008 at 12:23 pm
hi riyaz,
we have worked with java mapping .
we have compiled it successfully but when we imported into IR,there was an exception.kindly look at the java code and help us in tracking the error.
thanks in advance.
package com.komal.xi.javamapping;
import com.sap.aii.mapping.api.StreamTransformation;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Map;
import javax.imageio.ImageIO;
import com.sap.aii.mapping.api.StreamTransformationException;
public class MapImage implements com.sap.aii.mapping.api.StreamTransformation {
public void setParameter(Map arg0) {
// TODO Auto-generated method stub
}
public void execute(InputStream inputStream, OutputStream outputStream) throws StreamTransformationException {
ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
try
{
int byteRead=inputStream.read();
while(byteRead!=-1){
byteArrayOutputStream.write(byteRead);
byteRead=inputStream.read();
}
String inputString=new String(byteArrayOutputStream.toByteArray());
String outString=inputString.replaceAll(”�”,” “);
outputStream.write(outString.getBytes());
} catch (IOException e)
{
throw new StreamTransformationException(”IO Exception Occured while reading the input stream”,e);
}
}
}
Riyaz says:
July 22nd, 2008 at 12:30 pm
Hi Komal,
Remove the try catch block and see what exception you are getting. Otherwise you can print the stack trace or print the message returned by the exception handler.
Regards,
Riyaz
p reddy says:
July 27th, 2008 at 9:26 am
hi riyaz,
thanks for ur valuble information regaring sap development.
plz go through my site http://www.pss.org
where u will get some relief from ur burdends & tensitions.
u will get peace of mind &many more……….
thanks & regards
p reddy.
Riyaz says:
July 28th, 2008 at 9:35 am
Thanks P Reddy
Lavi says:
December 27th, 2008 at 9:19 pm
Hi Riyaz,
I wonder seeing your article……
It’s excellent..
I have just started XI development work. I have a SAP XI system and client has their SAP XI system. I want to know, Which adapter do I need to use to receive and send the datas from/to client from my XI system in this scenario.
I also have R/3 system, to which my XI needs to send /Receive the data which has received/send from the client XI system.
It is like, client –> XI –> R/3 system.. and viceversa
Please let me know, if you need more details..
Can you please guide me?
Riyaz says:
December 28th, 2008 at 12:40 pm
Lavi,
If you want to communicate with clients’ XI system using your XI system, you can use XI adapter which would simply pass on the XML. No transformation may be necessary.
Lavi says:
January 5th, 2009 at 11:11 am
Riyaz,
Thanks for the information!
Where could I find the message mapping standard functions details like how to use those functions in the message mapping with some examples in your site?