150
SAP Exchange Infrastructure Mapping Functionality in XI

TBIT41+ +Mapping+Functionality+in+XI

Embed Size (px)

Citation preview

Page 1: TBIT41+ +Mapping+Functionality+in+XI

SAP Exchange InfrastructureMapping Functionality in XI

Page 2: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – IntroductionOverviewJava MappingXSLT MappingABAP Mapping

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingUser-Defined FunctionsValue MappingExamples

Page 3: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message Mapping

Page 4: TBIT41+ +Mapping+Functionality+in+XI

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

Component Overview

Integration Builder (IB)

IntegrationDirectory

(ID)

IntegrationRepository

(IR)

IntegrationServer

(IS)

System Landscape Directory (SLD)

Central Monitoring

SAPSystems

3rd PartySystems

3rd PartyMiddlewareComponent

Marketplace/BusinessPartner

Page 5: TBIT41+ +Mapping+Functionality+in+XI

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

Integration Builder

Common client-server framework for all objects

Two instances of the frameworkRepository

Business Scenarios & Business ProcessesInterface ObjectsMapping ObjectsAdapter Objects

DirectoryPartyServiceReceiver determinationInterface determinationSender/Receiver Agreements

Page 6: TBIT41+ +Mapping+Functionality+in+XI

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

SAP Web AS≥ 6.20

Design

Integration Repository

System Landscape Directory

Software ComponentSoftware Component Version

J2EE/ABAP

ProxiesMessage Interfaces

Message Types

Integration Builder

Interface EditorData Types

Business Processes

Mappings

Business Scenarios

Context Objects

Scenario Editor

Process Editor

Mapping Editor

Condition Editor

BPEL

XSLTJava

XPath

WSDL

XSD

Page 7: TBIT41+ +Mapping+Functionality+in+XI

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

Configuration

Integration Directory

Collaboration ProfilesParties & Services

Channels

Integration Builder

Business Processes

Routing Rules

Business Scenarios

Collaboration Agreements

Receiver Determination Rules

Interface Determination Rules(including Mapping Assignment)

Security

Configuration Editors

Configuration Wizards

Page 8: TBIT41+ +Mapping+Functionality+in+XI

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

Integration Server

Business ProcessEngine

Integration Processing

Integration Directory

Collaboration Agreements

Collaboration Profiles

Business Processes

Routing Rules

Business Scenarios

Receiver Determination Rules

Interface Determination Rules(including Mapping Assignment)

IntegrationEngine

Outbound Handling(also in adapters)

Business ProcessExecution

Inbound Handling(also in adapters)

Receiver Determination

Interface Determination

Channel Determination

Mapping

Parties & ServicesChannels

Security

Page 9: TBIT41+ +Mapping+Functionality+in+XI

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

Objects in the Integration Repository

Business ScenarioObjects

Business Scenarios

Actions

Interface Objects Mapping Objects

Message Interfaces

Message Types

Fault Message Types

Data Types

Interface Mappings

Message Mappings

Imported Archives

Imported Objects(IDocs, RFCs)

References

Unified behaviour of all objects for change management, naming conventions, documentation,...

Business Processes

Page 10: TBIT41+ +Mapping+Functionality+in+XI

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

Integration Builder: Introduction

Page 11: TBIT41+ +Mapping+Functionality+in+XI

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

Object Handling in the Integration Repository

Before development can startDevelopment manager or administrator has to import a software component version from SLDCreate namespaces in this software component version

Each repository object is uniquely identified by the triplesoftware component version, namespace, object name

As a general rule:Software component : Namespace = 1 : n A namespace is transferred to a new version of a software component after development is finished (Release-Transfer)

Object version managementChanges are collected in (user-specific) change lists and can be activated onceEach user may have different change lists for each software component version he is working inAfter activation a new object version is released. Old versions can be viewed by means of an object history.

Page 12: TBIT41+ +Mapping+Functionality+in+XI

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

Integration Builder XI 2.0 SP1: Software Logistics

Repository.: Copy with same version as source object

Directory:New initial object version is created

Repository1 -> Repository2(all objects of a namespace or all objects of a SWCV)

Directory1 -> Directory2

Transport,shipment

Export/Import(context menu)

Identical object with same version as source object

Within one Repository:SWCV1->SWCV2(single objects or all objects of a namespace or all objects of a SWCV)

Take over (all) objects to next (or another) SWCV of same repository at end of development

Release transfer(menu “Tools”)

(Only Repository)

Copy with initial object version

Within one Repository:SWCV1->SWCV2SWCV1->SWCV1

Within one Directory

Reuse(global data types, for example)

Copy(context menu)

‘Role’ of target object

Objects fromsource -> destination

PurposeFeature

SWCV: Software Component Version

Page 13: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – IntroductionOverviewJava MappingXSLT MappingABAP Mapping

Message Mapping

Page 14: TBIT41+ +Mapping+Functionality+in+XI

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

<hh:book-flight xmlns:hh="..."><hh:customer>

<hh:first-name>Peter</hh:first-name><hh:surname>Miller</hh:surname>

</hh:customer><hh:booking-data>

<hh:airline>Airline Kingdom</hh:airline><hh:connection>AK087</hh:connection><hh:date>2001-11-22</hh:date><hh:class>business</hh:class>

