You are on page 1of 15

XI/PI: The XI Starter Kit

JANUARY 21, 2008 BY RIYAZ SAP READ PRINT EMAIL PDF


Are you aspiring to become XI Professional? Its fairly easy!
Exchange Infrastructure or Process Integration which now falls under SAPs ESOA Middleware is
SAPs Integration Solution. It not only enables Application Integration (A2A) but also Business
Integration (B2B). In fact it is much more than a plain message broker. It supports Cross-Component
Business Process Management (ccBPM), which helps to streamline the business processes in the
organizations.

Who should learn XI?
Are you aspiring to become XI Professional? Its fairly easy! If you are an ABAP Professional, Java
Professional or an EAI Professional you can easily acquire XI skills. Dont worry even if you are not. If
you are willing to learn a new technology, then you can become skilled at XI. A background of SAP and
Knowledge of ALE/EDI, IDocs would certainly be an advantage.

What is XI?
Exchange Infrastructure or Process Integration as it is now called is an Integration Platform which helps
different systems to communicate with each other across landscape. It acts as a message broker.
Different systems in the landscape communicate with each other via XI Server, thus forming a bus
topology with XI at the center. This helps avoid peer-to-peer communication (as in star-topology) thus
providing a central mechanism to route and monitor the message flows.
SAP XI Architecture contains an Integration Builder, System Landscape Directory (SLD), Integration
Server (IS) and Runtime Workbench (RWB). Integration builder has a Integration Repository (IR) which
is a design time environment and Integration Directory (ID) which is configuration environment.
Integration Server has Integration Engine (IE) which routes all the messages and Adapter Engine which
helps in XML transformation. It also has a Business Process Engine which helps in execution of BPM
flows. System Landscape Directory (SLD) stores information about the different systems involved in the
landscape. This information is used by IE at runtime for message routing. More detailed information
on the XI Architecture can be found here.
All the communication is via SOAP/XML messages. XI provides adapters to convert messages from
and to XML format. XI thus provides interoperability between different heterogeneous landscapes due
to its foundation on open standards. XI has its interpretation of SOAP protocol. Understanding of SOAP
protocol and XML is absolutely essential to master XI. SOAP is an XML-based protocol for exchange of
messages in a decentralized, distributed environment. A SOAP message is composed of three
elements (1) SOAP Envelop, which is a mandatory element and wraps the entire message (2) SOAP
Header, which is an optional element which contains header information like sender and receiver, ports
etc and (3) SOAP Body, which is again a mandatory element. It carries the actual message or the
payload. In the coming blog posts, we shall discuss the XI concepts in more detail.
In the next part of this article series, we shall understand how to create your first XI scenario.






XI/PI: Your First XI Scenario
JANUARY 22, 2008 BY RIYAZ SAP READ PRINT EMAIL PDF
If you have gone through the previous post and decided to start learning XI, this article will
help you create your first XI scenario. You will understand the concepts better since do-it-
yourself is always the best approach.
If you have gone through the previous post and decided to start learning XI, this article will help you
create your first XI scenario. You will understand the concepts better since do-it-yourself is always the
best approachrather than simply reading through. I assume that you have read the previous post and
are by now fairly familiar with the architecture of Exchange Infrastructure. I shall still introduce the
different components of XI Architecture in course of this example.

The Scenario
A custom XML document containing certain data is picked up from the
file system by file adapter. The message is mapped to IDoc-XML
format and then routed to the IDoc adapter. A custom IDoc is posted
into the partner R/3 system by means of a call to an inbound function
module. Data is updated into custom DDic tables in the R/3 system. A
custom IDoc type ZRZORDER and message type ZRZSO_MT have
been defined in target R/3 system.

Overview of DDic tables
Custom IDoc ZRZORDER contains three segments to hold the data
records of these tables. If you havent already created, create three
data dictionary tables as shown below:



In this example we are using a custom IDoc. However, you may use any existing IDoc to try out this
scenario. To understand how to create a custom IDoc, refer to my post on ALE and IDocs.




System Landscape Directory
SLD stores information about different systems involved in the Integration Landscape. It also helps
administer the software components and their usage dependencies on each other. The products,
software component and dependency information (collectively called Software Catalog) is used by the
Integration Repository while the systems or the landscape information (Technical Landscape and
Business Landscape) is used by the Integration Directory. Technical Landscape contains Technical
systems, which store the technical information about software systems like the physical host where it is
installed. Business Landscape contains Business Systems which is nothing but a business-specific
wrapper to a technical system. Every Business System points to a Technical System. For example, an
SAP system would be defined as a Technical System of type Web AS ABAP while a particular client on
this system could then be defined as a Business system. This Business system would thus point to its
Technical System. Now, Let us begin with SLD settings relevant to our scenario.

