Sunteți pe pagina 1din 211

TADMBO Implementation&Operation II

TBIT44
Mapping, Adapters and BPM

THE BEST-RUN BUSINESSES RUN SAP

© SAPSpeaker
© SAP AG 2002, Title of Presentation, AG 2004
Name 1

2004/Q4
Material number: 50069570

1
Mapping Patterns

2
Objectives

After completing this session, you will be able to:

Explore some typical mapping use cases ("patterns") involving


advanced features of the mapping tool

© SAP AG 2002, Title of Presentation, Speaker Name 3

3
Mapping Patterns

Mapping “patterns” are some of the common mapping


requirements we found in the past which XSLT was used, because
we did not think that Message Mapping provided the functionality

Summarization
Sequence–Number Generation
Duplicating Subtrees
Table / Value Lookups
Tree–Reversal

© SAP AG 2002, Title of Presentation, Speaker Name 4

4
Mapping Patterns – Summarization (I)
Summarization is when we try to consolidate detailed information into total/subtotals and
counts.

The count and sum functions will act on the content of a context. Therefore, the context of the
group to be summarized must be selected appropriately.

Example:

Source: Order details containing


customer, order numbers and
order amount

Target: Total and count the order


by each customer and a summary
of all orders

© SAP AG 2002, Title of Presentation, Speaker Name 5

5
Mapping Patterns – Summarization (II)

© SAP AG 2002, Title of Presentation, Speaker Name 6

6
Mapping Patterns – Summarization (III)

Mapping Result:

© SAP AG 2002, Title of Presentation, Speaker Name 7

7
Mapping Patterns – Sequence–Number Generation (I)

There are situations when sequence numbers had to be generated based


on the number of occurrences of the source data. This is frequently used
during mapping to SAP IDocs or BAPIs when item number, which is no
available from the source, had to be entered.

Example:

Source: Order information.

Target: Two complex elements


had to be populated from the
source. Each one contains a
sequence number which matches
the position of the data in the
source.
Sequence number to be generated.
© SAP AG 2002, Title of Presentation, Speaker Name 8

8
Mapping Patterns – Sequence–Number Generation (II)

There are two ways the sequence number can be generated.

1. Use Advanced User–Defined function to generate the sequence


number all at once.

2. Use Simple User–Defined function to generate the sequence


number for each occurrence separately, keeping track of the
sequence number value previously generated.

© SAP AG 2002, Title of Presentation, Speaker Name 9

9
Mapping Patterns – Sequence–Number Generation (III)

1. Use Advanced User–Defined function to generate the sequence


number all at once.

The java function creates the sequence number all at once based on the number of
elements in the source.

The sequence numbers are written to the ResultList object.

© SAP AG 2002, Title of Presentation, Speaker Name 10

10
Mapping Patterns – Sequence–Number Generation (IV)

1. Use Advanced User–Defined function to generate the sequence


number all at once.

© SAP AG 2002, Title of Presentation, Speaker Name 11

11
Mapping Patterns – Sequence–Number Generation (V)

1. Use Advanced User–Defined function to generate the sequence


number all at once.
Test Results:

© SAP AG 2002, Title of Presentation, Speaker Name 12

12
Mapping Patterns – Sequence–Number Generation (VI)

2. Use Simple User–Defined function to generate the sequence number for


each occurrence separately, keeping track of the sequence number
value previously generated.

The sequence number is stored in


the container object. Each time it
is retrieved, incremented and
saved.

Note: There is no input required.

© SAP AG 2002, Title of Presentation, Speaker Name 13

13
Mapping Patterns – Sequence–Number Generation (VII)

2. Use Simple User–Defined function to generate the sequence number for


each occurrence separately, keeping track of the sequence number
value previously generated.

We cannot display the queue to examine the result of the mapping.

© SAP AG 2002, Title of Presentation, Speaker Name 14

14
Mapping Patterns – Sequence–Number Generation (VIII)

2. Use Simple User–Defined function to generate the sequence number for


each occurrence separately, keeping track of the sequence number
value previously generated.

© SAP AG 2002, Title of Presentation, Speaker Name 15

15
Mapping Patterns – Duplicating Subtrees (I)

Even if elements are shown to occur more than once in the XML instance according
to XML Schema Definition, they are only displayed once in the structure overview.

To assign source field(s) to multiple positions of an element in the target structure,


the element or the entire subree can be duplicated (copied) using the context menu
in the target structure.

Example:

Source: Accounting information with


adjustment type and amount.

Target: Two CurrencyAmt’s are to


be created. One is to credit one
account. The other is to debit
another account. The amount will
either be positive or negative
depending on the ADJTYPE.

© SAP AG 2002, Title of Presentation, Speaker Name 16

16
Mapping Patterns – Duplicating Subtrees (II)

The subtree “CurrencyAmt” must be duplicated first. This will create 2


CurrencyAmt’s. One for credit, and one for debit.

© SAP AG 2002, Title of Presentation, Speaker Name 17

17
Mapping Patterns – Duplicating Subtrees (III)

© SAP AG 2002, Title of Presentation, Speaker Name 18

18
Mapping Patterns – Duplicating Subtrees (IV)

Mapping Results:

© SAP AG 2002, Title of Presentation, Speaker Name 19

19
Mapping Patterns – Table/Value Lookup (I)

During mapping, a lookup is necessary in a different subtree structure of the XML


document. This lookup process is easily accomplished using XSLT, since we can
navigate the XML document using absolute or relative “path” specification. In
Message Mapping, there is no facility to navigate the XML document.

In Message Mapping, we have to use the context of the different elements required
for the lookup. A Java function will be needed to perform the comparisons. And,
the matched values will have to be written to ResultList.

Example:

Source: Contains credit card information, with 2 subtrees. One is account


information (including account number, cost center, sub–account, card type, etc.)
The 2nd subtree contains detailed billing information (including account number,
date, billing amount, etc.)

Target: Contains only detailed billing information, but with each billing record, the
cost center, sub–account and card type from the account info record must also be
included. The account number in the detail is used to do the lookup of the account
information records.

© SAP AG 2002, Title of Presentation, Speaker Name 20

20
Mapping Patterns – Table/Value Lookup (II)

Source: Target:

© SAP AG 2002, Title of Presentation, Speaker Name 21

21
Mapping Patterns – Table/Value Lookup (III)
Java Function:

The lookup’d value


must be written to the
ResultList.

© SAP AG 2002, Title of Presentation, Speaker Name 22

22
Mapping Patterns – Table/Value Lookup (IV)

Contexts must be set a root level.

Mappings for all 3 elements are identical, except for the element names.

© SAP AG 2002, Title of Presentation, Speaker Name 23

23
Mapping Patterns – Table/Value Lookup (V)
Mapping Results:

© SAP AG 2002, Title of Presentation, Speaker Name 24

24
Mapping Patterns – Tree–Reversal (I)
Below is a mapping scenario which reverses the parent and child nodes. A “reverse”
summarizations is also performed.

Source document: Target document:

The
products
are to be
sorted and
totaled by
prices with
the
ORDERID
listed.

© SAP AG 2002, Title of Presentation, Speaker Name 25

25
Mapping Patterns – Tree–Reversal (II)

The source document is organized by ORDERID, ITEM and price. The same
product can occur in more than 1 orders.

The target document is summarized by product with a total price and listed
within each product all the ORDERIDs. The same ORDERIDs can occur in more
than 1 products.

The mapping needs to reverse the organization of the source document.

Based on that, the following needs to be done using the contexts/queues used
by Message Mapping:

1. Get a list of all the products. Since the same product can be in multiple orders,
we must eliminate the duplicates, and, then, sort them.

2. Sum the prices by product and assign those totals to the products in their sorted
order.

3. Examine all the ORDERIDs and determine which ORDERIDs contain each of the
products in the sorted list. Then, assign those ORDERIDs to the products.

© SAP AG 2002, Title of Presentation, Speaker Name 26

26
Mapping Patterns – Tree–Reversal (III)

Three Java functions were written to:

1. Extract the products, eliminate duplicate names, and sort them in alphabetical order.

© SAP AG 2002, Title of Presentation, Speaker Name 27

27
Mapping Patterns – Tree–Reversal (IV)

2. Total the prices and assign the total to the appropriate products.

© SAP AG 2002, Title of Presentation, Speaker Name 28

28
Mapping Patterns – Tree–Reversal (V)
3. Retrieve all the orderids and assign them to the appropriate products.

Note:
“Cache Entire Queue” is checked.
When the product is being
retrieved, the Context Change is
skipped.
The Context Change is added to
the ResultList.

© SAP AG 2002, Title of Presentation, Speaker Name 29

29
Mapping Patterns – Tree–Reversal (VI)

Mapping for ITEM: To create the number of elements.

© SAP AG 2002, Title of Presentation, Speaker Name 30

30
Mapping Patterns – Tree–Reversal (VII)

Mapping for the attribute NAME, which is the product name.

© SAP AG 2002, Title of Presentation, Speaker Name 31

31
Mapping Patterns – Tree–Reversal (VIII)
Display Queue for determining NAME:

© SAP AG 2002, Title of Presentation, Speaker Name 32

32
Mapping Patterns – Tree–Reversal (IX)

Mapping to create the number of element for ORDERS_WHERE_ITEM_IS_FOUND.

© SAP AG 2002, Title of Presentation, Speaker Name 33

33
Mapping Patterns – Tree–Reversal (X)

Mapping for the attribute TotalSalesFOrThisItem, which totals the prices by product name.

© SAP AG 2002, Title of Presentation, Speaker Name 34

34
Mapping Patterns – Tree–Reversal (XI)
Display Queue for determining TotalSalesFOrThisItem:

© SAP AG 2002, Title of Presentation, Speaker Name 35

35
Mapping Patterns – Tree–Reversal (XII)

Mapping for the element ORDERID, which will be listed by product name.

© SAP AG 2002, Title of Presentation, Speaker Name 36

36
Mapping Patterns – Tree–Reversal (XIII)
Display Queue for determining ORDERID:

© SAP AG 2002, Title of Presentation, Speaker Name 37

37
Mapping Patterns – Tree–Reversal (XIV)

Partial listing of the mapping results:

© SAP AG 2002, Title of Presentation, Speaker Name 38

38
Summary

Now you should be able to:

Explore some typical mapping use cases ("patterns") involving


advanced features of the mapping tool

© SAP AG 2002, Title of Presentation, Speaker Name 39

39
Exercise 1: Message Mapping – Standard Functions

Overview

The purpose of this exercise is to design a Message Mapping using standard functions of the
mapping tool.

This exercise will test the understanding of using standard functions in Message Mapping.

Prerequisites

Basic knowledge of XI 3.0 Message Mapping.

Description

The source is an XML document containing Contact information. The target is an XML document
containing Customer information.

Exercise steps

*Please note, as a general rule, all development and configuration objects are CASE-SENSITIVE.

There are many ways to achieve the desired result. The solution provided here is only 1 way, not
the only way.

Create a Message Mapping

1. Logon to Integration Repository.

2. Go into SWCV TBIT41 and namespace http://xi.com/mapping/exercise1.

3. Create a new Message Mapping called ContactToCustomer.

4. The target element fullname should contain the concatenated content of title, firstname
and custname, separated by a blank.

5. The first 10 digits of element contactID should be filled into element customerNo

6. The six last digits of element contactID should be used to fill element birthday. Please
perform a date transfer so that birthday is of format yyyy/dd/MM.

8. Test the mapping by using the “Test” tab. You can use e.g. the following xml file for
testing:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Contact xmlns:ns0="http://xi.com/mapping/exercise1">
<title>Mr.</title>
<custname>Smith</custname>
<firstname>Paul</firstname>
<contactID>0123456789-181170</contactID>
</ns0:Contact>
Exercise 2: Message Mapping – Mapping Template

Overview

The purpose of this exercise is to design a Message Mapping using existing mapping templates.

This exercise will test the understanding of using mapping template in Message Mapping.

Prerequisites

Basic knowledge of XI 3.0 Message Mapping.

Description

The source is an XML document containing Contact information. The target is an XML
document containing Customer information.

Within Contact, predefined data types of Name and Address are used.

Within Customer, predefined data types of CustName and CustomerAddress are used.

In a first step, two Mapping Templates based on these Data Types will be defined. Then the
templates will be reused in a Message Mapping.

Exercise steps

*Please note, as a general rule, all development and configuration objects are CASE-SENSITIVE.