</hh:booking-data></hh:book-flight>

<ak:BookFlight xmlns:ak="..."><ak:Date>22.11.2001</ak:Date><ak:Flight>087</ak:Flight><ak:Passenger>Peter Miller</ak:Passenger><ak:Class>2</ak:Class><ak:Agency>Happy Holiday</ak:Agency>

</ak:BookFlight>

Overview - General Mapping Types

MappingTransformation from one message structure to anotherTransformation rules defined by mapping program

Structure Mapping

Value Mapping

Page 15: TBIT41+ +Mapping+Functionality+in+XI

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

Integration Server

Business ProcessEngine

Mapping at Runtime

IntegrationEngine

Outbound Handling(also in adapters)

Business ProcessExecution

Inbound Handling(also in adapters)

Receiver Determination

Interface Determination

Channel Determination

Mapping

Messages in XI contain a sender interface

IS evaluates configuration data of the Integration Directory

• During logical routing, the IS determines a Receiver Interface (1).

• Such an interface pair can optionally reference an Interface MappingAn interface mapping points to one or more mapping programs(for request, response and/or fault messages)IS executes mapping programs (2)

• Receiver determination and mapping step can also be performed within in the scope of BPM (1;2)

1

2

1;2

Page 16: TBIT41+ +Mapping+Functionality+in+XI

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

Interface Mapping(s)

Integration Repository

Request

Fault

FaultMessage Type

InboundMessage Interface

FaultMessage Type

OutboundMessage Interface

Input Message Type

Response

InputMessage Type

OutputMessage Type

Message MappingXSLT MappingJava Mapping

ABAP Mapping

Message MappingXSLT MappingJava Mapping

ABAP Mapping

OutputMessage Type

Message MappingXSLT MappingJava Mapping

ABAP Mapping

Overview - Relate Mapping Programs to Interfaces

Page 17: TBIT41+ +Mapping+Functionality+in+XI

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

Overview - Mapping Programs to Map Messages

Message MappingDesigned by using the graphical mapping editor of Integration BuilderResult: Generated Java Code.

Imported ArchivesImport externally defined mapping programs into repositoryJava mapping:Implemented by using a specific interface XSLT mapping:

Runtime supports XSLT processorJava methods can be called from within a Style Sheet

ABAP Mapping

You can execute mapping programs in a sequence

Page 18: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – IntroductionOverviewJava MappingXSLT MappingABAP Mapping

Message Mapping

Page 19: TBIT41+ +Mapping+Functionality+in+XI

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

Java Mapping (I)

Mapping programs can be implemented in Java

1. Develop your Java code locally e.g. with your IDE

2. Create a .jar or a .zip

2.1 Using the jar command of the jdk2.2 Using a built-in IDE functionality

3. Create a new Imported Archiveand import the .jar to the Integration Repository

Page 20: TBIT41+ +Mapping+Functionality+in+XI

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

Java Mapping (II) - Development

Define a Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformationThe interface contains two methods:1. public void execute(java.io.InputStream in,

java.io.OutputStream out) to perform the mappings.

2. public void setParameter(java.util.Map param)to access to runtime constants possible(for example: INTERFACE, SENDER_NAME)

The required libraries are contained in the aii_map_api.jar, which is part of your SAP J2EE Engine installationDOM and SAX Parsers provided by the SAP XML Toolkit for Java can be usedAPI to execute value mappings

Page 21: TBIT41+ +Mapping+Functionality+in+XI

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

Java Mapping (III) - Template

Page 22: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – IntroductionOverviewJava MappingXSLT MappingABAP Mapping

Message Mapping

Page 23: TBIT41+ +Mapping+Functionality+in+XI

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

XSLT Mapping (I)

Proceeding equivalent as for Java mappings

1. Develop your XSLT files2. Create a .jar or a .zip

2.1 Using the jar command of your jdk2.2 Using a built-in IDE functionality

3. Create a new Imported Archive and import the .jar to the Integration Repository

4. Uploaded XSLT programs can modified within the XI Repository by means of a simple editor.

Page 24: TBIT41+ +Mapping+Functionality+in+XI

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

XSLT Mapping (II) - Features

XSL-Transformation: transforming XML structuresXPath: Locating information in XML documents<xsl:include> and <xsl:import>: inclusion of other XSLT files<xsl:param> to access runtime constantsInvoking external Java methods from within an XSL Transformation

Page 25: TBIT41+ +Mapping+Functionality+in+XI

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

XSLT Mapping (III) - Example

XSLT Mapping with Java Enhancement

Calls the method merge:

Page 26: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – IntroductionOverviewJava MappingXSLT MappingABAP Mapping

Message Mapping

Page 27: TBIT41+ +Mapping+Functionality+in+XI

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

ABAP Mapping (I)

Mapping programs can be implemented in ABAP

1. Add additional mapping types in your Exchange Profile: com.sap.aii.repository.mapping.additionaltypes = R3_ABAP|Abap-class;R3_XSLT|XSL (ABAP Engine)

2. Develop your ABAP-OO class in the Object Navigator (se80)

3. Create a new Interface Mapping• Select Mapping Type Abap-class• Enter the name of the ABAP-OO class

