You are on page 1of 72

TADMBO Implementation&Operation II

TBIT44

Mapping, Adapters and BPM

THE BEST-RUN BUSINESSES RUN SAP

SAP AG SAP AG 2004 2004

SAP Exchange Infrastructure 3.0 TBIT44 Mapping/Adapters/BPM

Lecture topics

Topics

Mappings Adapter ccBPM

SAP AG 2004, TBIT44

TBIT44: Mapping pattern

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 SequenceNumber Generation Duplicating Subtrees Table / Value Lookups TreeReversal

SAP AG 2002, Title of Presentation, Speaker Name 2

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 3

Mapping Patterns Summarization (II)

SAP AG 2002, Title of Presentation, Speaker Name 4

Mapping Patterns Summarization (III)


Mapping Result:

SAP AG 2002, Title of Presentation, Speaker Name 5

Mapping Patterns SequenceNumber 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 6

Mapping Patterns SequenceNumber Generation (II) There are two ways the sequence number can be generated.
1.

Use Advanced UserDefined function to generate the sequence number all at once. Use Simple UserDefined function to generate the sequence number for each occurrence separately, keeping track of the sequence number value previously generated.

2.

SAP AG 2002, Title of Presentation, Speaker Name 7

Mapping Patterns SequenceNumber Generation (III)


1.

Use Advanced UserDefined 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 8

Mapping Patterns SequenceNumber Generation (IV)


1.

Use Advanced UserDefined function to generate the sequence number all at once.

SAP AG 2002, Title of Presentation, Speaker Name 9

Mapping Patterns SequenceNumber Generation (V)


1.

Use Advanced UserDefined function to generate the sequence number all at once.
Test Results:

SAP AG 2002, Title of Presentation, Speaker Name 10

Mapping Patterns SequenceNumber Generation (VI)


2.

Use Simple UserDefined 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 11

Mapping Patterns SequenceNumber Generation (VII)


2.

Use Simple UserDefined 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 12

Mapping Patterns SequenceNumber Generation (VIII)


2.

Use Simple UserDefined 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 13

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 CurrencyAmts 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 14

Mapping Patterns Duplicating Subtrees (II)


The subtree CurrencyAmt must be duplicated first. This will create 2 CurrencyAmts. One for credit, and one for debit.

SAP AG 2002, Title of Presentation, Speaker Name 15

Mapping Patterns Duplicating Subtrees (III)

SAP AG 2002, Title of Presentation, Speaker Name 16

Mapping Patterns Duplicating Subtrees (IV)


Mapping Results:

SAP AG 2002, Title of Presentation, Speaker Name 17

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, subaccount, 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, subaccount 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 18

Mapping Patterns Table/Value Lookup (II)


Source: Target:

SAP AG 2002, Title of Presentation, Speaker Name 19

Mapping Patterns Table/Value Lookup (III)


Java Function:

The lookupd value must be written to the ResultList.

SAP AG 2002, Title of Presentation, Speaker Name 20

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 21

Mapping Patterns Table/Value Lookup (V)


Mapping Results:

SAP AG 2002, Title of Presentation, Speaker Name 22