There are many ways to achieve the desired result. The solution provided here is only 1 way, not
the only way.

Create a Message Mapping

1. Logon to Integration Repository.

2. Go into SWCV TBIT41 and namespace http://xi.com/mapping/exercise2.

3. Create a mapping template.

In Mapping Templates, create a template called NameToCustName, with the


following mapping. The source and target are the data types of Name and
CustName.

Please note that Mapping Templates are created using Data


Types, not Message Types.
4. Create a second Mapping Template AddressToAddress applying a simple identity
mapping.

5. Create a Message Mapping, ContactToCustomer.

6. Assign the Mapping Templates as follow:

Mark element Name in the source structure and element CustomerName in the target
structure

Right-click on element CustomerName and select “Show Suitable Templates”

Select the template

7. Do the same for Address and CustomerAddress.

8. Check your mappings.

9. Test the mapping by using the “Test” tab.


Exercise 3: Message Mapping – Context Handling

Overview

The purpose of this exercise is to design a Message Mapping utilizing basic standard XI 3.0
functions.

This exercise will test the understanding of context/queue processing of Message Mapping.

Prerequisites

Basic knowledge of XI 3.0 Message Mapping.

Description

The source is an XML document containing material information. This document contains a
material number and its description in multiple languages.

The result of the mapping/transformation will contain the material number and the description of
the material in English.

Example source XML:

<?xml version="1.0" encoding="UTF-8"?>


<ns0:MATERIAL xmlns:ns0="http://xi.com/mapping/exercise3">
<MATNO>4711</MATNO>
<MATTEXT>
<LANGKEY>DE</LANGKEY>
<TEXT>Zahnpasta</TEXT>
</MATTEXT>
<MATTEXT>
<LANGKEY>EN</LANGKEY>
<TEXT>toothpaste</TEXT>
</MATTEXT>
<MATTEXT>
<LANGKEY>FR</LANGKEY>
<TEXT>dentifrice</TEXT>
</MATTEXT>
</ns0:MATERIAL>

Result of the mapping/transformation:

<?xml version="1.0" encoding="UTF-8"?>


<ns0:ProductDefinition xmlns: ns0="http://xi.com/mapping/exercise3">
<RefNo>4710</RefNo>
<Description>toothpaste</Description>
</ns0:ProductDefinition>

Exercise steps

*Please note, as a general rule, all development and configuration objects are CASE-SENSITIVE.

There are many ways to achieve the desired result. The solution provided here is only 1 way, not
the only way.
Create a Message Mapping

1. Logon to Integration Repository.

2. Go into SWCV and namespace http://xi.com/mapping/exercise3.

3. Create a Message Mapping object. Call it, e.g. MATERIALToProductDefinition.

4. Use Message Type MATERIAL as source and ProductDefinition target structure.

5. To achieve the mapping requirement, we need to do the following:


a. The MATNO from source is mapped to RefNo of target.
b. Test the content of LANGKEY for the value of “EN”, for English.
c. Assign the appropriate TEXT matching the LANGKEY to Description of the
target.

6. Create the following mappings in the Data Flow Editor:

Please note that all italicized source element name has


context of “MATERIAL”.
7. Test the mapping by using the “Test” tab. Create at least three different entries of node
MATTEXT using the duplicate subtree function. You can use the example for the source
XML of the Description part of the exercise as role-model.
Exercise 4: User-defined functions – part I

Overview

The purpose of this exercise is to design a Message Mapping utilizing some basic techniques of
using advanced user functions. Some basic knowledge of Java will be required.

This exercise will test the understanding of context/queue processing of Message Mapping.

Prerequisites

Advanced knowledge of XI 3.0 Message Mapping. Basic knowledge of Java.

Description

The source is an XML document containing purchase order information. This document contains
multiple orders. Each order has 1 header and multiple items information.

The result of the mapping/transformation will contain a row for each item. Each row will contain
the header information from the source, and the item information.

This mapping might be used when we want to insert into a table the content of a purchase order
from an IDoc. Each row in the table must contain both the header and detail information.

For example, the source contains 2 orders. Each order has a header and 2 items. The result of
the mapping/transformation must contain 4 rows for each of the items in the source. In addition,
each of the rows will also contain the corresponding header information.

Example source XML:

<?xml version="1.0" encoding="UTF-8"?>


<PurchaseOrder>
<Orders>
<Order>
<Header>
<Name>Smith</Name>
<Address>123 Main St.</Address>
</Header>
<Item>
<Material>100</Material>
<Units>2</Units>
<Price>100</Price>
</Item>
<Item>
<Material>200</Material>
<Units>1</Units>
<Price>10</Price>
</Item>
</Order>
<Order>
<Header>
<Name>Jones</Name>
<Address>987 First Ave.</Address>
</Header>
<Item>
<Material>101</Material>
<Units>3</Units>
<Price>50</Price>
</Item>
<Item>
<Material>201</Material>
<Units>4</Units>
<Price>1000</Price>
</Item>
</Order>
</Orders>
</PurchaseOrder>

Result of the mapping/transformation:

<?xml version="1.0" encoding="UTF-8"?>


<resultset>
<row>
<name>Smith</name>
<address>123 Main St.</address>
<material>100</material>
<units>2</units>
<price>100</price>
</row>
<row>
<name>Smith</name>
<address>123 Main St.</address>
<material>200</material>
<units>1</units>
<price>10</price>
</row>
<row>
<name>Jones</name>
<address>987 First Ave.</address>
<material>101</material>
<units>3</units>
<price>50</price>
</row>
<row>
<name>Jones</name>
<address>987 First Ave.</address>
<material>201</material>
<units>4</units>
<price>1000</price>
</row>
</resultset>

Exercise steps

*Please note, as a general rule, all development and configuration objects, especially Java codes,
in XI are CASE-SENSITIVE.

There are many ways to achieve the desired result. The solution provided here is only 1 way, not
the only way.

Create a Message Mapping


1. Logon to Integration Repository.

2. Go into SWCV TBIT41 and namespace http://xi.com/mapping/exercise4.

3. Create a Message Mapping object. Use any name you wish e.g.
MATERIALToProductDefinition.

4. Insert message types MATERIAL as source and ProductDefinition as target. The


Message Types are stored in the same namespace.

5. The result should look like the following:

6. To achieve the mapping requirement, we need to do the following:


a. With each row in resultset, we need to assign the Header information from
PurchaseOrder. This need to be done for both Name and Address.
b. The remainder elements in row can map directly from source to target.

7. Create the following Advanced User Function:


st nd
copyPerValue – There are 2 arguments. The 1 argument is the item, the 2 argument
is the Name or Address. In each context, for each occurrence of the item, the function
will add the Name or Address to the target.
8. Create the following mappings in the Data Flow Editor:
9. Test the mapping by using the “Test” tab.

Enter the following data as an example.


The mapping result should be the following:
Bonus Exercises:

I. To send a trace message to SXMB_MONI, we can use the Container object in either
Simple or Advanced user–function.

Let’s create a Simple user–function, sendTraceInfo with 1 argument:


To use it, we can do the following mapping:

The testing tool will not be able to test the trace info being sent to the monitor. Only
during runtime, the trace info will be sent to the monitor. In addition, the monitor’s trace
level must be properly set to display it.

II. Control our own context changes in user–function.

In the exercise, we used the Node Function, SplitByValue, to insert context changes
between the values. We can also perform this function within our own user–function.

We can replace our user–function, copyPerValue, with another function,


copyPerValueWithCC:
The mapping can be done as follow:
Exercise 5: User-defined functions – Part II

Overview

The purpose of this exercise is to design a Message Mapping utilizing advanced user functions
along with the standard XI 3.0 functions. Some basic knowledge of Java will be required.

This exercise will test the understanding of context/queue processing of Message Mapping.

Prerequisites

Advanced knowledge of XI 3.0 Message Mapping. Basic knowledge of Java.

Description

The source is an XML document containing purchase order information. This document contains
a single header with multiple detailed purchase orders. In each detailed purchase order, the
supplier’s name is provided. There can be more than 1 detailed purchase order per supplier, and
the number of suppliers is unknown. The detailed purchase orders are not grouped by supplier,
in another word, it is not sorted by supplier name.

The result of the mapping/transformation will contain an order for each supplier. Each supplier will
contain the header information from the source, and all the detailed purchase orders belonging to
the same supplier must be grouped within the order.

For example, the source contains 2 suppliers and 4 detailed purchase orders. The 2nd and 3rd
st th
detailed purchase orders belong to companyA, and the 1 and 4 detailed purchase orders
belong to companyB. The result of the mapping/transformation must contain 2 orders, each with
nd rd
a header. For companyA’s order, it must contain the 2 and 3 detailed purchase orders. For
st th
companyB’s order, it must contain the 1 and 4 detailed purchase orders.

Example source XML:

<?xml version="1.0" encoding="UTF-8"?>


<ns9:POCombined xmlns:ns9="http://sap.com/xi30/mapping/patterns">
<Header>
<Name>myName</Name>
<Address>myAddress</Address>
</Header>
<Detail>
<Supplier>OfficeMax</Supplier>
<ProductID>11</ProductID>
<Quantity>12</Quantity>
<Price>13</Price>
</Detail>
<Detail>
<Supplier>OfficeDepot</Supplier>
<ProductID>21</ProductID>
<Quantity>22</Quantity>
<Price>23</Price>
</Detail>
<Detail>
<Supplier>OfficeDepot</Supplier>
<ProductID>31</ProductID>
<Quantity>32</Quantity>
<Price>33</Price>
</Detail>
<Detail>
<Supplier>OfficeMax</Supplier>
<ProductID>42</ProductID>
<Quantity>42</Quantity>
<Price>43</Price>
</Detail>
</ns9:POCombined>

Result of the mapping/transformation:

<?xml version="1.0" encoding="UTF-8"?>


<ns9:POSplit xmlns:ns9="http://sap.com/xi30/mapping/patterns">
<Orders>
<Header>
<toCompany>OfficeMax</toCompany>
<custName>myName</custName>
<custAddress>myAddress</custAddress>
</Header>
<Items>
<productNo>11</productNo>
<quantity>12</quantity>
<price>13</price>
</Items>
<Items>
<productNo>42</productNo>
<quantity>42</quantity>
<price>43</price>
</Items>
</Orders>
<Orders>
<Header>
<toCompany>OfficeDepot</toCompany>
<custName>myName</custName>
<custAddress>myAddress</custAddress>
</Header>
<Items>
<productNo>21</productNo>
<quantity>22</quantity>
<price>23</price>
</Items>
<Items>
<productNo>31</productNo>
<quantity>32</quantity>
<price>33</price>
</Items>
</Orders>
</ns9:POSplit>

Exercise steps

*Please note, as a general rule, all development and configuration objects, especially Java codes,
in XI are CASE-SENSITIVE.
There are many ways to achieve the desired result. The solution provided here is only 1 way, not
the only way.

Create a Message Mapping

1. Logon to Integration Repository.

2. Go into SWCV TBIT41 and namespace http://xi.com/mapping/exercise5.

3. Create a Message Mapping object. Use any name you wish.

4. Use “Search Repository Object” to import the source and target message.

5. Go to your <SWCV> D <namespace>. Select Message Type POCombined as source


and POSplit as target structure.

6. The result should look like the following:

7. To achieve the mapping requirement, we need to do the following:


a. Determine the number of unique suppliers. This is how many Orders we must
create in the target.
b. Assign the Header information to each of the Orders in the target.
c. Determine the number items for each supplier.
d. Assign the Detail information to the Items to the appropriate supplier in the target.

8. Create the following 4 Advanced User Functions:


getSuppliers – using Supplier as the input parameter, this function tests all the Supplier
values and return only the unique ones.

assignItems – using Supplier as the input parameter, this function determines how many
Items belongs to each Supplier and separate them with a ContextChange. In another
word, for each Supplier, it create the number of Items element for it.
assignValue – using the number of unique Supplier as input, that same number of the
value in the 2nd parameter will be added to the output. So, if there are 2 Suppliers, then
nd
the value in the 2 parameter will be copied 2 times.

assignSupplier – this function is to assign the elements in Detail to the appropriate Items
of a Supplier’s Order. It is used to rearrange/reorder the elements in Detail
corresponding to how the Items are grouped together based on the Supplier.
9. Create the following mappings in the Data Flow Editor:
Please note that all italicized source element name has
context of “POCombined”.
10. Test the mapping by using the “Test” tab.