Page 28: TBIT41+ +Mapping+Functionality+in+XI

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

ABAP Mapping (II) - Development

Define a ABAP class that implements the interface IF_MAPPING of package SAI_MAPPINGThe interface contains the method EXECUTE to perform the mappings.

The required libraries are contained in the aii_map_api.jar, which is part of your SAP J2EE Engine installationDOM and SAX Parsers provided by the SAP XML Toolkit for Java can be usedAPI to execute value mappings

XSTRINGExportingRESULT

IF_MAPPING_TRACETRACE

IF_MAPPING_PARAMPARAM

XSTRINGImportingSOURCE

ReferenceDirectionParameter

Page 29: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 30: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 31: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Mapping Editor (I)

Data-Flow Editor

Structure Overview

Source Structure Target Structure

Target Field Mapping

Page 32: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Mapping Editor (II)

Import of source and target structureFrom Integration Repository

XSDs developped in the Integration RepositoryImported External Definitions (WSDLs, XSDs, DTDs)Imported SAP meta data (RFCs, IDocs)

From local file system (XSD or XML)Not all XSD tags are supported (general rule: XSDs that can be created by using the data type editor can be imported)<xsd:include> and <xsd:import> are not supported

Mapping editor displays a simplified XML representation of XSD files in structure overview

Page 33: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Mapping Editor (II)

Design message mapping using the data-flow editorMessage mapping is composed of several target field mappingsYou can edit one target field mapping in the data-flow editor All mandatory target fields (marked in red) must be mapped

Page 34: TBIT41+ +Mapping+Functionality+in+XI

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

Icon Status Display

MeaningIcon

Element with maxOccurs = unbounded

Element

Attribute

Icon Types

Icon Colors

Mapping to target field complete Green

Attribute or element has already been assigned but the corresponding mapping in the data-flow editor is not complete

Yellow

Attribute or element must be assigned to complete the mapping

RedAttribute or element not assigned WhiteMeaningColor

Page 35: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Elements

Attribute

Element is mandatory and might re-occur (minOccurs>0, maxOccurs>1)

Element is mandatory (minOccurs>0)

Parent node might repeat (maxOccurs>1)

Element might repeat (maxOccurs>1)

Page 36: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Elements

Elements

NodesDo not contain any values

AttributesAttributes behave like elements in mappingsAttributes are marked with “@”sign in the mapping editor.

Page 37: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Assign Source/Target Message Types

There are 3 ways message types can be assigned to the Message Mapping.

1. By using an existing object already created in the Integration Repository (e.g. Message Type, External Definitions)

2. By using an RFC or IDoc meta data imported from SAP3. By importing XML or XSD files from local file system

Page 38: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Assignment of Fields (I)

drag&dropdrag&dropdrag&drop

Double click on a field

=navigate tomapping

Double click on a field

=insert field intodata-flow editor

Page 39: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Assignment of Fields (II)

1.Mark root nodes of subtrees

2. Choose assignment function

• Mappings are created automatically forhomonymous child elements

Page 40: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Data–Flow Editor

Delete Floating Objects Lay Out

Mapping

Delete Current Mapping

Select Function Category

Define User

Function

Select Function

Page 41: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Mapping Templates

1.Mark root nodes of subtrees 2. Choose “Load

Mapping Template”

• Mapping Templates based on Date Types have to becreated beforehand

• Subnodes must reference this pair of Data Types

Page 42: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Text Preview

All target field mappings

Text Preview

Text Preview per target field

Page 43: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts - Dependencies

Dependencies

All mappings or mappings of two selected subnodes are displayed

Page 44: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Test Mappings (I)

A completed Message Mapping can be tested by using the “Test” tab.

• Prerequisites 1. The defined message mapping must be complete. This means that each mandatory

target field must be assigned to one or more source fields.2. There must not be any unassigned arguments when using functions.

Dropdown provides the creation and saving of test cases

Loads an XML instance from a local file.

Tabular Tree View

XML document view

Search node name in the Tabular Tree View

Execute Mapping

Page 45: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Test Mappings (II)Editing the XML instances to use in test cases:

Using the editor for the XML view, you can manually edit elements and attributes or their values here. Use CTRL C, CTRL X, and CTRL V respectively to copy, cut, and paste parts of an XML instance.

Using the context menu in the (Tabular) Tree View, you can copy sub-trees, delete nodes, and add elements and attributes. In the Value column in the tabular tree view you can also enter values for fields.

Enter test data

Page 46: TBIT41+ +Mapping+Functionality+in+XI

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

General Concepts – Debug MappingsUsing the “Display Queue” to examine each step of the mapping:

Note:The “context”display and usage in the queues will be discussed in later slides.

Page 47: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 48: TBIT41+ +Mapping+Functionality+in+XI

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

Standard Functions: Introduction

All functions expect and return string valuesGenerating functions ‘produce’ values (for example: Constant)Some standard functions provide function properties (denoted by a small asterisk)

For example: concat lets you additionally specify a delimiterCall the function properties window by double clicking the function

R = f(X1,X2)X1

X2R

R = f(X1,X2,X3)X1

X2 RX3

O = f(I)I O

O = Generated Value O

