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.
thanks. and it is very good idea, very useful to abapers.
Thanks Subramanyam for the compliments :)
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);
}
}
}
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
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.
Thanks P Reddy :)
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?
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.
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?
Hi,
I am facing a similar issue with the XML characters as Komal was getting and I am getting the following error:
Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser : #0 not allowed in Character data sections
I tried to replace the “�” characters forming the XML document with an empty string using Java mapping.
Any help would be greatly appreciated.
Regards.
I guess
& #0 ;
(without spaces) might work.if it doesn’t work, try changing the character encoding
e.g.
< ?xml version="1.0" encoding="UTF-8"?>
if UTF-8 does not work, try other encoding.
Hi Riyaz,
Glad to see your wonderful site on on PI/XI net.
Even though I have 10 years of technical consulting experience on many non-SAP products in installation, admin, Unix, Oracle, app Server clustering and databas etuning etc, I wanted to move to SAP Technical consulting side.
Question:
1. I need a mentor advice to understand if BASIS would be good or developing a career on SAP XI/PI? Your thoughts?
2. Also is there a good training on XI/PI? I looked at official SAP training site, it is too expensive and it begins from beginner SAPTECH etc. In fact I’m confident a week or two training on PI/XI, I can pick-up. What is your thought about Training and any hints? Can I free download and XI/PI from sapnet if any and learn/practice with my pace.
3. Last but not least, is there a good SAP XI/PI book that you could recommend.
Thanks a lot for any suggestion.
pradeep
Thanks Pradeep for your comments.
1. Basis and PI are two different areas. PI is more of integration/developement component which sits on top of SAP Web AS. If you are more inclined or well versed with admin/server activities, I would suggest looking at SAP NetWeaver Administrator as a role – This would comprise of admin/basis activities for NetWeaver components including PI.
2. Training is best obtained through SAP or SAP training partners like Genovate etc. They do offer short term courses. I am not aware of the fee struacture though. As far as I know free versions for PI are not available. There are some websites/vendors (including SAP) which provide restricted access to PI servers, but at a fee.
3. There are plenty of books available in SAP Press. If you are looking at developer’s role have a look at book by Michal Krawczyk titled ‘Mastering IDoc Business Scenarios with SAP XI’. For basis stuff related to PI, the book ‘Mastering SAP XI Administration’ by Marcus Banner and Heinzpeter Klein is good. You can as well use this website to gain some learning.
Good luck and all the best!
Hi Riyaz,
Thanks for the reply.
We have a JDBC to FILE scenario.
In the sender XML structure should be like this :
No
2006-05-15 00:00:00.0
ABCDEF
Before it comes to mapping, it becomes like this:
No
2006-05-15 00:00:00.0
ABCDEF�
It is a simple one to one mapping. I spoke to the database guys and they said there is a hex0 character at the end of the string. I tried to remove this using java mapping but I am unable to do so. Is there a way around for this?
BTW, the DB guys said they cannot change it from their side because it is coming a number of different sources.
Regards.
Riyaz,
Thanks a lot on my questions on Basis career or PI. You are an amazing mentor.
Regards
Pradeep
DNSPK,
You can strip those extra characters using substring function (0 to length-1). You may want to check beforehand if the extra characters are actually present at the end using if appropriate if condition.
That’s looks like great. In today’s world, governed by the Internet, everybody wants to build a website, If you’re looking serious to the web design then HTML is a must.
There are free services that allow you to check and fix the validity of your html codes.
Riyaz,
I have a question in PI – ESR. In our current setup. We create n numver of services every release and use PI – ESR i sour reposititory for the meta data. What we have to do for every web service is. We create our request and response strucutre in SAP ABAP dev and generate xsd for them with our own xsd generator program which will generate xsd at data element level (fiel for each). We then go to PI and manually create the data elements and import each strcuture and manually create the message types and interfaces. I woud like to some how automate this. By means I want to build a small tool which can take all this xsd files as input and create all the dataelements, message types and services.
Could you please tell me whether it is possible to do this?
Hope you cna help me on this?
Regards,
Thilak
Hi Riyaz,
This document is very good. I am functional consultan ,Can you please send some document for ABAP code debugging
Thanks in advance
Jugala Ramesh
PERTH Australia
Hi,
I am new to XI, your website is really helpful in learning things.
I need a clarification in some cases Name space start with “http://xxx”, can I use this name space in Web browser.
Namespace is just an identifier for grouping and organizing your development work. It need not point to a resource on the internet.
hi riyaz, SWC is imported successfully in IR… But the new SWC is not displayed in the left panel… what to do now…
Great remarkable issues here. I am very satisfied to peer your article. Thanks so much and i’m looking forward to contact you. Will you kindly drop me a e-mail?
Riyaz-
Could you please suggest or share any good Java resources used in SAP XI. I want to learn about the java programming used in XI meaning the SAX and DOM API’s and also about RFC look up in java. I am working for a client and they have some complex interfaces which has lot of Java programming.
Please let me know.
Thanks in Advance.
Hari
Hi Riyaz,
I have done one sucessful scenario xml to xml format in my pc, but not working file to xml scenario,I have checked in RWB cc:cc_sender is showing success message but cc:cc_receiver was shown functionnig(error). what happens & how to findout this problem.
please send me replay on my mail.
thanks,