Enter the following data as an example.


The result should be the following:
CPA Cache

1
Learning Objectives

As a result of this unit, you will:

„ Understand the basics of CPA Cache, including:


z Configuration
z Monitoring
z Troubleshooting
z Manual refresh

© SAP AG 2003, Title of Presentation, Speaker Name / 2

2
Cache overview

Integration Builder Business system


SLD Cache “Own Business system”
ctivate Changelist

mport Integration Server

equest Cache update again Business


Process
Engine

Update
usiness Integration
usiness Process Engine
Processes

Runtime Access
Configuration

appings outing Rules

Cache
Central Adapter
daptermetadata ollaboration Engine
Agreements

SLD Cache ollaboration


Software Profiles SLD Cache “Own Business system”
components
versions “Based
On” SLD Cache
Business
systems

Repository Decentral Adapter Engine


Cache Update

Cache
Adapter Meta
data
Adapter
Framework
Integration Integration
Repository Directory

© SAP AG 2003, Title of Presentation, Speaker Name / 3

3
CPA Cache in general

ƒ cache for Directory & Repository data (CPACache)

Æ cache is filled during activation within directory


(process described at the end of the document)

ƒ contains objects from directory

• services
• parties
• bindings (inbound/outbound; sender/receiver
agreements)
• channels
• adapter metadata
• module configuration

ƒ used in adapter framework during runtime

© SAP AG 2003, Title of Presentation, Speaker Name / 4

4
CPA Cache – display content

Æ data can be seen in the CPACache Monitor


(not accessible per default)

http://<host>:<J2EEport>/CPACache

© SAP AG 2003, Title of Presentation, Speaker Name / 5

„ Per default no user has access to the CPACache display tool


„ You get an “403 – Unauthorized” Error when trying to access the URL

5
CPA Cache – display content (2)

Ædisplays objects relevant for adapter framework during


runtime

© SAP AG 2003, Title of Presentation, Speaker Name / 6

„ Shows all CPA Cache content objects


„ E.g. bindings (inbound/outbound) , channels , adapter metadata, services,
parties, module configuration
„ Note: a binding corresponds to a sender or receiver agreement in the
Integration Directory. The direction will be inbound (I) or outbound (O),
respectively.

6
CPA Cache – get access

ƒ for access the display tool a user needs to be assigned


to the security role

xi_af_cpa_monitor
in component

sap.com/com.sap.aii.af.service.cpa.monitor*CPACache

in the Security Provider Service in Visual Admin Tool

© SAP AG 2003, Title of Presentation, Speaker Name / 7

„ Assign a user or a role to the security role xi_af_cpa_monitor


„ No restart is needed
„ Log on with this user when access the CPACache URL

7
CPA Cache refresh

Æ manual refresh via URL with user “XIDIRUSER”

http://<host>:<J2EEport>/CPACache/refresh?mode=full

© SAP AG 2003, Title of Presentation, Speaker Name / 8

8
CPA Cache refresh – in detail

Adapter Engine Directory Repository

XIAFuser XIDIRuser

Adapter Runtime Notification Notif Changelist Directory Repository


Notif
Engine Cache handler error handler Object Object

Update
running

Get object ids

Get Object

Get object from repository

Update

General
OK / OK with errors status

Error Status
of single objects

© SAP AG 2003, Title of Presentation, Speaker Name / 9

„ - after AE Runtime got the notification it starts the update asynchronously


„ - via JMS an update notification is written to the notification table
Æ can be seen in Directory Æ Environment Æ Cache Notifications
„ - the update of CPACache is done using the user XIAFUSER
„ - the objects from repository (metadata) are accessed from directory using
user
XIDIRUSER
„ - after update the success or failure is written to the notification table

9
CPA Cache - Registration

SLD

Change
in XI ID
3

2 4 5

AE CPA Cache

© SAP AG 2003, Title of Presentation, Speaker Name / 10

„ Enables decentral AE with central configuration


„ Current Registration Mode (alternative: pull from Adapter Engine)
„ All parties are loaded; communication channel objects only for the related AE
„ Step 1: ID contacts SLD to find out which adapter engines are registered, and
the URL where the trigger should be sent.
„ Step 2: ID sends a trigger to the respective adapter engines.
„ Step 3: adapter engine contacts the SLD to find out the address of the
Integration Directory
„ Step 4: cache refresh occurs between the ID and the AE.
„ Step 5: Cache status and detailed problem description can be seen in the
Integration directory: Environment => „Cache Notifications“ (positive and
negative confirmations)

10
CPA-Cache Service Directory or PCK?

© SAP AG 2003, Title of Presentation, Speaker Name / 11

„ On your SAP Exchange Infrastructure central host, start the SAP J2EE
Engine administration tool. (Choose Cluster => server => Services => CPA
Cache). In the properties tab, change the value for the parameter cache Type
to value DIRECTORY.

11
CPA Cache: Display/Monitoring

http://<host>:<port>/CPACache/monitor.jsp

© SAP AG 2003, Title of Presentation, Speaker Name / 12

„ The Current CPA cache service initialization for the J2EE Adapter Engine
on the IS and for the decentral J2EE Adapter Engine is DIRECTORY, i.e. they
access a central directory on the integration server/directory; for the PCK the
Current CPA cache service initialization is PCK (also, the PCK-UI must be
installed)
„ For a central/decentral AE there is no initialization/synchronization required,
as soon the directory‘s address is known from the property of the CPACache–
J2EE-service or from the SLD-access a trigger is sent from the Integration
Builder/Directory about a configuration change to the adapter engine. The
Adapter engine then updates its cache (registration mode/Push)
„ E.g. check if an adapter is really activated or not

12
CPA Cache: Registration/Push vs. Pull

Registration/Push Mode PULL-Mode (Delta or Full Refresh)


(automatically or manual) http://<host>:<port>/CPACache/refresh?mode=
delta|full

© SAP AG 2003, Title of Presentation, Speaker Name / 13

„ Integration Directory => Environment => Cache Notifications


„ The AE Java Cache will execute a full cache refresh, the first time the engine
gets started
„ Pull-Mode: use XIDIRUSER

13
CPA Cache: Schema Upload

© SAP AG 2003, Title of Presentation, Speaker Name / 14

„ Information on available adapter schemas


„ Important for customer and partner solutions with the PCK; it is checked if the
cacheType is „PCK“: then one can upload schema with
http://<host>:<port>/CPACache/schemaupload.jsp
„ This is not necessary for standard SAP (technical) adapters shipped with the
PCK
„ It is planned for the future that partners deliver and deploy their metadata with
the sda-file

14
Parameter CPACache Service - SLDAccess

© SAP AG 2003, Title of Presentation, Speaker Name / 15

„ This parameter is true for J2EE based AE, i.e. false for PCK (usually no SLD
available). If the parameter is true: the SLD-address is taken from the central
exchange profile.
„ SLD access for: registration of adapters and retrieving address of XI-
components on SLD; for PCK: always „false“

15
Messaging system

1
Learning Objectives

As a result of this unit, you will:

„ Understand the basics of the messaging system,


including:

z Messaging System overview


z Message flow
z Implementation of different adapters

© SAP AG 2003, Title of Presentation, Speaker Name / 2

2
Messaging system overview

Adapter Engine Technical


adapters
XI message
Module Processor File/JDBC/JMS/
XI message
XI message Mail
Structure exit
Other...
conversion Other adapters
Convert MML/BC … without protocol
Bean message handler
AFW ListenerBean exit (Adapter RFC/SOAP/3rd
•Read agreements specific) party
•Read channels
XI message
XI message
Adapter with
ListenerBean protocol handler
XI
“adapter” RNIF/BC/CDIX
XI message
Protocol handler MML/BC … Protocol handler
message
Configuration
Configuration
API
XI SPI SPI
URL Sequencer for EOIO URL
IS servlet servlet
Scheduler retry/EO Send via HTTP
Send via HTTP
Receive/Send Queue CPA
CPA
Cache
Cache Store

Cache update
XML
IB Directory
PCK DB
© SAP AG 2003, Title of Presentation, Speaker Name / 3

3
Message status in MDT - Prerequisites

ƒ Open Runtime Workbench (RWB)


ƒ Select Message Monitoring
ƒ select adapter engine

© SAP AG 2003, Title of Presentation, Speaker Name / 4

4
Example

ƒ you can use a simple file sender / receiver scenario to test the display of status

ƒStart (activate) the sender and receiver channel

ƒStart (activate) only the sender channel, deactivate receiver channel

ƒ Start (activate) the receiver channel again


ƒ press button after selecting the message in “wait” mode

© SAP AG 2003, Title of Presentation, Speaker Name / 5

„ After stopping the receiver channel the message can not be delivered by the
adapter engine
„ The status “Delivering” is shown only for a short period while trying to deliver
the message
„ Status changes to “wait” when message can not be delivered

5
Status overview of messages in MDT

FAIL

Delivery exception

Worker thread successful


TBDL DLNG DLVD
Scheduler/ Admin action

EOIO, wait for other message


Recoverable exception WAIT
HOLD

Max. retries exceeded


NDLVD
Admin action

© SAP AG 2003, Title of Presentation, Speaker Name / 6

„ TBDL : ToBeDeLivered, can only be seen as long as no worker thread has


started to process the message
„ DLNG: DeLiverNG
„ DLVD: DeLiVerD
„ HOLD: status if message waits for predecessors in EOIO mode
„ FAIL : a delivery exception occurred , no retry possible
„ WAIT:a recoverable exception occurred, retry possible, automatic retry by
scheduler or manual retry by admin action
„ NotDeLiVereD: maximum retries to deliver the message exceeded, can be
restarted by admin action

6
RFC to Webservice: Invoking a remote enabled function module in SAP WebAS

Overview

The purpose of this exercise is to implement a synchronous execution of a webService using


RFC from a R/3 system via XI. As a result of this exercise, you will become familiar with the
basic sequence of steps to implement a simple interface with XI along with RFC sender adapter
and SOAP receiver adapter. This exercise will also introduce you to browse, inspect and export
WSDL for any remote enabled functions in a Web Application Server & import of WSDL
documents into integration repository.

SAP Remote enabled


R/3 4.6C function in SAP
RFC SOAP WebAS exposed
as a Webservice

ZUSER_GET_DETAIL BAPI_USER_GET_DETAIL

Prerequisites

Basic knowledge of XI architecture.

Description
In the R/3 system (Sender) a remote enabled function module is executed passing the user name
as a parameter. The call is sent to XI (Request message), which maps the data, and executes a
webservice (which is a remote enabled function module in a SAP Web Application Server,
Receiver). The details about the user are then retuned to the caller. XI again maps the data
(Response message) to match the format of the sender function.

All remote enabled function modules in Web Application Server (6.20 & above) are available as
webservices & the WSDL (WebserviceS Description Language) are available in the Web service
repository at:
http://<host>:<port>/sap/bc/bsp/sap/webservicebrowser/search.html

The http port can be found using transaction code SMICM.


Inspection of Wsdl: By clicking on the wsdl link the WSDL is displayed in the browser. Do a right
click, & select view source. Then save the WSDL locally and we will use this to import into the
repository.

The webservice for BAPI_USER_GET_DETAIL will be invoked from R/3 system using an RFC.
The input parameter for this webService is a user id (USERNAME) in the target system and it
returns all the pertinent information about this userid. If an invalid Userid is entered, then a
message User xxxxx does not exist is returned in table RETURN.

Exercise steps
1. In the sender R/3 4.6C system, create a remote enabled function
ZUSER_GET_DETAIL_XX (where XX is your group number). Goto transaction
SE37 and enter BAPI_USER_GET_DETAIL. Use the copy function to copy this
function to ZUSER_GET_DETAIL_XX . Use function group ZATP. In change
mode, goto Source code tab and delete all executable lines of code. It has the
exact import/export/tables parameter values as BAPI_USER_GET_DETAIL
function.

*Please note, as a general rule, all development and configuration objects in XI are CASE-
SENSITIVE.

Step 1 – SLD:
Creating Technical system, business system and the Software component version are not in the
scope of this exercise.

Step 2 – Repository

2.1 From the Integration Builder home page, select “Integration Repository”. This will launch
the Java Web Start application. Log in with your user ID and password.

2.2 Please locate the Software component ATP and your namespace.

2.3 In the left-hand frame, find the software component “ATP” and expand it. Right click on
the Imported objects and click on Import of SAP Objects.