Page 49: TBIT41+ +Mapping+Functionality+in+XI

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

Simple Standard Functions: concat

Function category: Text

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

<Contact><Fullname>

Harry Potter</Fullname>

</Contact>

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

<Customer><Firstname>

Harry</Firstname><Surname>

Potter </Surname>

</Customer>

Target MessageMappingSource Message

concat propertiesDelimiter=“ “

Page 50: TBIT41+ +Mapping+Functionality+in+XI

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

Simple Standard Functions: Substring

Function category: Text

counting starts at 0 !

Substring propertiesstart from: 0count: 10

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

<Customer><CustomerID>

0123456789</customerID>

</Customer >

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

<Contact><RefNo>0123456789-181170</RefNo >

</Contact >

Target MessageMappingSource Message

Page 51: TBIT41+ +Mapping+Functionality+in+XI

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

Simple Standard Functions: DateTrans

Function category: Date

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

<Contact><birthday>

11/18/1970</birthday>

</Contact>

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

<Customer><custBirthday>

181170</custBirthday>

</Customer>

Target MessageMappingSource Message

DateTrans propertiessrc Format: ddMMyydst Format: MM/dd/yyyy

For potential date patterns, please see Java class java.text.DateFormat

Page 52: TBIT41+ +Mapping+Functionality+in+XI

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

Boolean Functions

Boolean functionsReturn true or false stringInterpret 1 and true (not case-sensitive) as true-value

X

Z

Y

Rthen

ifelse

Result value if condition is true

Result value if condition is false

Condition R = Y if X is true or 1,else Z

R

X

Y

if

then

Condition

Result valueif condition is true

R = Y if X is true or 1or no tag is produced

ifWithoutElse

if

Page 53: TBIT41+ +Mapping+Functionality+in+XI

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

Calculations

Function category: Arithmetic

Calculations (add, multiply, etc.) are performed with Java float precisionTrailing zeros in result are truncated, e.g.: 4.2-0.2 = 4To keep trailing zeros use FormatNum function

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

<Contact><debt>

90.00</debt>

</Contact>

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

<Customer><debt>

90</debt>

</Customer>

Target MessageMappingSource Message

FormatNum propertiesNumber Format:###,###,###.00

(For potential patterns, please see Java class java.text.DecimalFormat)

Page 54: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 55: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Mandatory Mappings(minOccurs>0)

Mandatory Elements and Nodes (minOccurs>0)

Mapping is mandatory. A source element or a constant has to be assigned to the target element.Otherwise error message: “Message-mapping not completely defined”If not sufficient values are provided from the source structure during runtime, an exception is raised.

Page 56: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Fixed Occurrences(minOccurs=maxOccurs)

Exception: Nodes with fixed occurrences (minOccurs=maxOccurs)

Nodes are automatically marked in green.Mapping is not mandatory. <minOccurs> Nodes are created automatically.

For elements with fixed occurrences the rules of mandatory elements are applied

Page 57: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Repeating Elements(maxOccurs>1)

Mapping of Repeating Elements and Nodes (maxOccurs>1)

Source: Target element is created as often as mapped source element occurs in the source message.Source: Creating function (e.g. Constant)

If minOccurs>0, <minOccurs> target elements are created. If minOccurs=0, 1 target element is created.

Page 58: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Node Mapping

Mapping of non mandatory Nodes (minOccurs=0)

If a non mandatory node contains elements with minOccurs>0, these elements become mandatory after their parent node is assigned.

Page 59: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Node Mapping (II)

Mapping of non mandatory Nodes (minOccurs=0)

Assignment of elements is not sufficientNode has to be ‘created’ by assigning a suitable source node/element

Page 60: TBIT41+ +Mapping+Functionality+in+XI

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

Element Cardinality – Unique Target Mapping

Mapping from more than one Source element

Only a single and unique mapping relation per target element is allowed (n:1 relationship)Multiple mapping relations can be defined by duplicating the target node or element (Duplicate Subtree) To duplicate a node or an element, right-click on the object in the target structure pane and select “Duplicate Subtree”

Page 61: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityContext HandlingValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 62: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling (I)

Context ChangeMessage mapping works internally by using queuesIf no further elements are imported at a particular hierarchy level, a Context Change is inserted in the queueUse node functions to handle changes in the message hierarchy.

Page 63: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling (II)

Why Queue Processing?No size limitations for messagesBetter runtime performance

Context changes have impact on: User-Defined FunctionsBreaking and inserting of hierarchy levels

Manipulation of queues ant contextsExplicit context selection on source elements and nodesUsing node functions

removeContexts: deletes all context changes of a queueSplitByValue: insert additional context changes in a queue

Page 64: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - “Show queue” (I)

A tool to display queues:1. Upload or create source xml-

document in test mode2. Right-click on box representing

element or function 3. Select “Show queue”

Page 65: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - “Show queue” (II) Example

Sender and Receiver Structure

Related Mapping

Page 66: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - “Show queue” (III) Example

“Show queue” function display value queues leaving the related element/function.“Debugging” functionalityApplicable to any step in the mappingStep by step check of mappings

Page 67: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - “Show queue” (IV)

Initial and terminalcontext change –Not passed to theinternal queueprocessing