Create a Product and a Software Component
Go to Start Integration Builder (Transaction SXMB_IFR) -> System Landscape Directory ->
Software Catalog.
Define a Product.
Define a Software Component and assign it to the above Product.












Create Technical and Business Systems

Access path Start Integration
Builder (Transaction SXMB_IFR) ->
System Landscape Directory ->
Technical Landscape
Create a technical system of type
Third-Party to identify the legacy
system.
Specify the Host name
Add the system to the software
component created previously
Similarly create a technical
system of type Web AS ABAP to identify
the client on the R/3 system
Now, follow the access path
Start Integration Builder (SXMB_IFR) ->
System Landscape Directory -> Business
Landscape
Create a new business system to identify the legacy system
Specify the corresponding third-party TS
Give a Logical system name
Select your product and SWC
Identify the BS as an Application System and select your Integration server
Similarly, create a business system to identify the R/3 system


Thus, we are done with SLD settings. In the coming posts we will understand design and configuration
required for this scenario. The next post deals with designing repository objects using the Integration
Repository, the design time tool provided by SAP.



















































XI/PI: Designing with Integration Repository
JANUARY 23, 2008 BY RIYAZ SAP READ PRINT EMAIL PDF
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.
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

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.



























XI/PI: Configuration using Integration Directory
JANUARY 24, 2008 BY RIYAZ SAP READ PRINT EMAIL PDF
In previous article, we discussed IR Settings needed for your first XI scenario. Now, let us
delve into ID Configuration. Integration Directory is a configuration tool which helps to
configure the routing rules for the business scenarios created in Integration Repository.
The ID binds the technical routing information to the interfaces via the communication
channels. Communication channels contain the adapters which do the job of translating
incoming message to XML and vice versa
In previous article, we discussed IR Settings needed for your first XI scenario. Now, let us delve into ID
Configuration. Integration Directory is a configuration tool which helps to configure the routing rules for
the business scenarios created in Integration Repository. The ID binds the technical routing information
to the interfaces via the communication channels. Communication channels contain the adapters which
do the job of translating incoming message to XML and vice versa in case of outgoing message. There
are different types of adapters like File, IDoc, RFC, JDBC, JMS, Mail, SOAP, HTTP etc. There are
many Third-Party adapters provided by Third-Party Vendors like Seeburger, RosettaNet etc. Note that
incoming message (i.e message from the sender system) is referred to as outbound message while
outgoing message(i.e message being delivered to the target system by XI) is referred to as inbound
message. The frame of reference is always the communicating systems and never the XI box or the
integration system. Now, let us start with Directory Configuration.

Define Collaboration Profiles
Collaboration Profiles contain the information about involved parties, business systems/services, and
the communication channels.


Access path Start Integration Builder
(SXMB_IFR) -> Integration Directory
Create a new scenario object and save it
Expand the above created object
Choose Service Without Party
Right-click on Business System and choose
Assign Business System
In the wizard, leave the Party name blank,
select your BS and uncheck the box Create
Communication Channels Automatically
Expand your service (BS), right-click on
Communication Channel and select New
Name the communication channel as
File_sender
Choose adapter type as File and option as
Sender
Specify the transport protocol, message
protocol, adapter engine as shown
Also specify the File Access Parameters and Processing Parameters as shown
Sender file adapter is now configured
Save the communication channel
Similarly, create receiver communication channel IDoc_Receiver with adapter type as IDoc,
option as Receiver, Transport and Message Protocol as IDoc. You will also need to specify
Adapter Engine, RFC Destination, Interface Version, Port and SAP Release. RFC destination must
be defined in SM59 to point to the target SAP R/3 system, likewise port should defined using
transaction IDX1.

Define Logical Routing
Logical Routing Objects contain Receiver Determination and Interface Determination. Receiver
Determination determines one or more receivers for a particular combination of sender and outbound
interface. Interface Determination determines
which interface should be used for inbound
message processing.
From the left frame create a new
Receiver Determination object
Select your sender service and interface
In the Configured Receivers section,
choose the receiver service (BS for the
R/3 System)
Save the object
In the section Configuration Overview for
Receiver Determination in Receiver
Determination screen, hit Refresh
In the column Receiver
(Partner/Service), right-click and select
New Specific in order to create a new
interface determination object
Select your interface ZRZSO_MT.ZRZORDER
Select your interface mapping Orders_out_ZRZORDERS
Save the object