2.4 Log on to the Sender R/3 system and import the RFC ZUSER_GET_DETAIL_XX.
2.5 Under your namespace in the left frame, expand the node “Interface objects”.
2.6 Create under external definitions using the WSDL provided. Right click on External
definitions and click on New. Create a new External Definition called
BAPI_USER_GET_DETAIL. Import the WSDL file (saved in the previous step). Make
sure the Category is WSDL. Make sure the request and response messages are defined
as below.

2.7 Create a new message interface.

2.7.1 In the left frame, right-click on the node “Message Interface” and select “New”.

2.7.2 The name of the message interface will be “User_Display_In”.

2.7.3 Choose Inbound for the Category and synchronous for Mode in the definitions tab. The
input message type should reference the BAPI_USER_GET_DETAILInput from the
external definitions and output message type should reference
BAPI_USER_GET_DETAILOutput, again from the external definitions. Save the object.

2.8 Create a message mapping.


2.8.1 In the left frame right click on the node, message mappings under mapping objects and
create a new message mapping.
2.8.2 Create a message mapping User_display_Requestmap_XX. This maps the record
structure of the ZUSER_GET_DETAIL_XX to the record structure of the input message
of the WSDL at the time of the request message processing.
2.8.3 For the source of the mapping choose RFC ZUSER_GET_DETAIL_XX structure from the
XI RIG US workshop base comp and for the target choose the external definition of
BAPI_USER_GET_DETAILInput.

Mapping:
2.8.4 Begin the mapping step, by creating a request mapping object
User_display_Requestmap_XX. Since this is request side of mapping we have to map
only the USERNAME field. Save the object after mapping is done.

2.8.5 Create another message map with the name “User_display_Responsemap_XX”. The
source structure is ZUSER_GET_DETAIL_XX.Response and the source will be the
output structure of from the External Definition. (BAPI_USER_GET_DETAILOutput)

2.8.6 Since some the names and structures are same, we can make use of a mapping feature
wherein, the fields with same names and similar structure will get mapped automatically.
To do this, highlight the top nodes as shown above and click on icon at the top of the
screen. All the field which have the same name will get automatically mapped. Save the
object.

2.9 Now create an interface mapping.

2.9.1 Create a new interface mapping “User_display_Interfacemap_XX” by right clicking on the


interface mapping on the left frame.
2.9.2 As source interface, select the ZUSER_GET_DETAIL_XX (response). For the target
interface, select User_Display_In message interface that was created earlier from your
own namespace.

2.9.3 Hit the refresh button below to populate the Source and Target messages. Provide
“User_display_Requestmap_XX” for the Request and “User_display_Responsemap_XX”
for the Request & Response mapping programs respectively.

Save the object. This concludes the steps required in Integration Builder Design.

2.9.4 Finally, go to your change list and activate it. This concludes the steps required in
Integration Builder Design.

Step 3 – Directory

3.1 From the Integration Builder home page, select “Integration Directory”.
3.2 Create a new scenario for the work in directory & and name is
ATP_RFC_Webservice_XX. Please make sure all the objects created below are added to
this scenario.
3.3 If the sender business system is not added to the scenario please do so
3.4 We have to create two communication channels. A communication channel is essentially
a physical connectivity to/from the application system. This is where the adapter
configuration takes place.
3.5 Create a new Communication Channel under Sender system called “Sender_RFC_XX”
for this exercise. Expand “Service without party” ATP_RFC_Webservice_XX and further
expand “Business System” and right click on Communication channel & click on New.
Communication Channel: Sender_RFC_XX and choose create.

3.6 In the Edit Communication Channel provide following parameters:


- Adapter Type: RFC
- Choose Sender
- Transport protocol: RFC
- Communication protocol: RFC (RFC-XML)
- Adapter Engine : Integration Server

3.6.1 For the RFC Server Parameters, provide the following values.
3.7 If the receiver business system is not added to the scenario please do so.

3.8 Create a new communication channel Soap_Receiver_XX


Adapter Type: Soap
Choose Receiver
Transport protocol: HTTP
Message protocol: Soap 1.1
Adapter Engine : Integration Server

Target url:
http://iwdf5238.wdf.sap.corp:50080/sap/bc/soap/rfc/sap/BAPI_USER_GET_DETAIL/?sap
-client=800
Provide a valid user id & password.

3.9 Next step is to create a “Sender Agreement” object. This defines a binding between the
sender communication channel and the outbound interface.
3.9.1 On the left frame, right-click on the “sender Agreement” Æ New.
3.9.2 Fill in the following values on the pop-up screen.
3.10 Create a new receiver determination. Receiver determination defines a binding between
the communication channel you just created, and the inbound interface.
3.10.1 In the left frame, right-click on “Receiver Agreement” Æ New.
3.10.2 Specify the following parameters:
- Sender Service: Sender Business system
- Sender interface: ZUSER_GET_DETAIL_XX
- Receiver Service: Receiver Business system.

3.11 In the following steps, you will create an “Interface Determination” object. Now that we
have defined a receiver for the message, we need to assign an inbound interface, and an
interface mapping (if necessary).

3.11.1 In the area “Configuration Overview for Receiver Determination” at the bottom of your
screen, hit refresh.
3.11.2 In the column “Receiver (Partner/Service)” right-click and select “New Specific”, in order
to create a new interface determination object.
3.11.3 You are now in the screen “Edit Interface Determination”. In the section “Configured
inbound interfaces” select the following using F4 help. When you are done, please save
the Interface Determination object.
- Inbound interface: User_Display_In
- Interface mapping: User_display_interfaceMap_XX
3.11.4 Go back to the main screen for your receiver determination. In the area “Configuration
Overview for Receiver Determination” at the bottom of the screen, hit “Refresh”.
3.11.5 In the column “Receiver Determination (Communication Channel)” right click and select
“New Specific”. Here we have to associate a receiver agreement. A receiver agreement
defines a binding between the receiver communication channel and the inbound interface
3.11.6 In the screen “Edit Receiver Agreement”, for the field “Receiver Communication Channel”
use the input help (F4), and select the communication channel “Soap_Receiver_XX”. Fill
in the values as below.

3.11.7 Save the Receiver Agreement.

3.12 Go back to the main receiver determination screen and refresh. Your configuration is now
complete. Go to change lists and activate your objects.

Step 4 – Testing

4.1 Log on to Sender system


4.2 Create a RFC destination using transaction code SM59.
4.3 Create a new destination.
4.4 Connection type: T
Click on Registration button and provide the Program id that was used in the creation of the
RFC communication channel.
4.5 Testing is very straight forward for this exercise. Go to SE37 transaction in Sender system
and input “ZUSER_GET_DETAIL_XX” for the Function Module name.. Execute (F8)
4.6 Provide the name of the RFC destination from the above step in the RFC Target sys Input
any valid user id in the Username field for ex, (XIRWBUSER), and also provide a destination
name of “RFC2FN4” for the RFC target system. Hit execute.
4.7 Upon execution all the integration server steps will be carried out and a webService call using
SOAP adapter should be made and the results will be displayed.

4.8 Inspection of payload: Log in to the integration server and execute transaction code
SXMB_MONI to monitor the processed XML messages.

4.9 Fill in the sender values appropriately so that you are looking at the messages you have
processed.
4.10 The request message looks as below:

4.11 The response message is as below: (Only a snippet of the message is shown below.)
Further testing:
What do you think will happen if an invalid user id is provided?
File to JDBC: Using Structure conversion and utilizing built-in EO processing in JDBC
adapter

Overview

The purpose of this exercise is to implement an asynchronous scenario where a file adapter
sends data in a comma delimited format; the file adapter performs structure conversion and
converts contents of the file into XML format and sends to the integration engine. The data is then
mapped to the jdbc XML SQL format and sent to the jdbc receiver.
As a result of this exercise, you will become familiar with configuring a file adapter to perform
structure conversion and mapping the data to XML SQL format. The exercise also takes
advantage of the built in Exactly Once (EO) processing capabilities of the JDBC adapter.

File ystem

File JDBC

Exactly Once Processing - Background


As in the other adapters, Exactly Once messages are handled by default using status information
in the J2EE server. All adapter error statuses and program terminations initialized externally are
also handled in this mode. However, this does not include external program terminations during
a database commit. In this case, the status of message processing is unclear since it can only be
changed once the database commit has been completed.

The receiver JDBC adapter has two persistence modes that enable Exactly Once processing:
Local
Database
In the past, with the J2SE Adapter Engine, Local meant that EO handling was file based (i.e.
status information management was maintained within the local file system). This caused
security concerns and was generally considered unsafe. In Database mode, message
processing and status information management took place in the same database allowing the
processing steps to have the same commit cycle and eliminating any doubt in EO handling.

With XI 3.0, since the J2EE Adapter Engine is deployed on top of the J2EE engine (which also
has database persistence) the EO handling in Local mode is now also database based and in
one database transaction with the message processing including the message persistence. This
makes the Local mode EO handling just as reliable as Database mode EO handling.

Note: Currently, the Database mode has not been implemented. It will be enabled for SP9.
Prerequisites

Basic knowledge of XI architecture & databases.

Description

A table VendorMaster in the SQL server is created as below. In this table we will store the
vendor data.

Exercise steps

*Please note, as a general rule, all development and configuration objects in XI are CASE-
SENSITIVE.

Step 1 – SLD:
Creating a technical system, business system and the software component version are not in
scope for this exercise.

Step 2 – Repository

2.1 From the Integration Builder home page, select “Integration Repository”. This will launch
the Java Web Start application. Log in with your user ID and password.

2.2 Under your namespace in the left frame, expand the node Data types. Please inspect the
data types Vendor & Vendor_SQL. Please pay special attention to Vendor_SQL. Data
type Vendor is used to describe the data sent by the file & Vendor_SQL is used to
describe the data in XML sql format. We will be using this format to write to the database
using JDBC adapter.

2.3 Two message types with the same name as the data types are created.
2.4 Create 2 new message interfaces; Vendor_out_XX is outbound asynchronous using the
message type Vendor & Vendor_SQL_in_XX is inbound asynchronous using the
message type Vendor_SQL.

Message interface: Vendor_out_XX

Message interface: Vendor_SQL_in_XX

2.5 Create a message mapping.

2.5.1 In the left frame right click on the node, message mappings under mapping objects and
create a new message mapping.

2.5.2 Create a message mapping VendorFile_VendorJdbc_XX. This maps the data from the
XML format converted from the file to the XML sql format the JDBC adapter accepts.
Drag the source fields to the target fields as shown. To map the attribute “action” , drop a
constant and change the default value of the constant to “update_insert” and map the
constant to action.

Save the object.

2.6 Now create an interface mapping VendorFile_VendorJdbc_XX.

2.6.1 Create a new interface mapping VendorFile_VendorJdbc_XX by right clicking on the


interface mapping on the left frame.

2.6.2 As source interface, select Vendor_out_XX from your SWC. For the target interface,
select Vendor_SQL_in_XX message interface that was created earlier from your own
namespace.
Hit the refresh button to populate the Source and Target messages. Associate the
message mapping VendorFile_VendorJdbc_XX.

Save the object.

2.6.3 Finally, go to your change list and activate it. This concludes the steps required in
Integration Builder Design.
Step 3 – Directory

3.1 From the Integration Builder home page, select “Integration Directory”.

3.2 Create a new scenario for the work in the directory and name it ATP_File_JDBC_XX.

Please make sure all the objects created below are added to your scenario. If it is not,
you can do this from the “Objects” tab by navigating to the object, bringing up its context
many and selecting “Add to Scenario…”. Select your scenario.

3.3 We have to create two communication channels. A communication channel is essentially


a physical connection point to/from the application system. This is where the adapter
configuration takes place. The two business systems we are going to use are
ATP_File_Sender and ATP_Jdbc_Receiver. In the ATP_File_Sender business system,
we will create a sender communication channel of type File and in ATP_Jdbc_Receiver
we will create a receiver communication channel of type JDBC. The business systems
are already created. Just add them to your scenarios.

3.3.1 Create a new Communication Channel for ATP_File_Sender called “File_Sender_XX”.

Expand Service Without Party Business System ATP_File_Sender. Right-click on


Communication Channel and select “New…”. Name your Communication Channel
File_Sender_XX and choose “Create”.

3.3.2 In the Edit Communication Channel screen, provide the following parameters:

Adapter Type: File


Choose Sender
Transport Protocol: File System (NFS)
Message Protocol: File Content Conversion
Adapter Engine : Integration Server