Mapping Patterns TreeReversal (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 23

Mapping Patterns TreeReversal (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. Sum the prices by product and assign those totals to the products in their sorted order. Examine all the ORDERIDs and determine which ORDERIDs contain each of the products in the sorted list. Then, assign those ORDERIDs to the products.

2.

3.

SAP AG 2002, Title of Presentation, Speaker Name 24

Mapping Patterns TreeReversal (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 25

Mapping Patterns TreeReversal (IV)


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

SAP AG 2002, Title of Presentation, Speaker Name 26

Mapping Patterns TreeReversal (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 27

Mapping Patterns TreeReversal (VI)


Mapping for ITEM: To create the number of elements.

SAP AG 2002, Title of Presentation, Speaker Name 28

Mapping Patterns TreeReversal (VII)


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

SAP AG 2002, Title of Presentation, Speaker Name 29

Mapping Patterns TreeReversal (VIII)


Display Queue for determining NAME:

SAP AG 2002, Title of Presentation, Speaker Name 30

Mapping Patterns TreeReversal (IX)


Mapping to create the number of element for ORDERS_WHERE_ITEM_IS_FOUND.

SAP AG 2002, Title of Presentation, Speaker Name 31

Mapping Patterns TreeReversal (X)


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

SAP AG 2002, Title of Presentation, Speaker Name 32

Mapping Patterns TreeReversal (XI)


Display Queue for determining TotalSalesFOrThisItem:

SAP AG 2002, Title of Presentation, Speaker Name 33

Mapping Patterns TreeReversal (XII)


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

SAP AG 2002, Title of Presentation, Speaker Name 34

Mapping Patterns TreeReversal (XIII)


Display Queue for determining ORDERID:

SAP AG 2002, Title of Presentation, Speaker Name 35

Mapping Patterns TreeReversal (XIV)


Partial listing of the mapping results:

SAP AG 2002, Title of Presentation, Speaker Name 36

CPA Cache

Learning Objectives

As a result of this unit, you will: Understand the basics of CPA Cache, including:
Configuration Monitoring Troubleshooting Manual refresh

SAP AG 2004, TBIT44: Adapters: CPA Cache / 2

Cache overview

Integration Builder

Business system
SLD Cache Own Business system

Activate Changelist Import Request Cache update again

Integration Server
Business Process Engine Integration Engine

Cache Update
TA: SXI_CACHE Delta Full (only on request)

Business Mappings Adaptermetad


ata Processes

Business
Process Configuration Routing Rules Collaboration Agreements Collaboration Profiles

Cache
J2EE: CPACache Delta Full via URL

Runtime Access

Cache

Central Adapter Engine

SLD Cache
Software components versions Based On

SLD Cache Own Business system SLD Cache


Business systems

Adapter Meta data

Cache Update

Repository Cache

Local Adapter Engine


Cache
J2EE: CPACache Delta Full via URL

Adapter Framework

Integration Repository
SAP AG 2004, TBIT44: Adapters: CPA Cache / 3

Integration Directory

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 2004, TBIT44: Adapters: CPA Cache / 4

CPA Cache display content


data can be seen in the CPACache Monitor (not accessible per default) http://<host>:<J2EEport>/CPACache

SAP AG 2004, TBIT44: Adapters: CPA Cache / 5

CPA Cache display content (2)


displays objects relevant for adapter framework during runtime

SAP AG 2004, TBIT44: Adapters: CPA Cache / 6

CPA Cache: Registration/Push vs. Pull


Registration/Push Mode
(automatically or manual)

PULL-Mode (Delta or Full Refresh)


http://<host>:<port>/CPACache/refresh?mode= delta|full

SAP AG 2004, TBIT44: Adapters: CPA Cache / 7

CPA Cache refresh


manual refresh via URL with user XIDIRUSER http://<host>:<J2EEport>/CPACache/refresh?mode=full

SAP AG 2004, TBIT44: Adapters: CPA Cache / 8

CPA Cache refresh in detail


Adapter Engine Directory Repository

XIAFuser

XIDIRuser

Adapter Engine

Runtime Cache

Notification handler Update running

Notif

Notif error

Changelist handler

Directory Object

Repository Object

Get object ids Get Object

Get object from repository

Update

OK / OK with errors

General status Error Status of single objects

SAP AG 2004, TBIT44: Adapters: CPA Cache / 9

CPA Cache - Registration

SLD

1 Change in XI ID 4 5

3 2

AE CPA Cache

SAP AG 2004, TBIT44: Adapters: CPA Cache / 10

CPA Cache: Schema Upload

SAP AG 2004, TBIT44: Adapters: CPA Cache / 11

Messaging system

Learning Objectives

As a result of this unit, you will: Understand the basics of the messaging system, including:
Messaging System overview Message flow Implementation of different adapters

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

Messaging system overview


Adapter Engine
XI message XI message Module Processor XI message Structure conversion Other... File/JDBC/JMS/ Mail Other adapters without protocol handler RFC/SOAP/3rd party Adapter with protocol handler RNIF/BC/CDIX XI message MML/BC message API Protocol handler Configuration Technical adapters

exit
Convert Bean (Adapter specific) XI message MML/BC message

AFW ListenerBean
Read agreements Read channels XI message

exit

XI adapter
Protocol handler Configuration

ListenerBean

XI IS

URL

SPI

SPI

servlet

Sequencer for EOIO Scheduler retry/EO Receive/Send Queue Store

servlet

URL

Send via HTTP


CPA Cache

Send via HTTP


CPA Cache

Cache update XML

IB Directory

PCK

DB

SAP AG 2003, Title of Presentation, Speaker Name / 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

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

Status overview of messages in MDT

FAIL

Delivery exception

Worker thread

TBDL

DLNG

successful Scheduler/ Admin action

DLVD

EOIO, wait for other message Recoverable exception

WAIT

HOLD

Max. retries exceeded Admin action

NDLVD

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

TBIT44: BPM
Exercise 2: Sales Order Processing

Use Case
Other System Order Fulfillment

Dealer Management System Supplier 1

CRM/ Catalog No-name Supplier1

Catalog
Dealer Management System Supplier 2

Other System

CRM No-name Supplier2 No-name Supplier3 EBP+ No-name Catalog

ERP ERP Dealer


XI/BPM

Other System

Other System

CRM Order System

Dealer Management System Supplier 3

Order System

SAP AG 2004, SAP NetWeaver Henrik Stotz 2

Other System

Other System

Order Fulfillment

Dealer Management System Supplier 1


Catalog/ CRM

ERP ERP Dealer


XI/BPM

SAP AG 2004, SAP NetWeaver Henrik Stotz

Overview
CRM System Send items AirlineGroup1 AirlineGroup2 Integration Process 1. Receive order items 2. Preparations Create materials 3. Create materials if necessary 4. Create purchase and sales order 5. Send purchase order to supplier and receive confirmation Preparations Travel Agency Summer

Create purchase and sales order Receive order send confirmation

SAP AG 2004, SAP NetWeaver Henrik Stotz

Integration Process

SAP AG 2004, SAP NetWeaver Henrik Stotz

Web Dynpro User Interface

SAP AG 2004, SAP NetWeaver Henrik Stotz

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

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

Exercise 3: Create Materials

Material1 System1 System2

Material2 System1 System2


SAP AG 2004, SAP NetWeaver Henrik Stotz 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

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

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

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

Runtime Example: SXMB_MONI

SAP AG 2004, SAP NetWeaver Henrik Stotz

14

Runtime Example: Workflow Log

SAP AG 2004, SAP NetWeaver Henrik Stotz

15

Runtime Example: Graphical Workflow Log

SAP AG 2004, SAP NetWeaver Henrik Stotz

16

You might also like