Inner context change. Represented internally byconstant ResultList.CC

Queue value

Suppressed value. Represented internally byconstantResultList.SUPPRESS. Suppressed when creating target element

The displayed queue contains thefollowing values:

• ResultList.SUPPRESS

• ResultList.CC

• “toothpaste”

• ResultList.CC

• ResultList.SUPPRESS

Page 68: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - Node Functions – removeContexts(I)

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

<Test_In_Remove><item>A.one</item><item>A.two</item><item>A.three</item><item>B.one</item><item>B.two</item>

</Test_In_Remove

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

<Test_Out_Remove><header name=“A">

<item>A.one</item> <item>A.two</item> <item>A.three</item>

</header><header name="B">

<item>B.one</item> <item>B.two</item>

</header></Test_Out_Remove>

Target MessageMappingSource Message

With removeContexts

use removeContext() to delete the parent context of an element.

Page 69: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling - Node Functions – removeContexts (II)

Target MessageMappingSource Message

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

<Test_In_Remove><item>A.one</item> <item>A.two</item> <item>A.three</item>

</Test_In_Remove>

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

<Test_Out_Remove><header name=“A">

<item>A.one</item> <item>A.two</item> <item>A.three</item>

</header><header name="B">

<item>B.one</item> <item>B.two</item>

</header></Test_Out_Remove>

Without removeContexts

Page 70: TBIT41+ +Mapping+Functionality+in+XI

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

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

<Test_In_Split><new_context>

<item>one</item> </new_context><new_context>

<item>two</item> </new_context><new_context>

<item>three</item> </new_context><new_context>

<item>four</item> </new_context>

</Test_In_Split>

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

<Test_Out_Split><header>

<item>one</item> <item>two</item> <item>three</item> <item>four</item>

</header></Test_Out_Split>

Target MessageMappingSource Message

Context Handling - Node Functions – SplitByValue (I)

With SplitByValue

SplitByValue() is the counterpart to removeContexts()inserts a context change in the source value queue. context change in the queue after each value, after each change to the

value, or after an empty tag.

Page 71: TBIT41+ +Mapping+Functionality+in+XI

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

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

<Test_In_Split><new_context>

<item>one</item> <item>two</item> <item>three</item> <item>four</item>

</new_context><new_context /> <new_context /> <new_context />

</Test_In_Split>

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

<Test_Out_Split><header>

<item>one</item> <item>two</item> <item>three</item> <item>four</item>

</header></Test_Out_Split>

Target MessageMappingSource Message

Context Handling - Node Functions – SplitByValue (II)

Without SplitByValue

Page 72: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling – Explicit Context Selection (I)

XML representationMessage Type

As of XI 2.0 SP3 the context of source nodes and elements can be selected explicitlyMore precise handling as removeContexts functionBut: removeContexts function still necessary for context manipulation within a mapping chainExample:

Page 73: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling – Explicit Context Selection (II)

ResultingQueue

Context

Explicit choice of contexts and resulting queuesContext changes are relevant:

user-defined functionsstructure hierarchy

But: the removeContexts function is still necessary for context manipulation within a mapping chain :

Page 74: TBIT41+ +Mapping+Functionality+in+XI

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

Context Handling – Explicit Context Selection (I)

Comparing two contexts with diverse numbers of entries:Last value of context with less elements is reiteratedApplies also to Constants

Example: the content of the two contexts is concatenated; Value “prodAttribute” of /Fieldnames is reiterated to fill up result context.

Page 75: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 76: TBIT41+ +Mapping+Functionality+in+XI

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

Value Mapping (I) – FixValues

The FixValues function provides a simple generic value mapping (or key mapping) in the Integration Repository

1. Use the standard function Conversions -> FixValues to link source and target element

2. Double click to define properties

Each field mapping uses its own table of key-value pairs.Filled tables can be copied to other mappings. But copied table is independent of origin.

Page 77: TBIT41+ +Mapping+Functionality+in+XI

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

Value Mapping (II) – Value mapping

The Value mapping function provides a more specific value transformation.

1. Use the standard function Conversions -> Value mapping to link source and target element

2. Double click to define properties3. Define access keys for table entries:

Value Mapping Context stores information on the origin of the data. If data is maintained in the Integration Directory, use http://sap.com/xi/XI

Agency and Schema for sender and receiver messages. Any arbitrary string value can be used.

Page 78: TBIT41+ +Mapping+Functionality+in+XI

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

Value Mapping (III) - Value Mapping Group

Semantically identical information is collected in “Value Mapping Groups”Value Mapping Groups can be maintained:

in the Integration Directoryby sending data to Message Interface “ValueMappingReplication” of SAP BASIS -> SAP BASIS 6.40 -> http://sap.com/xi/XI/System

Following entries are required1. Agency 2. Schema (Namespace and Object Type )3. Value (the group’s representative for a given Agency – Schema combination)

Page 79: TBIT41+ +Mapping+Functionality+in+XI

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

Value Mapping (VI) – Define Value Mappings

Value Mappings are created automatically between representatives of the same groupAll entries for a couple of Agency/Schema combinations are displayed using Tools-> Value Mapping in the Integration DirectoryEach new entry will create automatically a new group.