File System Access Parameters


Source Directory* //<hostname>/<instructor designated directory>
File Name* VendorXX.txt
You can copy & paste into the Row.fieldNames value the following:

VendorNumber,LastName,SearchTerm,Currency,Street,City,Zip,Country

Take a moment to compare this with the data type in the repository. See how the
document name and namespace and other values here are used in the datatype.

Note the large Poll Interval. For testing purposes, we want to set an unusually high
interval to avoid inadvertent messages being sent continuously. While testing this
scenario, sending of the file will be very deliberate by manually copying the test file into
the source directory and reactivating the communication channel as described below in
the testing section.

3.3.3 Create a new Communication Channel for business system ATP_Jdbc_Receiver called
Jdbc_Receiver_EO_XX using the following parameters:

Adapter Type: JDBC


Choose Receiver
Transport Protocol: JDBC 2.0
Message Protocol: XML SQL Format
Adapter Engine : Integration Server

Connection*:

jdbc:microsoft:sqlserver://iwdf5210.wdf.sap.corp:1433;DatabaseName=Northwind

The instructor will provide you a user id & password.


This is where you select the persistence mode for EO handling as described in Exactly
Once Processing Background in the beginning of the exercise. As a reminder,
Database mode is currently not implemented.

3.4 Next step is to create a “Sender Agreement” object. This defines a binding between the
sender communication channel and the outbound interface.

3.4.1 On the left frame, right-click on the “Sender Agreement” New.


3.4.2 Fill in the following values on the pop-up screen for the sender agreement and click
“Create”.

3.4.3 Enter “File_Sender_XX” for Sender Communication Channel and save.

3.5 Now create a “Receiver Agreement” object. This defines a binding between the receiver
communication channel and the inbound interface. This will allow you to assign a receiver
communication channel to the receiver service/interface you have chosen.

3.5.1 On the left frame, right-click on the “Receiver Agreement” New.

3.5.2 Fill in the following values on the pop-up screen and click “Create”.
3.5.3 Enter “Jdbc_Receiver_EO_XX” for Receiver Communication Channel and save.

3.6 Create a new Receiver Determination. Receiver Determination defines a binding between
the communication channel you just created, and the inbound interface.
3.6.1 In the left frame, right-click on “Receiver Determination” New.

3.6.2 Specify the following parameters in the pop-up and click “Create”.

3.6.3 For Configured Receivers, select Service ATP_Jdbc_Receiver and Save. Remain on the
Receiver Determination screen.
3.7 In the following steps, you will create an “Interface Determination” object. Now that we
have defined a receiver for the message, we need to assign an inbound interface, and an
interface mapping (if necessary).

3.7.1 In the area “Configuration Overview for Receiver Determination” at the bottom of your
screen, hit refresh.

3.7.2 In the column “Receiver (Partner|Service)” right-click and select “New Specific”, in order
to create a new Interface Determination object.

3.7.3 You are now in the screen “Edit Interface Determination”. In the section “Configured
Inbound Interfaces” select the following using F4 help. When you are done, please save
the Interface Determination object.

Inbound Interface: Vendor_SQL_in_XX

Interface Mapping: Jdbc_Receiver_EO_XX

3.8 Go back to the previous Receiver Determination screen and click on the refresh button
within the Configuration Overview for Receiver Determination section at the bottom.

Your configuration should now be complete. Activate your objects.


Step 4 – Testing

4.1 When the file VendorXX.xml is placed in the Source Directory of the sender file adapter
(as specified in the Communication Channel ‘File_Sender_XX’), the file adapter picks up
the file and processes it.

Hint: In order to reset the polling cycle of the inbound file adapter, you must go back to
the Integration Directory and reactivate your communication channel ‘File_Sender_XX’
under your business system ‘ATP_File_Sender’. As soon as the file sender
communication channel is activated and is replicated in the adapter engine cache, the
polling cycle will start (this could take a few seconds).

4.2 Monitor your directory. The file should disappear after a few seconds. This means that it
was processed and then deleted by the adapter engine.

4.3 Log on to the XI Integration Server, choose monitoring Integration Engine monitoring
(or execute transaction SXMB_MONI).

4.4 Choose “Monitor for Processed XML Messages”. You can filter using different criteria, for
example by date and also by sender service (find your own business service name in the
drop-down list). In the monitor, look for your message being sent to the JDBC adapter.
Inspect the message for any errors.

4.5 In the Runtime workbench, under ‘Message monitoring’, select messages from
component ‘af.<SID>.<host>’ (this represents the central adapter engine.) Using the filter
configuration, find your message ID in the list. Select your message, and click ‘Details’.
From the details screen you can select ‘Audit Protocol’ for more information regarding the
status of your message and the JDBC post.

4.6 To verify that the data is posted to the SQL server please execute the following url:
(Replace Last_Name with the name you entered in the file)
http://<hostname>:<port>/Northwind?sql=SELECT+*+FROM+VendorMaster+WHERE+L
ast_Name='Smith'+FOR+XML+RAW&root=ROOT

Sample Result:
<?xml version="1.0" encoding="utf-8" ?>
<ROOT>
<row Vendor_Number="301000" Last_Name="Smith
Search_Term="John" Currency="USD" Street_Address="3421
Hillview" City="Palo Alto" Zip="94304" Country="US" />
</ROOT>
XI 3.0 Sales Order example of a BPM scenario

System Access
...

1. Choose the tab page in the Demo Database.


To display the info in an extra window, double-click on IDES Exchange Infrastructure Demo
Systems.

Purpose

Sales orders arriving from different systems arrive in XI and a credit check is performed. This credit
check is not shown in the demo. If the credit check fails the sales orders are collected in pairs and
sent to a central CRM system where the priority can be decided upon using a simple form (via a
workflow which is triggered in this CRM system). If the order is low priority the workflow replies to XI
and the sales order is cancelled. High priority orders will be sent for approval and the result of this
workflow is returned to XI. If approved, the order is sent by XI to R/3 for production and delivery.
This is a technical demo showing the integration between cross-component business processes
and local human workflow processes. The cross-component process is triggered by sales orders
coming from different systems, which are combined into one temporary order that triggers a
workflow process to approve or reject the sales order where credit check failed. Normally workflow
deals with references to the business objects but in this case because some of the orders come
from legacy systems the data has to be displayed in a form.

Data Overview

Logon to the following systems using the details provided herewith

Sys-ID: DC8 XI 3.0


Client 800 Integration Server
User: DEMO / WELCOME
Sys-ID: FEZ CRM 4.0
Client 800 Custom workflow to set priority
User: DEMO / WELCOME or
RILKEE / WELCOME
User: BENDERT / WELCOME

Created 27.09.2004 Page 1 of 22 IDES


x_Demo_XI30_Integration.doc
Process Flow

Swimlane view showing the scenario composition.

Business Analyst view in ARIS

Created 27.09.2004 Page 2 of 22 IDES


x_Demo_XI30_Integration.doc
Created 27.09.2004 Page 3 of 22 IDES
x_Demo_XI30_Integration.doc
Workflow Process

XI Tom Elke
(Sales Director) (Key Accounts)

Trigger Workflow

Prioritize

Approve

© SAP AG 2004, Title of Presentation / Speaker Name / 1

1. Prerequisite – Make sure no instances are already running.


Log on to FEZ 800 for users BENDERT (password WELCOME) and RILKEE (password
WELCOME) and make sure that there are no workflows from this scenario currently running.
To do this, you should log in to the respective inboxes (transaction SBWP as in phase 4) and
execute any work items found there.

For checking if there are any running workflows under these user names do the following steps
1) Logon to the CRM system using the user RILKEE and

2) Choose the favorite SAP Business Workplace from the favorites list

Created 27.09.2004 Page 4 of 22 IDES


x_Demo_XI30_Integration.doc
3) Open the Inbox of user Rilkee and check if there are any existing workflows

4) In the above screen shot you see that there is still one workflow.
5) In this case select this workflow and hit the execute button and set the corresponding action
for the workflow and save the same
6) Make sure that there are no items within the workflow for the rest of the demo to work fine.
7) The same set of steps should also be repeated for user BENDERT (password WELCOME)
and see if there are any open workflows.

2. Creating a Sales Order in CRM


1. Login to the CRM system (FEZ, client 800) with user DEMO (or RILKEE), password
WELCOME
2. Execute transaction CRMD_ORDER

Created 27.09.2004 Page 5 of 22 IDES


x_Demo_XI30_Integration.doc
3. Choose F5 and create a new sales order
4. Enter the Sold-To-Party 3028
5. Enter Employee Responsible HT0001
6. Enter product ID XI328 and enter the quantity.

7. Goto tab Organization and enter the following information

Created 27.09.2004 Page 6 of 22 IDES


x_Demo_XI30_Integration.doc
Organizational unit - Group D1.

8. Save the Sales Order.

Created 27.09.2004 Page 7 of 22 IDES


x_Demo_XI30_Integration.doc
Note down the transaction number that is created when you save the order. This is
needed to monitor the sales order in R/3.
You must create two orders so that the BPM will start processing the orders in XI.
9. For creating the second sales orders use the same master data as used in the above example
the only difference needs to be for the quantity of the product which can be something different.
Note down the transaction number for the second order created as well.

3. Setting the Priority of the Combined Sales Order


Perform the following actions in the CRM system
...

1. Log on to CRM (FEZ) with user RILKEE (Ellen Rilke), client 800 and password WELCOME.
(or user DEMO password WELCOME).
CRM
Call the Business Workplace

2. Click on the Inbox branch of the navigation tree and you will see your work items in the top right
hand frame (‘Set priority…).

3. Double-click on the first work-item or click on the execute button above it so that it is executed
and you are shown the form. This form displays information from the two sales orders and
allows Ellen to select a priority.

4. Set the priority high (less than 5) if you want an additional approval step, otherwise set the
priority low (6-9). However, if the priority is low the sales order will be cancelled by XI and NOT
sent to R/3 for production and delivery. If you are familiar with workflow you could create an
attachment via the Workflow Toolbox at this point.

Save the changes ( ) and return with this button ( ). The work item will have disappeared
from your inbox.

Created 27.09.2004 Page 8 of 22 IDES


x_Demo_XI30_Integration.doc
5. Click on the Outbox branch of the navigation tree in the Business Workplace and click on the
log button shown in the top right hand frame (after first selecting the correct work item). The
outbox shows you the tasks that Ellen has performed and the log will allow you to check that it
has gone to be verified.

6. You can see from the log that a second step has been created for the priority to be verified.
Note: This log is also directly available in the workflow toolbox tabstrip in the form.

Created 27.09.2004 Page 9 of 22 IDES


x_Demo_XI30_Integration.doc
7. Log off the CRM system.

4. Approving the Combined Sales Order


(or use the alternative described in phase 6)
This approval step will be skipped if a low priority was suggested in the previous step (and the
sales order will be rejected automatically).

1. Logon to the CRM system (FEZ) client 800 with the manager BENDERT (Tom Bender) password
WELCOME.

2. Navigate to his Business Workplace using this button and Click on the Inbox branch of the
navigation tree and you will see your work items in the top right hand frame (‘Set priority…).

3. Double-click on the work-item or click on the execute button above it so that it is executed and
you are shown the form. This form displays information from the two sales orders and allows
Tom to change the priority and approve or reject the suggestion. Rejecting it will cause it to
default to a low priority before it is returned to XI and the orders will not be forwarded to R/3.
Before approving, you can optional perform the Monitoring in Workflow scenario described next.

Created 27.09.2004 Page 10 of 22 IDES


x_Demo_XI30_Integration.doc
8. The priority and approval statues will now be transmitted back to XI where the cross-
component process will update the two original sales order with the new priority.

9. Log off the systems.

5. Monitoring the Order in XI


Logon to the XI system DC8 client 800 using the user name : DEMO and password : WELCOME

1. Choose transaction SXMB_MONI


2. Double-click on Monitor for Processed XML Messages.

3. On screen XML Message Processing choose Execute (F8)


You can now see two messages (one for each sales order created), in XI.

Created 27.09.2004 Page 11 of 22 IDES


x_Demo_XI30_Integration.doc
4. Select the first message and choose .
5. To see the receiver choose

You can see the recipient of the message as the business process (OrderProcessing)

6. XI now triggers the CRM workflow via a proxy. You will need interrupt this phase and
complete phases 2 and 3 before continuing to look at the log in this screen.