Define Collaboration Agreements
Collaboration Agreement consists of Sender Agreement and Receiver Agreement. The Receiver
Agreement defines a binding between the receiver communication channel and the inbound interface
while the Sender Agreement defines a binding between the sender communication channel and the
outbound interface. Let us create a Receiver Agreement.
In the section Configuration Overview for Receiver Determination in Receiver Determination
screen, hit Refresh
In the column Receiver Agreement (Communication Channel), right-click and select New
Specific
Specify the Receiver Communication Channel as IDoc_Receiver
Save the agreement
Go back to the receiver determination screen and hit Refresh
Now, create a Sender Agreement,
In the left frame, right-click on Sender Agreement and select New
Select your service
Select your outbound interface (Orders_out)
Choose the sender communication channel (File_sender)
Save the agreement and close
Now go to the Change List tab in the left-frame and activate your change lists. This completes our
Directory Configuration. In the next blog post we will understand what settings are required in the
receiving R/3 partner system and how to test the scenario.












































XI/PI: Settings in R/3 Partner System to Receive
IDocs
JANUARY 25, 2008 BY RIYAZ SAP READ PRINT EMAIL PDF
In the previous posts, we have covered the XI specific aspects of creating your first XI
scenario. Now, let us understand what settings are required so that the R/3 partner system
is able to receive and post the IDoc data.
In the previous posts, we have covered the XI specific aspects of creating your first XI scenario. Now,
let us understand what settings are required so that the R/3 partner system is able to receive and post
the IDoc data. Let us start by creating the inbound function module.

Create Inbound Function Module Transaction SE37
In the receiving system, create a function module Z_IDOC_INPUT_ZRZSO_MT using SE37. Below, I
have described the logic for the same:
Add Include MBDCONWF. This include contains predefined ALE constants
Loop at EDIDC table
Check if the message type is ZRZORDER. Otherwise raise WRONG_FUNCTION_CALLED
exception
Loop at EDIDD table
Append data from the segments to appropriate internal tables
For example: append data from ZRZSEG1 segment to the internal table of type
ZCUSTOMERS
Update the DDic tables from internal tables
Depending on the result of the update, fill the IDoc status record (type BDIDOCSTAT) and append
it to the corresponding table.
Status 53 => Success
Status 51 => Error
You can download the sample ABAP code for the above function module here.

Assign Function Module to Logical message Transaction WE57
Create a new entry
Specify name of the Function Module as Z_IDOC_INPUT_ZRZSO_MT
Also, specify Type as F, Basic IDoc type as ZRZORDER, Message type as ZRZSO_MT and
Direction as 2 (Inbound)
Save the entry

Define Input method for Inbound Function Module Transaction BD51
Create a new entry
Provide Function Module name as Z_IDOC_INPUT_ZRZSO_MT
Specify the Input method as 2
Save the entry



Create a Process code Transaction WE42
Create a new Process Code ZPCRZ
Select Processing with ALE Service
Choose Processing type as Processing by function module
Save the entry
On the next screen, select your function module from the list
Save the changes
On the next screen, select your function module from the list
Save the changes

Define Logical system for the partner Transaction SALE or BD54
Define a Logical system LOGSYS100 using transaction SALE or BD54 to identify the partner
business system

Create a Partner profile Transaction WE20



Go to transaction WE20 and create a partner profile corresponding to the logical system created
above
Add the message type ZRZSO_MT and the previously created process code ZPCRZ in the
inbound parameters of the partner profile
Save the profile

Send and Receive Data
Put the input XML file in the appropriate directory on the file system
Monitor the directory. After a few seconds, the file should get marked as read-only
Choose monitoring -> Integration Engine monitoring (transaction SXMB_MONI)
Choose Monitor for Processed XML Messages
Your message should appear with a checkered flag (processed successfully)
Check the IDoc status in target R/3 system using transaction WE02
You may also verify the data records in DDic tables using SE16



Thus using a small example, we have learned how to integrate different systems so that they can
communicate with each other using SAP Exchange Infrastructure. In further posts we shall discuss
more XI concepts to give you better understanding of applying your XI knowledge.

You might also like