Page 80: TBIT41+ +Mapping+Functionality+in+XI

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

Value Mapping (VI) – Mass Configuration

Mass data can be maintained in Value Mappings tables by means of an XI InterfaceBased on Message Interface ValueMappingReplication of http://sap.com/xi/XI/System in SC SAP BASIS 6.40Configuration has to be created in DirectoryProvided data has to correspond to structure:

Page 81: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 82: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Overview

Functional enhancements if standard functions do not fulfill requirementsIs only visible in the message mapping in which you created itIntegration of Java programs from imported archives of the same software component version Usage just like standard functions

Page 83: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Overview

User–Defined Function types:Simple functions, which can process individual field input values for each function call. Simple functions, therefore, expect strings as input values and return a string.Advanced functions, which can process non–single string field input values for each function call. You can pass either all field values of a context or the whole queue for the field in an array when calling the function. Each input field is passed as an array of String. Returned values are stored in a String array, ResultList.

Page 84: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Definition

Specify:Label:Text that appears in the function chooser and on the data-flow object to identify the new function.Argument Count:The number of input values that should be transferred to the function. Input values are of type java.lang.String

Description:Description of the function’s use.

Page 85: TBIT41+ +Mapping+Functionality+in+XI

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

Define User

Function

User-Defined Functions – Binding of external Classes (I)

Page 86: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Binding of external Classes (I)

Select Simple FunctionSingle return value is of type java.lang.String

Import Java packages if required, e.g. sap.xi.mytools.*; sap.xi.myutils.*;

Page 87: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Binding of external Classes (I)

Example: following class should enhance a user-defined function

com.sap.aii.mappingtool.tf3.rt.Container

Page 88: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Binding of external Classes (II)

Procedure:

1. Compile your Java class and create a .jar

2. Create a new Imported Archive and upload your .jar.

3. The relevant class has to be declared in the Import statement

Page 89: TBIT41+ +Mapping+Functionality+in+XI

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

Advanced user–defined functions can access more than just individual values. A complete context or an entire queue can be accessed.

Message Mapping works by using queues. There is a queue for each hierarchy level.

Context Queue

User-Defined Functions – Advanced Functions

Page 90: TBIT41+ +Mapping+Functionality+in+XI

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

Advanced user–functions can import either just one context or the complete queue into input String arrays.

To import the complete queue, check the “Cache Entire Queue” checkbox in the function editor.

Working with Contexts or Queues

Contains context change indicator. Much more memory intensive.

Queue

Do not have identifiable context change.

Context

ImplicationsInformation in Cache

Context changes at the beginning and end of the context or queue are implicit and cannot identified.

User-Defined Functions – Advanced Functions

Page 91: TBIT41+ +Mapping+Functionality+in+XI

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

User-Defined Functions – Advanced Functions

Input parameters: String[] , ResultList, ContainerFlag “Cache the whole queue”

Selected: all values of the whole queue are passed to the functionNot selected: values of one context is passed to the function

ResultList contains output of functionOutput builds up a new queue

Page 92: TBIT41+ +Mapping+Functionality+in+XI

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

User-defined functions – String[]

Context changes are treated as fieldsThey are represented by class variable java.lang.String ResultList.CCQueue output determines input values of user-defined functionsFirst and last context change of each queue are suppressed

String[] a ={"A.1.1","A.1.2", "A.2.2","A.3.1", ResultList.CC,"B.1.1","B.2.1","B.2.2"};

String[] a ={"A.1.1","A.1.2", ResultList.CC,"A.2.1", ResultList.CC,"A.3.1", ResultList.CC,"B.1.1", ResultList.CC,"B.2.1", "B.2.2"};

Caching the whole queue Not caching the whole queue

String[] a ={"A.1.1", "A.1.2", "A.2.1","A.3.1"}; {"B.1.1","B.2.1", "B.2.2"};

String[] a ={"A.1.1", "A.1.2"};{"A.2.1"}; {"A.3.1"}; {"B.1.1"};{"B.2.1","B.2.2"};

Page 93: TBIT41+ +Mapping+Functionality+in+XI

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

User-defined functions – Container

Container supports the methodsvoid setParamter(String, Object)Object getParameter(String)

Stalled parameters can be accessed in this specific functionGlobalContainer getGlobalContainer()MappingTrace getTrace()Map getTransformationParameters()

Map can be used to get runtime constants, e.g.Object map.get(StreamTransformationConstants.SENDER_SYSTEM)

GlobalContainer supports the methodsvoid setParamter(String, Object)Object getParameter(String)

Stalled parameters can be accessed in different functions of one message mapping

MappingTrace supports the methodsvoid addWarning(String) – trace level: 1, 2, 3void addInfo(String) – trace level: 2, 3void addDebugMessage(String)– trace level: 3

Writes String to message monitoring

Page 94: TBIT41+ +Mapping+Functionality+in+XI

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

User-defined functions – ResultList

ResultList supports the methods and constantsvoid addValue(String)

void addContextChange()

void addSuppress()

void clear()

ResultList.CC (context change)

ResultList.SUPPRESS (suppressed value)

Outbound queue has to be build up manually, i.e. in case you cache the whole queue values, context changes and suppressed values have to be added manually.