Created 27.09.2004 Page 12 of 22 IDES


x_Demo_XI30_Integration.doc
7. Once the order is approved in the CRM workflow, the approval is sent back to XI via an
outbound proxy and the two orders are sent to R/3 for confirmation.

In the above screenshot, the red rectangle depicts the approval that arrives in XI via the proxy from
the workflow while the blue rectangle depicts the two orders being sent to the R/3 backend via the
business process.
Created 27.09.2004 Page 13 of 22 IDES
x_Demo_XI30_Integration.doc
8. If the order is rejected in the workflow, the rejection message arrives in XI and is then sent
back to CRM by the business process.

In the above screenshot, the red rectangle represents the rejection message that arrives in XI from
the workflow while the blue rectangle represents the rejected orders being sent back to CRM.
9. When the order is opened in CRM, the status Rejected can be viewed in the order.

Created 27.09.2004 Page 14 of 22 IDES


x_Demo_XI30_Integration.doc
Created 27.09.2004 Page 15 of 22 IDES
x_Demo_XI30_Integration.doc
6. Monitoring in Workflow
(optional – addition to phase 4 or 6)

Usually you can navigate directly from the business object or form to the process log as shown in
this optional step.
1. When displaying the form, click on the Workflow Toolbox

2. Select the log icon to view the log

3. You can see the steps that have taken place so far and who did them when. To see a
detailed view click on the step you are interested in.

Created 27.09.2004 Page 16 of 22 IDES


x_Demo_XI30_Integration.doc
4. In this case you can see that Ellen has added an attachment to the process (which was also
displayed in the inbox and the main toolbox panel)

This shows how the users involved in a process can navigate directly to the process log and
drill down to the detail they require.

7. Execution of the approval in the Universal Worklist


(optional alternative to phase 5)
This approval step will be skipped if a low priority was suggested in the previous step (and the
sales order will be rejected automatically).

The Portal currently configured is the portal at http://idesportals6.wdf.sap.corp:1080/ (or use the
test portal http://idesportalt6.wdf.sap.corp:1080/ ).
1. Log on to the portal with user BENDERT password welcome.

2. Navigate to the Universal Worklist and select the work item as shown below.

Created 27.09.2004 Page 17 of 22 IDES


x_Demo_XI30_Integration.doc
3. You can now process the work item as described in the section “Approving the Priority of the
Combined Sales Order”. You can also monitor the progress of the process with the section
“Monitoring in Workflow (optional)”.
4. When you have finished press the “approve” button and press the “return” button shown at
the bottom of the screen.

Created 27.09.2004 Page 18 of 22 IDES


x_Demo_XI30_Integration.doc
8. Ad Hoc Workflow
(optional – addition to phase 6)

1. You can create and ad hoc workflow from the Universal Worklist by selecting the Ad Hoc
Workflow button as shown below.

2. Just follow the wizard to create a simple two step workflow. Use the “Work task” task type to
create the simplest workflow.

9. Viewing the Order in R/3


1. Choose the transaction VA03
2. Enter the value of the transaction number copied during order creation in CRM into the field
‘Purchase Order No.’ Prefix this value with three zeros. Choose the ‘Search’ button

Created 27.09.2004 Page 19 of 22 IDES


x_Demo_XI30_Integration.doc
This opens the order that you created and is displayed with the details.

Created 27.09.2004 Page 20 of 22 IDES


x_Demo_XI30_Integration.doc
End of script

Created 27.09.2004 Page 21 of 22 IDES


x_Demo_XI30_Integration.doc
Created 27.09.2004 Page 22 of 22 IDES
x_Demo_XI30_Integration.doc
Exercise – Business Process Management – Collect master records

Overview

In this exercise we continue to focus on the Business Process Management capabilities of XI 3.0.
The goal is to implement a simple, stateful process. As a result of this exercise you will be able to
model a “collect” pattern using BPM and apply it to IDoc communication. You will become familiar
with the concept of correlation, and multi-mapping (N:1 mapping).

Prerequisites

- Good understanding of basic XI features


- Good understanding of basic BPM features

Description

The requirement is to collect incoming vendor master records. The incoming messages arrive via
the file adapter (or, for testing purposes, the plain HTTP adapter). After a certain number of
messages are collected, they are bundled and mapped to a package of IDocs. This package of
IDocs is then posted into the R/3 system via the IDoc adapter.

The number of messages to be collected can be determined in one of three ways:


a) a fixed number is explicitly specified (e.g. “collect 5 messages”)
b) a relative or absolute time limit is set (e.g. “collect until 3PM” or “collect for 3 hours”
c) messages are collected indefinitely, until a certain trigger (a specific interface type) is
received (e.g. “collect messages of type A UNTIL a message of type B arrives”).

The standard BPM collect patterns are already predefined any new XI 3.0 installation. The focus
here is on the customer requirement for XI to post IDocs into R/3 as packages and yet being able
to handle each of them individually.

For the purpose of this exercise we will implement option (a) above, for simplicity reasons.
Options (b) and (c) can be implemented as optional exercises.

In this exercise you will see that, when implementing BPM, the bulk of the work does not
necessarily take place within the business process modeler itself. Preparing all the surrounding
objects in the Repository and Directory may require just as much time and effort.

Exercise steps

Step 1 – Repository

Prepare interface and mapping objects

1.1 Prepare interface objects.


1.1.1 in the Integration Repository there is a namespace “urn:sap-
com:atp:TBIT44:base” in out software component “TBIT44, 2004 of SAP”, which
contains objects which are prepared for this exercise and needn’t be created
manually.

1.1.2 Create the outbound interface Vendor_out_collect used for vendor information in
this exercise. Reuse the Output Message “Vendor” from the “urn:sap-
com:atp:TBIT44:base”
1.1.3 Business Processes only work with abstract interfaces. Create an abstract,
asynchronous interface called CREMAS (based on single IDoc CREMAS03,
which is located under “imported objects”). This will be the input to the process.

1.1.4 Examine the structure of the imported object “CREMAS.CREMAS03”. It can only
be used as a single IDoc and not as a package. Therefore it cannot be used as-is
for the target of the 1:N mapping and the output of the business process. We
need to use a manual workaround to create a structure able to handle packages:

1.1.4.1 Export the XSD definition of the IDoc onto your desktop

1.1.4.2 Edit the XSD definition and make the following change:

<xsd:element name="IDOC" type="CREMAS.CREMAS03"


minOccurs="1" maxOccurs="unbounded" />
1.1.4.3 Create an external definition object called CREMAS_package. Import the
modified XSD.

1.1.5 Create an asynchronous abstract interface CREMAS_package (based on the


object CREMAS_package from the previous step). This will be the output of the
business process.

1.1.6 Create the Interface mapping Vendor_out_CREMAS03_abstract in the. This will


be the mapping applied between the sender and the BPM (before entry into the
BPM).
Source interface: Vendor_out_collect (outbound, asynchronous) from
your namespace
Target interface: CREMAS (abstract, asynchronous) from your
namespace
Message mapping: Select the existing Message Mapping
Vendor_CREMAS03 from the urn:sap-com:atp:TBIT44:base
namespace
1.1.7 Now we will create a N:1 mapping (multi-mapping) which will be applied within
the BPM. The input is an array of individual IDocs, and the output is an IDoc
package.

1.1.7.1 Create a new message mapping CREMAS_multi_package.


Source message: CREMAS.CREMAS03 (original IDoc)
Target message: CREMAS03 (from external definition object
CREMAS_package)

1.1.7.2 Goto the “Messages” tab and change the occurrence of the source
message to “0..unbounded”. This defines the mapping as N:1 mapping.

1.1.7.3 Map the node “CREMAS03” from the source document to the structure
“IDOC”. This indicates that the root of each source message should be
mapped to an IDOC node in the target
1.1.7.4 In the target message, disable the node “EDI_DC40”.
1.1.7.5 Assign the constant “1” to the target attribute “BEGIN”.
1.1.7.6 The rest of the mapping can be completed automatically:
Highlight the nodes “E1LFA1M” in the source and target document
Click on the button (“map selected fields and substructures if
names are identical”).
Verify that all fields were mapped correctly.

1.1.7.7 Test your mapping with multiple source messages

1.1.8 Create an interface mapping CREMAS_multi_package.


Source interface: CREMAS (abstract)
Target interface: CREMAS_package (abstract).
Mapping program: CREMAS_multi_package (created above.)

For the source interface remember to change the Occurrence to “0..unbounded”, in order
to match the message mapping.
1.1.9 Create a context object called zipcode (type String).

1.1.10 In your abstract interface CREMAS associate the context object “zipcode” to field
PSTLZ in segment E1LFA1M. We will use this as correlation id in BPM to
correlate the messages.

Step 2 – BPM

2.1 Create a Business Process object “CREMAS_collect_package”

2.2 Create container variables:


- counter (Category: Simple type; Type: XSD:Integer)
- CREMAS_single (Category: Abstract interface; Type: CREMAS)
- CREMAS_multi (Category: Abstract interface; Type: CREMAS; Multiline Checked)
- CREMAS_package (Category: Abstract interface; Type: CREMAS_package)

2.3 Create the correlation object

2.3.1 Switch to the correlation List

2.3.2 Create a correlation object named “zipcode” and click on the details icon. This
will display the correlation editor screen. Here more details about the correlation
can be entered.

2.3.3 Specify the following:

- Correlation Container: enter the name “zip” (type xsd:string)


- Involved messages: select “CREMAS”
- Properties: assign your context object as the value for the correlation container “zip”.
You context object should appear in the condition editor.
2.3.4 The correlation editor screen should look as follow, after the correlation is
defined:

2.4 Switch to the Graphical Definition mode and compose the business process flow by drag-
and-dropping each step into the desired location and filling out the parameters as
specified below:

- Loop step – this step will ensure that we will collect exactly 3 IDocs.
(“Loop 3 times”)
o Step name: “Loop3”
o Condition: “counter ≠ 3” (Use the condition editor to fill the condition
property.)

- Receive step – this step will receive incoming IDocs and correlate based on zipcode
(“receive single IDoc and correlate”)
o Step name: “Receive CREMAS”
o Message: “CREMAS_single”
o Start process: yes
o Use Correlations: “zipcode”
o Activate Correlations: “zipcode”.
o zipcode zip: CREMAS_single.zipcode (select your context object in the
condition editor, for container CREMAS_single.)
- Container Operation step – this step will increase the loop counter
(“counter = counter +1”).
o Step Name: “increment counter”
o Target: “counter” (simple variable)
o Operation: “Assign”
o Expression: “counter” (simple variable)
o Operator: “+”
o Expression: “1” (constant – type xsd:integer)

- Container Operation step – this step will append the newly received IDoc to the list
of IDocs already collected. A multiline container is used for this purpose.
(“Append CREMAS_single to CREMAS_multi”).
o Step Name: “Append IDoc to list”
o Target: “CREMAS_multi” (Interface variable)
o Operation: “Append”
o Expression: “CREMAS_single”.

- Transformation step – this step occurs outside the loop. It will call the N:1 mapping
which will create the IDoc package.
o Step Name: map IDocs to package
o Interface mapping: CREMAS_multi_package
o Source message: CREMAS_multi
o Target message: CREMAS_package

- Send step – this step will send the package of IDoc to the R/3 system
o Step Name: Send CREMAS package
o Mode: Asynchronous
o Message: CREMAS_package
o Acknowledgement: none
o Receiver from: send context

The completed business process diagram should look like this:

2.5 Check the process (F7) and save

2.6 Activate all Repository objects


Step 3 – Directory

3.1 Create a business process object CREMAS_collect_packageXX (under Service without


Party. XX is your Group Number). In this step import the business process created in the
repository.
3.1.1 Use the wizard and select your business process.
3.1.2 Note the signature of the process (interfaces are listed under the sender and
receiver tab)

3.2 We will create 2 receiver determinations: DMS_CRM BPM and BPM IDoc receiver.

3.2.1 DMS_CRM BPM


3.2.1.1 Create the receiver determination from DMS_CRM to BPM with the
following sender information:
Service: DMS_CRM
Outbound Interface: Vendor_out_collect
(urn:sap-com:atp:TBIT44:GroupXX:bpm_collect)

3.2.1.2 Complete the receiver determination and interface determination as


follows:
Receiver service: CREMAS_collect_packageXX (your BPM object)
Inbound interface: CREMAS
Interface mapping: Vendor_out_CREMAS03_abstract