Page 95: TBIT41+ +Mapping+Functionality+in+XI

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

User-defined functions – function types

Function is called once per context or queue. Values of context /queue are stored in input string arrays

Function is called once per field mapping

Processing

result.addValue(String);return String;ReturningValues

String[], …, ResultList, Container

String, …, ContainerInput Parameters

Advanced FunctionsSimple Functions

Page 96: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 97: TBIT41+ +Mapping+Functionality+in+XI

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

Examples – Get value by key (I)

Problem: A specific value should be filtered by a key or qualifierExample: only English <TEXT> should be mapped to resulting field<Description>

Page 98: TBIT41+ +Mapping+Functionality+in+XI

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

Examples– Get value by key (II)

2. Set Contexts of <LANGKEY> and <TEXT>

1. Create mapping

Solution:

Page 99: TBIT41+ +Mapping+Functionality+in+XI

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

Examples– Get value by key (III)

Since the element <Description> may only occur once in theresulting structure, the output has to be put in a single context. Thetwo suppressed values are removed automatically when theresulting document is created

In an alternative solution two contexts of <LANGKEY> and <TEXT> keep their initial contexts and a removeContexts is inserted afterthe ifWithoutElse function.

4. Explanation

3. Display Queues to investigate

Discussion:

Page 100: TBIT41+ +Mapping+Functionality+in+XI

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

Examples – Copy head to line (I)

Problem:A hierarchical structure has to be mapped to a flat structure One <row> should be created per <Item>Header information (represented <Header>) occurring only once per <Order> should be multiplied and copied to <row>.

Page 101: TBIT41+ +Mapping+Functionality+in+XI

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

Examples – Copy head to line (II)

2. Createmappings

1. Create User-Defined Function

Solution:

Page 102: TBIT41+ +Mapping+Functionality+in+XI

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

Examples – Copy head to line (III)

The User-Defined Function copyPerValue copies the value of <Address> per each occurrence of <Item> to the relevant context. The SplitByValue function then distributes the copied values to the contexts of the flat structure.

Since <Item> only contains empty fields, you can use in this casealso function concat instead of copyPerValue. See ContextHandling – Explicit Context Selection (I) for details.

4. Explanation

3. Display Queues

Discussion:

Page 103: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 104: TBIT41+ +Mapping+Functionality+in+XI

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

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

SummarizationSequence–Number GenerationDuplicating SubtreesTable / Value LookupsTree–Reversal

Page 105: TBIT41+ +Mapping+Functionality+in+XI

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

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:

Mapping “Patterns” – Summarization

Target: Total and count the order by each customer and a summary of all orders

Source: Order details containing customer, order numbers and order amount

Page 106: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Summarization

Page 107: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Summarization

Mapping Result:

Page 108: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

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.

Page 109: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

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.

Page 110: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

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.

Page 111: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

1. Use Advanced User–Defined function to generate the sequence number all at once.

Page 112: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

1. Use Advanced User–Defined function to generate the sequence number all at once.

Test Results:

Page 113: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

2. Use Simple User–Defined function to generate the sequence number for each occurrence separately, keeping track of the sequence numbervalue 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.

Page 114: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

2. Use Simple User–Defined function to generate the sequence number for each occurrence separately, keeping track of the sequence numbervalue previously generated.

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

Page 115: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Sequence–Number Generation

2. Use Simple User–Defined function to generate the sequence number for each occurrence separately, keeping track of the sequence numbervalue previously generated.

Page 116: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Duplicating Subtrees

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.

Page 117: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Duplicating Subtrees

The subtree “CurrencyAmt” must be duplicated first. This will create 2 CurrencyAmt’s. One for credit, and one for debit.

Page 118: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Duplicating Subtrees

Page 119: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Duplicating Subtrees

Mapping Results:

Page 120: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Table/Value Lookup

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.

Page 121: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Table/Value Lookup

Source: Target:

=

Page 122: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Table/Value LookupJava Function:

The lookup’d value must be written to the ResultList.

Page 123: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Table/Value Lookup

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

Contexts must be set a root level.

Page 124: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Table/Value Lookup

Mapping Results:

Page 125: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal 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 orderidslisted.

Page 126: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

The source document is organized by orderid, product 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.

Page 127: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

Three Java functions were written to:

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

Page 128: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

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

Page 129: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

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.

Page 130: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

Mapping for ITEM: To create the number of elements.

Page 131: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

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

Page 132: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–ReversalDisplay Queue for determining NAME:

Page 133: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

Mapping to create the number of element for ORDERS_WHERE_ITEM_IS_FOUND.

Page 134: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

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

Page 135: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

Display Queue for determining TotalSalesFOrThisItem:

Page 136: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

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

Page 137: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–ReversalDisplay Queue for determining ORDERID:

Page 138: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Tree–Reversal

Partial listing of the mapping results:

Page 139: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 140: TBIT41+ +Mapping+Functionality+in+XI

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

Multi–Mappings

Multi–Mapping can only be used in ccBPM:Used to map abstract interfacesDevelopment is the same as Message Mappingsn:1 TransformationBundles multiple messages into one message, for example, individual purchase order items into one purchase order.1:n TransformationSplits a message into multiple messages, for example, a purchase order into the individual purchase order items.n:m TransformationConverts a message into another message, for example, a message that is defined by interface A is converted to message that is defined by interface B.

Multi–Mappings reference multiple message structures:All source message structures are combined into 1 source structure.All target message structures are combined into 1 target structure.Therefore, there is only one source structure mapped to one target.

Page 141: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Multi–Mappings

The Message Types are entered using the Messages tab in the mapping editor.The root element is always <Messages>.The Mapping Editor inserts an element <MessageN> for each source or target message, where N is the position of the message.

Example:

OrderInfo(1)OrderItem(0…unbounded)

Order(1)OrderHeader(1)

Message Type (Target)Message Type (Source)

Page 142: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping “Patterns” – Multi–Mappings

Insert more messages

Change Occurrences

No msgtype name

Mapping rules are the same as for previously discussed Message Mappings.

Page 143: TBIT41+ +Mapping+Functionality+in+XI

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

Overview Integration Builder

Mapping – Introduction

Message MappingGeneral ConceptsStandard FunctionsElement CardinalityNode FunctionsValue MappingUser-Defined FunctionsExamplesMapping “Patterns”Multi–MappingMapping Template

Page 144: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping Templates

Message Mappings can be saved as Mapping Templates.

Mapping Templates can be reused (or loaded) in other Message Mappings or Mapping Templates.

Features:

Mapping Templates can be defined for structure mappings of the following structures:

Data TypesComplex types in IDocs and RFCsComplex types in External DefinitionsThe referenced types used in mapping templates can be located in any software component versions.

Page 145: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping Templates

The Mapping Editor is used to create and load the structures used by the Mapping Templates.

Defining Mapping TemplatesThe Mapping Template can be saved by:

1. Selecting the Source and Target source in the Mapping Editor2. Choose Save Mapping Template from either the target structure context menu or

from the object toolbar3. Enter a unique name for the new Mapping Template.

Page 146: TBIT41+ +Mapping+Functionality+in+XI

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

Mapping Templates

Using Mapping Templates:

Mapping Templates can be used in Message Mappings from any software component version:

1. In the Mapping Editor, select a type element in the source and target structure.2. Choose Load Mapping Templates from either the target structure context menu or from

the object toolbar.3. If mapping templates are available for the types in the source and target fields, a select

dialog window will be displayed.

The Types must match what were defined in the existing Mapping Templates.

Page 147: TBIT41+ +Mapping+Functionality+in+XI

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

Further Information

Public Web:http://help.sap.comhttp://sdn.sap.comhttp://service.sap.comSAP Customer Services Network: http://www.sap.com/services/

Related XI 3.0 Workshop / Training OpportunitiesNetWeaver04 OverviewXI 3.0 Implementation WorkshopIntroduction to XML and Technical StandardsAdvanced Integration BuilderAdvanced BPMAdapter FrameworkB2B and Industry StandardsProxy Development and Deployment

Page 148: TBIT41+ +Mapping+Functionality+in+XI

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

Q&A

Questions?

Page 149: TBIT41+ +Mapping+Functionality+in+XI

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

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of Microsoft Corporation.

IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®, OS/390®, OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity®, Tivoli®, Informix and Informix® Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries.

ORACLE® is a registered trademark of ORACLE Corporation.

UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.

Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarks of Citrix Systems, Inc.

HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

JAVA® is a registered trademark of Sun Microsystems, Inc.

JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.

MarketSet and Enterprise Buyer are jointly owned trademarks of SAP AG and Commerce One.

SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are trademarks of their respective companies.

Copyright 2004 SAP AG. All Rights Reserved

Page 150: TBIT41+ +Mapping+Functionality+in+XI

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

Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durch SAP AG nicht gestattet. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden.

Die von SAP AG oder deren Vertriebsfirmen angebotenen Softwareprodukte können Softwarekomponenten auch anderer Softwarehersteller enthalten.

Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® und SQL Server® sind eingetragene Marken der Microsoft Corporation.

IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®, OS/390®, OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity®, Tivoli®, Informix und Informix® Dynamic ServerTM sind Marken der IBM Corporation in den USA und/oder anderen Ländern.

ORACLE® ist eine eingetragene Marke der ORACLE Corporation.

UNIX®, X/Open®, OSF/1® und Motif® sind eingetragene Marken der Open Group.

Citrix®, das Citrix-Logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® und andere hier erwähnte Namen von Citrix-Produkten sind Marken von Citrix Systems, Inc.

HTML, DHTML, XML, XHTML sind Marken oder eingetragene Marken des W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

JAVA® ist eine eingetragene Marke der Sun Microsystems, Inc.

JAVASCRIPT® ist eine eingetragene Marke der Sun Microsystems, Inc., verwendet unter der Lizenz der von Netscape entwickelten und implementierten Technologie.

MarketSet und Enterprise Buyer sind gemeinsame Marken von SAP AG und Commerce One.

SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com und weitere im Text erwähnte SAP-Produkte und -Dienst-leistungen sowie die entsprechenden Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und anderen Ländern weltweit. Alle anderen Namen von Produkten und Dienstleistungen sind Marken der jeweiligen Firmen.

Copyright 2004 SAP AG. Alle Rechte vorbehalten