Make sure, that you are only using object from your namespace
urn:sap-com:atp:TBIT44:GroupXX:bpm_collect (XX is your Group Number)

3.2.1.3 Notice that no receiver agreement or communication channel in


necessary when BPM is used as a receiver
3.2.2 BPM IDoc receiver
Sender service: CREMAS_collect_packageXX (XX is your Group
Number)
Outbound interface: CREMAS_package
Receiver service: <select the Business System for the R/3 client>
(e.g. T32_800)
Inbound interface: CREMAS.CREMAS03
Interface mapping: none

3.3 If necessary, create a receiver agreement for the IDoc receiver. It should point to the
existing communication channel IDoc_receiver.
Note that the IDoc adapter will lookup the logical system name of the sender from the
SLD. In this case the sender of the message is the BPM process
‘CREMAS_collect_packageXX’. This would lead to an error at runtime since there is no
corresponding entry in the SLD. The solution is to overwrite the sender service name
using the header mapping functionality.

- In the ‘Header Mapping’ section, check ‘Sender Service’.


- From the drop-down list, select the original sender ‘DMS_CRM’.

3.4 Activate all objects

Step 4 – Test

For convenience reasons, we will test with the plain HTTP client in order to send three separate
XML messages successively

4.1 From the plain HTTP client, send the first XML message as follows:
- Sender Service: DMS_CRM
- Sender Interface: Vendor_out_collect
- Interface Namespace: urn:sap-com:atp:TBIT44:GroupXX:bpm_collect (XX is your
Group number)
- QoS: EO
- As payload, please cut and paste the contents of the file Vendor[XX].xml provided by
the instructor.

4.2 Examine your message in transaction SXMB_MONI. Notice that the message was sent
to the process engine, and that the status of the workflow is ‘in process’.

4.2.1 Drill down to the workflow details


4.2.2 Display the workflow log
4.2.3 Display the technical details of the workflow log
4.2.4 Display the graphical details of the workflow log

4.3 Send a second and a third message (using the same zipcode).

4.4 Notice that the process is now in state ‘COMPLETED’ and that a new message
containing the IDoc package was sent to the R/3 system.

4.5 Check in the R/3 system in transaction WE05 that 3 IDocs were posted.
Maks sure, that you use Vendor Numbers, that are not already used in the
Backendsystem: For Example use 00099XX001, 00099XX002,.. with XX = Group
Number.

You can check in Transaction XK03, that your Vendors have been created.
.
Appendix: naming conventions and terminology

Exercise 5

Area Obj. type Object name Description


SLD BS DMS_CRM Business system for legacy app
BS. T32_800 Business system for R/3

Int. Rep. NS urn:sap- Namespace for legacy objects


com:atp:TBIT44:GroupXX:bpm_collect
Data type Vendor_DT Vendor data type
Address_DT Nested DT
Msg.type Vendor Vendor message type
Msg.int. Vendor_out_collect Copy of Vendor_out
Ext.def. CREMAS_package Modified XSD for IDoc packages
Msg.map Vendor_CREMAS03 Message mapping
Int.map Vendor_out_CREMAS03_abstract Interface mapping
Abs.int. CREMAS Single IDoc (BPM input)
Abs.int. CREMAS_package Package of IDocs (BPM output)
BPM CREMAS_collect_package BPM object
Context zipcode Context object for zip code

BPM Cont. counter Counter for received IDocs


Cont. CREMAS_single Individual IDoc
Cont. CREMAS_multi Multiline IDoc
Cont. CREMAS_package IDoc package
Correl. zipcode Correlate by zipcode
Corr.cont. zip Points to
/CREMAS03/IDOC/E1LFA1M/PSTLZ
Msg.map CREMAS_multi_package Map multiline to package
Int. map CREMAS_multi_package Interface mapping

Int. Dir scenario TBIT44_BPM_COLLECT Common for all exercises


service DMS_CRM Derived from BS (no party)
service CREMAS_collect_package[XX] Business Process
service T32_800 Derived from BS.
Int. Serv. RFC dest SM59 dest + ALE port
R/3 IDoc CREMAS.CREMAS03 Vendor master data
Log.Sys. DMS_CRM Same as above
Exercises
Sales Order Processing

1
Use Case
Other Order
System Fulfillment

Dealer Management System Supplier 1

CRM/
Catalog
Catalog

Dealer Management System Supplier 2


No-name Other
Supplier1 System
CRM
No-name
Supplier2 ERP
ERP
Dealer
No-name
Supplier3 XI/BPM Other Other
System System
EBP+
„No-name“
Catalog CRM
Order
System

Dealer Management System Supplier 3

Order Other Other


System System System

© SAP AG 2004, SAP NetWeaver Henrik Stotz 2

Car dealers could use a non-SAP CRM system to order spare parts. The
slide shows an overview of a system landscape for the procurement of spare
parts for different brands.
The interfaces to the supplier systems are usually defined by the dealer
management systems of the manufacturers. No-name products could be
controlled directly by the dealer.

2
Order
Fulfillment

Dealer Management System Supplier 1

Catalog/
CRM

ERP
ERP
Dealer
XI/BPM

© SAP AG 2004, SAP NetWeaver Henrik Stotz 3

3
Overview
CRM System AirlineGroup1 Integration Process Travel Agency
AirlineGroup2 Summer

Send items 1. Receive order


items

2. Preparations

Create materials 3. Create materials Preparations


if necessary

Create purchase 4. Create purchase


and sales order and sales order

Receive order 5. Send purchase


send confirmation order to supplier
and receive
confirmation

© SAP AG 2004, SAP NetWeaver Henrik Stotz 4

•The CRM system sends data item-by-item in a given format.


•The SAP system performs checks.
•If the CRM system sends a new material, the material will be created in two
clients.
•A purchase order and a sales order are created.
•The purchase order is sent to the supplier and the order confirmation sent
by the supplier is acknowledged.
There is one excercise for each step.

4
Integration Process

1 2 3

4 5

© SAP AG 2004, SAP NetWeaver Henrik Stotz 5

1. Receive order items


2. Preparations
3. Create materials
4. Create purchase and sales order
5. Send purchase order to supplier.

5
Web Dynpro User Interface

© SAP AG 2004, SAP NetWeaver Henrik Stotz 6

The business case for the complete process is a simplified selling of spare
parts. The spare parts are selected in a non-SAP Catalog/CRM system,
which is simulated in the exercises by a Web Dynpro user interface.

6
Exercise 1: Receive Spare Part Items

Collect pattern:
Items correlated by CustomerNo
End condition:
after sending 3 items

Asynchronous Web Dynpro - XI Communication using SOAP Adapter

© SAP AG 2004, SAP NetWeaver Henrik Stotz 7

Since the non-SAP Catalog/CRM System sends the spare part items in
individual messages, the process starts with a collect pattern. The order
items are merged into a single message which is then used in exercise 2
where the preparations in the SD system are made.

7
Exercise 2: Preparations

Returns a list of
materials that have
to be created

Transformation
step

Synchronous
send step
catches application
and
system exceptions

Application
exception

© SAP AG 2004, SAP NetWeaver Henrik Stotz 8

In this exercise, the “itemlist” is transformed to a “list”, which is sent


synchronously to the business system Airline_Group_One. The response
message contains the materials that must be created in the next exercise.
This exercise also demonstrates exception handling for application and
system errors. In case of an application exception, an alert is thrown, which
can then be reviewed in the alert inbox.
Use material 9999 to create an application exception that raises the alert
Materials 1000, 2000, 3000 will be always created if sent to the process

8
Exercise 3: Create Materials

Material1

System1
System2

Material2

System1
System2
© SAP AG 2004, SAP NetWeaver Henrik Stotz 9

In this exercise, the materials determined in the last exercise are created.
This is done by combining a block in ParallelForEach mode with a block in
ForEach mode, which loops over the list of receivers determined beforehand
(broadcast pattern).

9
Exercise 4: Create Purchase and Sales Order

• Fork for parallel processing


• Transport and application acknowledgments
• Using send contexts
• Correlation
• Container operations
• Switch
• “Manual Exception Handling”

© SAP AG 2004, SAP NetWeaver Henrik Stotz 10

In this exercise, the sales and purchase orders are created in parallel.
If one fails, both orders are canceled. As an extension of this exercise,
the creation of the purchase order part is enhanced by a manual
compensation in case the creation of the purchase order fails. The
exercise uses application and transport acknowledgments of send
messages. Moreover, send contexts are used for routing purposes.
If the Response Status field for the Purchase Order is ERROR, the
process waits for one minute.
If the error was corrected and a OK-Message has been raised
manually the Response Status field is set to OK. This
indicates that the purchase order has been corrected manually. This
correction can be done with report ZSK_STARTMESSAGE_OUT in
client 813 (!).
If you don‘t run the report, no message is received and a timeout
occures after one minute and the process is continued. In this case,
the Response Status field for the Purchas Order remains on ERROR
and both orders are cancelled in the next block.
You can force the ERROR situation for the purchase order if
CustomerNo contains a “Y“.
To create an error in the SalesOrder, CustomerNo must contain a “Z“.
If you don‘t compensate the purchase order “manually“ the process
continues after one minute.

10
Exercise 4: Create Purchase and Sales Order
“manual compensation”

Purchase order error


can be corrected
in a given timeframe
by starting the report
manually

Report executed in
time. Message sent to
the process indicating
the that purchase order
is ok. The process
PurchaseOrder
status is updated.

© SAP AG 2004, SAP NetWeaver Henrik Stotz 11

11
Exercise 4: Create Purchase and Sales Order

“Automatic compensation”

If an error in the purchase order is not


compensated “manually” (see last slide), the
Purchase Order Status flag keeps the status
ERROR for the process. If the timeout occurs, the
process continues and runs into “automatic
compensation”.

If either the purchase order OR the sales order run into an error, the
“automatic compensation” branch cancels BOTH Orders, raises an alert, and
then cancels the whole process

© SAP AG 2004, SAP NetWeaver Henrik Stotz 12

12
Exercise 5: Send Purchase Order

• Purchase order is sent


• Order confirmation is received
• Order confirmation is acknowledged

© SAP AG 2004, SAP NetWeaver Henrik Stotz 13

In this exercise, the purchase order is sent to the supplier. An order response
is received and acknowledged.

13
Runtime Example: SXMB_MONI

© SAP AG 2004, SAP NetWeaver Henrik Stotz 14

14
Runtime Example: Workflow Log

© SAP AG 2004, SAP NetWeaver Henrik Stotz 15

15
Runtime Example: Graphical Workflow Log

© SAP AG 2004, SAP NetWeaver Henrik Stotz 16

16
All Exercises

Prerequisites
- Good understanding of XI features
- Good understanding of BPM features

Overview
The business case for the complete process is a simplified selling of spare parts. The spare parts
are selected in a non-SAP Catalog/CRM-System, which is in our exercises simulated by a Web
Dynpro user interface. Since the non-SAP Catalog/CRM System sends the spare part items in
individual messages, the process starts with a collect pattern (exercise Receive Order Items). In
the Receive Order Items exercise the order items are merged into a single message which is then
used in the Preparations exercise where the preparations in the SD system are done. The
Preparations exercise consists of a synchronous call to the SD system to check whether missing
materials have to be created. If so, the materials are created in the Create Materials exercise by
looping through a list of missing materials and sending each material to the receivers, which are
found using a receiver determination step (MM and SD system). In the Create Orders exercise, a
sales order and a purchase order are created. The last exercise - Send Purchase Order to
Supplier - covers the communication with the supplier who receives and confirms the purchase
order. Exception handling is also part of the exercises.

In order to focus on the modeling of the process we hide complexity. Therefore, we have simple
message types and there are no mappings between process interfaces and the interfaces used
by the business systems. In fact, we simulate the business objects (e.g. create Material, create
Order) using ABAP proxies in the business systems, which are physically the clients 811
(Supplier), 812 (SD), 813 (MM) in the Integration Server box. Moreover, the Integration Directory
configuration is preconfigured and so does not have to be done by the participants.

The following graphics show the business scenario, which is separated in five exercises:

1. Receive Order Items


2. Preparations
3. Create Materials
4. Create Orders
5. Send Purchase Order to Supplier

At runtime, the following business systems are used:

CRMCatalog Æ DMSCRM
SD System Æ Airline_Group_One
MM System Æ Airline_Group_Two
Supplier Æ Travel_Agency_Summer
1. Receive Order Items

2. Preparations

3. Create Materials
4. Create Orders

5. Send Purchase Order to Supplier


A complete process, which creates two materials that are sent to two systems, produces the
following messages (message selection in client 800 only) and Workflow logs:

Receive Order Items

Preparation
Create Materials

Create Orders

Send Purchase Order to Supplier


Exercise 1: Receive Order Items
The aim of the exercise is to collect three incoming order items. The incoming messages arrive
from the SOAP adapter. This is triggered by a Web Dynpro application.

Part 1 – Find your own business process and check the


environment
1. Log on to the Integration Server: http://<server>:<port>/rep.
The instructor will provide you with the names of the <server> and the <port>.
2. Navigate to your business process: software component
SELLSPAREPARTS Æ Business Scenarios & Processes Æ Business Processes

If you are in Group XY, your business process is SellSpareParts_0XY.


(Process SellSpareParts_000 is reserved for the instructor and demo purposes)

SellSpareParts_0XY is the only repository object you are allowed to change.

Graphic 1: Find your business process


Initially, your process template only contains one receive step. If you run into trouble during the
creation of the exercises, you can open the exercise solution in a second window for guidance.
If you are not able to finish an exercise, you can delete your process and recopy it from the
solution template. Make sure that you use exactly the same process name as before. For
example, if you want to start with exercise 3, you can start by resetting you process from the
Solution_2 process. Make sure that you activate the process.

solution template

your process

Graphic 2: Creating your exercise process based on the solution template

Part 2 – Test the initial state of your business process


By executing this step you test the system environment.

1. Select the url


http://<server>:<port>/webdynpro/dispatcher/local/OrderSparePartItem/OrderSparePartItem

The server and port names are the same as above. They are provided by the instructor.

2. Enter the name of your business process in the Process Definition field.
This is very important; otherwise you will send the data to a different process.
NOTE:

You might run into problems with endless running processes caused by the wrong
process design. In this case, the workflow log shows an older protocol time stamp. To
avoid interference with these process instances use a different Customer Number.

3. Click SendItem .
OrderItem has been submitted is displayed.

4. Log on to the Integration Server (ABAP stack, client 800) and check in
transaction SXMB_MONI whether you can see your SparePartItem message.
The Receiver Service column must display the name of your process .
You may use the /SPAREPARTS layout for the list layout:

5. Check the Workflow log (refer to the screenshots below):


6. Select your process instance by calling transaction sxmb_moni_bpe.
Enter the name of your process in the Service field on the selection screen, then
choose Execute.

Double-click the process instance to open the Workflow


log:

Double-click

Use the transaction SXMB_MONI_BPE to find your process instances.


Step 3 – Building the collect pattern
1. Delete the receive step in your scenario.

2. Insert the following block:

3. Define a container element counter, (type xsd:integer):

4. Insert a loop with the condition “counter ≠ 3”:

5. Create a correlation CorrCustomer::

Make sure that in the XPath expression the Multiline check box (lower right corner) is
deselected. This is necessary for all XPath expressions you create in correlations or if
you use/activate a correlation in a send or a receive step.
6. Define a container element item in the process container:

7. Define a receive step:

Make sure that in your XPath expression the Multiline check box is deselected (lower
right corner).

8. Define a container operation on the element counter:


9. Create a container multiline element itemlist:

10. Define a container operation to append a single item from container element item to the
list of items in container element itemlist:

Make sure that the Multiline check box is deselected.

11. Save and activate your process. Next, send three items to your process by using the
Web Dynpro user interface. (submit three times):
12. Check the workflow log of your process. It should look as follows:

As you send three items with the same customer number they are collected by the
process. After the third item, the condition becomes TRUE; therefore the loop is finished
and the process is complete.
Exercise 2: Preparations
In this exercise the “itemlist” is transformed to a “list”, which is send synchronously to the
business system Airline_Group_One. The response message contains the materials which must
be created in the next exercise. This exercise also demonstrates exception handling for
application and system errors. In case of an application exception, an alert is thrown, which can
then be reviewed in the alert inbox.

1. To collapse the ReceiveOrderItemBlock block you created in the first exercise, choose
Collapse from the context menu:

2. Define a new block Preparation with two exceptions SystemError and ApplicationError:

3. Create a new container element list:

4. Insert a transformation step PrepTransformation using the interface mapping itemlist2list.


The source message is itemlist, the target message is list:
5. Create a new container element preplist, which contains the result of the preparation call:

6. Insert a send step SendPreparation:

Set the mode of the send step to Synchronous. The send step uses the synchronous
Interface prep_sync_abstract. The request message is list and the response message is
preplist. For the Exception System Error enter SystemError, for the exception Application
Fault enter ApplicationError.

7. Add two exception branches for the exception handlers SystemError and ApplicationError
by calling the context menu.
8. Add a control step PrepControlAppException into the exception handler for the exception
ApplicationError:

Select the Throw Alert action and the PROCESS ALERT alert category. Enter an
appropriate alert message (e.g. Preparation Checks group XY failed).

9. In the exception handler branch for the SystemError exception, insert a control step
PrepControlSysError to cancel the process.

10. Save and activate your process.

11. Send three line items to your process using the Web Dynpro user interface and check
your process instance by calling transaction SXMB_MONI_BPE. The workflow log should
look as follows:
12. Send three line items to your process. Make sure that you send spare part number
“9999”, which causes an application error, at least once:

The process catches the application error and triggers the alert defined in the process:

You can check whether the application error has been thrown by the receiver ABAP
proxy by calling transaction SXMB_MONI:

If your user is registered for the Alert Category PROCESS ALERT and your user in client
800 has an email address assigned to it, you can review the alert in the alert inbox:

http://<server>:<port>/sap/bc/bsp/sap/ALERTINBOX/index.htm
13. The instructor will cut the connection between the Integration Server and the business
system Airline_Group_One by manipulating the corresponding SM59 RFC destination:

If you now run your process, the system error exception is triggered and the control step
in the corresponding exception branch cancels the process. Check this in the Workflow
log:
You can check whether a system error was thrown by calling transaction SXMBI_MONI:

Make sure, that the RFC-Destination is working again before you proceed.

14. Run the process with the spare part numbers 2000, 3000, and 4000. Since the materials
1000, 2000, 3000 are always marked as missing in the system, the preparation check will
return a message with the spare part numbers 2000 and 3000.

To check this, call transaction SXMB_MONI and select any messages where the sender
service is your process:
In this request message you should see all spare part items transferred to the preparation
check:

If you select the message in transaction SXMB_MONI – the receiver service is your
process and the receiver interface is prep_sync_abstract - you can check the preparation
response.
In the response you can see which materials will be created in the next exercise:
Exercise 3: Create Materials
In this exercise, the materials determined in the last exercise are created. This is done by
combining a block in ParallelForEach mode with a block in ForEach mode which loops over the
list of receivers determined beforehand (broadcast pattern).

1. Collapse the Preparation block and add a CreateMaterials block:

2. Insert a switch step to check if materials need to be created:

3. Create a multiline element prepitemlist in the CreateMaterials container, which is based


on the abstract interface item_abstract.
4. Insert a transformation step MaterialTransformation into branch1 of the switch step.
The transformation is based on the interface mapping list2itemlist, the source message
preplist and the target message prepitemlist.

5. After the transformation step, insert a block named SendMaterialsParallel:

6. Create an new container element prepitem in the container SendMaterialsParallel:


7. Set the mode of the SendMaterialsParallel block to ParForEach. For the Multiline
Element property, select the container element prepitemlist. For the Current Line
property, select the container element prepitem:.

8. Create a multiline element Receivers (category Receiver) for the SendMaterialsParallel


container:

9. Insert a receiver determination step ReceiverDetermination into the


SendMaterialsParallel block. Select prepitem for the Message property,and Receivers for
the Receivers property,:

10. Create a correlation CorrMaterials as shown in the following graphic:


11. Insert a new block SystemBroadcastPerMaterial after the receiver determination step:

12. Create a container element Receiver (category Receiver):

13. For the SystemBroadcastPerMaterial block, set the ForEach mode. For the Multiline
Element property select Receivers, for the Current Line property select Receiver, and for
the correlation select CorrMaterials.
14. In this block insert the send step SendMaterial:

15. Create the container element create_matresp in the SystemBroadcastPerMaterial


container:
16. Insert a receive step ReceiveCreateMatResp:

17. Save and check your process:

If no errors are found, activate your process and start testing.


18. Send the spare part numbers 2000, 3000 and 4000 to the process. The resulting
Workflow log should look as follows:

Two materials (2000 and 3000) have been created and broadcasted to two systems
each.

19. Carry out further tests.


Exercise 4: Create Orders
In this exercise, the sales and purchase orders are created in parallel. If one fails, both orders are
canceled. As an extension of this exercise, the creation of the purchase order part is enhanced by
a manual compensation in case the creation of the purchase order fails. The exercise uses
application and transport acknowledgments of send messages. Moreover, send contexts are
used for routing purposes.

1. Collapse the Create Materials block and add a CreateSalesAndPurchaseOrdersBlock


block.

2. Insert a fork step createparallel with two necessary branches:

3. Create the correlation CorrOrder:


4. Create a send step SendPO. Enter PurchaseOrder for the Send Context property. This is
important because the routing depends on this send context.

5. In the process container, create a container element po_resp.


6. Insert a receive step ReceivePO:

7. Create a container element status_po (type xsd:string):

8. Insert a container operation getPOstatus:

9. Insert a send step SendSO into the other branch:

10. Create a container element so_resp:


11. Insert a receive step ReceiveSO:

12. Create a container element status_so (type xsd:string):

13. Create a container operation getSOStatus:

14. Create a block AutomaticCompensation:


15. In this block, insert a switch CancelOrders:

16. Insert a send step Cancel_PO into branch1. Enter CancelPO for the Send Context
property.
17. Insert a send step Cancel_SO into branch1. Enter CancelSO as the send context:

18. Insert a control step AlertCancelOrders, which raises an alert:

19. Insert a control step OrdersCanceled, which cancels the process:

20. Save, check and activate your process


21. Test your process:
If you use a customer name containing a “Y”, the response message correlated to the
CreatePurchaseOrderMessage from Airline_Group_2 indicates that an error occurred
(this is not an application error in XI):

The same is true for the SalesOrder if you use a customer name containing a “Z”:

Check if your process works. If you use customer names without “Y” and “Z”, your
Workflow log should look as follows:
If you use customer names with “Y” and/or “Z”, your Workflow log should look as follows:

Check the alert inbox:


22. Check the graphical Workflow log:

23. Check the transport and application acknowledgments in transaction SXMB_MONI:


Extension

1. Add a switch step check after the container operation getPOstatus:

2. Insert a block ManualCompensation into branch1 and define the exception TimeOut:

3. Add a deadline branch to this block:


4. Add a control step NoInteraction to this deadline branch, which triggers the TimeOut
exception:

5. Add an exception branch to this block, which handles the TimeOut exception:

6. In the Manual Compensation branch, insert a control step POErrorControl, which triggers
an alert with the alert message PurchaseOrder could not be created, Run Report
SPAREPARTS_MANUALCOMPENSATION in client 813 within the next 60 seconds to
compensate manually.
7. Insert a receive step ReceivePOAgain after the last control step:

8. Insert a container operation setPOStatus:

9. Save, check and activate your process.


10. Test the manual compensation step:
a. Log on to client 813 and prepare to run the
SPAREPARTS_MANUALCOMPENSATION report.
b. Run your process with a customer containing a “Y”.
c. In the graphical Workflow log, check that the process reaches the
ReceivePOAgain step.
d. Run the SPAREPARTS_MANUALCOMPENSATION report in client 813.
e. Check that the orders are not cancelled due to the manual compensation (run the
report, which sends a message to the ReceivePOAgain step).

Process waiting
for
manual compensation
Process manually
compensated
Process without
manual compensation
Exercise 5: Send Purchase Order to Supplier
In this exercise, the purchase order is sent to the supplier. An order response is received and
acknowledged.

1. Collapse the CreateSalesAndPurchaseOrdersBlock block and add a


SupplierCommunication block:

2. Insert a send step SendPO2Supplier. Enter Supplier for the Send Context property:

3. Create a container element po_confirmation:

4. Insert a receive step ReceiveOrderConfirmation:


5. Insert a send step SendAcknowledgement:

6. Save, check and activate your process.

7. Test the overall process:

Example with supplier communication

S-ar putea să vă placă și