33
8/13/2019 01 General Concepts SAP PI http://slidepdf.com/reader/full/01-general-concepts-sap-pi 1/33 1 General Concepts  Author: Joachim Orb

01 General Concepts SAP PI

Embed Size (px)

Citation preview

Page 1: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 1/33

1

General Concepts Author: Joachim Orb

Page 2: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 2/33

2

© SAP AG 2004, General Concepts, Joachim Orb

Objectives

 After completing this session you will be able to:

Understand the general concepts of XI Message Mapping

Use standard functions in Message Mapping

Understand the impact of element cardinality on Message Mapping

Page 3: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 3/33

3

© SAP AG 2004, General Concepts, Joachim Orb

Overview

General Concepts

Standard Functions

Element Cardinality

Page 4: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 4/33

4

 A message mapping consists of several target field mappings:

 A target field mapping is a mapping of one or several source fields to one target field. The data

flow editor in the bottom area helps you to design a target field mapping.

 All target field mappings describe a complete message mapping

Only mandatory fields of the target structure must be mapped

(displayed in red)

If you want to get an overview of the whole message mapping, use the text preview

function (papersheet icon with glasses).

Design a message mapping as a combination of target field mappings:

1. Create a message mapping in the design maintenance of the Integration Builder.

2. Using the structure overview and the data-flow editor, assign one or more source

fields to a target field. This is a Target Field Mapping (see above). It is also

possible to assign one source field to multiple target fields.

3. If necessary, enhance the target field mapping in the data-flow editor. To do so,

connect the source fields to the target fields by using the standard functions of the

mapping editor. You can also create user-defined functions in Java in the mapping

editor and then also use them in the data-flow editor.4. Carry out the last two steps for at least all mandatory target fields.

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Mapping Editor (I)

Data-Flow Editor 

Structure Overview

Source Structure Target Structure

Target Field Mapping

Page 5: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 5/33

5

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Mapping Editor (II)

 Import of source and target structure

From Integration Repository

XSDs developped in the Integration RepositoryImported External Defini tions (WSDLs, XSDs, DTDs)

Imported SAP meta data (RFCs, IDocs)

From local fi le 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 impor ted)

<xsd:include> and <xsd: import> are not supported

Mapping editor displays a simpl ified XML representation

of XSD files in structure overview

Page 6: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 6/33

6

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Mapping Editor (III)

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

1. By using an existing object already created in the Integration Repository

(e.g. Message Type, External Definit ions)

2. By using an RFC or IDoc meta data imported from SAP

3. By importing XML or XSD files from local file system

Page 7: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 7/33

Page 8: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 8/33

8

© SAP AG 2004, General Concepts, Joachim Orb

Icon Status Display

Element with maxOccurs = unbounded

MeaningIcon

Node

Element

 Attribute

Icon Types

Icon Colors

Mapping to target field completeGreen

 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

Red Attribute or element not assignedWhite

MeaningColor 

Page 9: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 9/33

9

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Elements

 At tr ibute

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 10: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 10/33

10

 A message mapping consists of several target field mappings:

 A target field mapping is a mapping of one or several source fields to one target field. The data

flow editor in the bottom area helps you to design a target field mapping.

 All target field mappings describe a complete message mapping

Only mandatory fields of the target structure must be mapped

(displayed in red)

If you want to get an overview of the whole message mapping, use the text preview

function (papersheet icon with glasses).

Design a message mapping as a combination of target field mappings:

1. Create a message mapping in the design maintenance of the Integration Builder.

2. Using the structure overview and the data-flow editor, assign one or more source

fields to a target field. This is a Target Field Mapping (see above). It is also

possible to assign one source field to multiple target fields.

3. If necessary, enhance the target field mapping in the data-flow editor. To do so,

connect the source fields to the target fields by using the standard functions of the

mapping editor. You can also create user-defined functions in Java in the mapping

editor and then also use them in the data-flow editor.4. Carry out the last two steps for at least all mandatory target fields.

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts – Assignment of Fields

drag&dropdrag&dropdrag&drop

Double click on afield

=navigate tomapping

Double click on afield

=insert field intodata-flow editor 

Page 11: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 11/33

11

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Data–Flow Editor 

DeleteFloatingObjects

Lay OutMapping

DeleteCurrent

Mapping

SelectFunctionCategory

DefineUser

Function

SelectFunction

Page 12: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 12/33

12

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts – Mass Assignment

1.Mark root nodesof subtrees

2. Chooseassignment function

• Mappings are created automatically for homonymous child elements

Page 13: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 13/33

13

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts – Mapping Templates

1.Mark root nodesof subtrees

2. Right-click onnode. Choose “ ShowSuitable Templates”

• Mapping Templates based on Date Types have to be created beforehand

• Subnodes must reference this pair of Data Types

Page 14: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 14/33

14

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Text Preview

 Al l target field mappings

Text Preview

Text Preview pertarget field

Page 15: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 15/33

15

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts - Dependencies

Dependencies

 Al l mappings ormappings of two selectedsubnodes are displayed

Page 16: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 16/33

16

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts – Test Mappings (I)

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

Prerequisites

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

target field must be assigned to one or more source fields.

There must not be any unassigned arguments when using functions.

Create test

cases

Tree View

XML documentview

Execute

Mapping

Create

empty

template

Loads an XML

instance from a

local file.

Page 17: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 17/33

17

© SAP AG 2004, General Concepts, Joachim Orb

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.

Using the Tree View, you can copy

sub-trees, delete nodes, and add

elements and att ributes. In the

Value column you can also enter

values fo r f ields.

Enter test

data

Page 18: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 18/33

18

© SAP AG 2004, General Concepts, Joachim Orb

General Concepts – Debug Mappings

Using the “ Display Queue” to examine each step of the mapping:

Note:

The “context”

display and

usage in the

queues wi ll be

discussed in

later slides.

Page 19: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 19/33

19

© SAP AG 2004, General Concepts, Joachim Orb

Overview

General Concepts

Standard Functions

Element Cardinality

Page 20: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 20/33

20

© SAP AG 2004, General Concepts, Joachim Orb

Standard Functions: Introduction

 Al l functions expect and return s tr ing values

Generating funct ions ‘produce’ values (for example: Constant) Some standard functions provide function properties (denoted by a

small asterisk)

For example: concat lets you additionally specify a delimiter 

Call the function properties window by double clicking the function

 R = f(X 1 ,X 2)X1

X2

R

 R = f(X 1 ,X 2 ,X 3)

X1

X2 R

X3

O = f(I)I O

O =Generated Value

  O

Page 21: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 21/33

21

Functions of category Node functions help you to handle situations like

Your mapping depends on the existence of a field in the source structure

You have to create a tag in your target structure that does not exist in your source structure

See online documentation for details and examples about node functions.

Generating functions

 All functions (regardless of whether they are standard or user-defined functions)

that do not have input values are referred to as Generating Functions. This also

includes the function CopyVal ue( ) .

 A target field with maxOccur s=<n> that is assigned a generating function is

generated <n> times in the target structure. If maxOccur s=unbounded for the

target field, then exactly 5 target fields are generated.

© SAP AG 2004, General Concepts, Joachim Orb

Simple Standard Functions: c o n c a t  

 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 properties

Delimiter=“ “

Page 22: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 22/33

22

© SAP AG 2004, General Concepts, Joachim Orb

Simple Standard Functions: S u b s t r i n g  

 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 23: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 23/33

23

© SAP AG 2004, General Concepts, Joachim Orb

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 24: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 24/33

24

© SAP AG 2004, General Concepts, Joachim Orb

Boolean Functions

 Boolean funct ions

Return true or false string

Interpret 1 and true (not case-sensitive) as true-value

X

Z

Y

then

if 

else

Result value if condition is true

Result value if condi tion is false

Condition R = Y if X is true or 1,

else Z

X

Y

if 

then

Condition

Result value

if condition is true

R = Y if X is true or 1

or no tag is produced

ifWithoutElse

if

Page 25: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 25/33

25

Functions of category Node functions help you to handle situations like

Your mapping depends on the existence of a field in the source structure

You have to create a tag in your target structure that does not exist in your source structure

See online documentation for details and examples about node functions.

Generating functions

 All functions (regardless of whether they are standard or user-defined functions)

that do not have input values are referred to as Generating Functions. This also

includes the function CopyVal ue( ) .

 A target field with maxOccur s=<n> that is assigned a generating function is

generated <n> times in the target structure. If maxOccur s=unbounded for the

target field, then exactly 5 target fields are generated.

© SAP AG 2004, General Concepts, Joachim Orb

Calculations

Function category: Ar ithmetic

Calculations (add, multiply, etc.) are performed

with Java float precision

Trailing zeros in result are truncated, e.g.: 4.2-0.2 = 4

To keep t railing 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 26: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 26/33

26

© SAP AG 2004, General Concepts, Joachim Orb

Overview

General Concepts

Standard Functions

Element Cardinality

Page 27: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 27/33

27

© SAP AG 2004, General Concepts, Joachim Orb

Element Cardinality – Mandatory Mappings(m i n O c c u r s > 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 suf ficient values are provided

from the source structure the last

source element is reiterated.

Page 28: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 28/33

Page 29: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 29/33

29

© SAP AG 2004, General Concepts, Joachim Orb

Element Cardinality – Repeating Elements(m a x O c c u r s > 1 )  

 Mapping of Repeating Elements

and Nodes (maxOccurs>1)

Source: Target element iscreated as of ten 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 30: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 30/33

30

© SAP AG 2004, General Concepts, Joachim Orb

Element Cardinality – Node Mapping

 Mapping of non mandatory

Nodes (minOccurs=0)

If a non mandatory nodecontains elements with

minOccurs>0, these elements

become mandatory after their

parent node is assigned.

Page 31: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 31/33

31

© SAP AG 2004, General Concepts, Joachim Orb

Element Cardinality – Node Mapping (II)

 Mapping of non mandatory

Nodes (minOccurs=0)

 Assignment of elements is notsufficient

Node has to be ‘created’ by

assigning a suitable source

node/element

Page 32: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 32/33

32

© SAP AG 2004, General Concepts, Joachim Orb

Element Cardinality – Unique Target Mapping

 Mapping from more than one

Source element

Only a single and uniquemapping 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 “ DuplicateSubtree”

Page 33: 01 General Concepts SAP PI

8/13/2019 01 General Concepts SAP PI

http://slidepdf.com/reader/full/01-general-concepts-sap-pi 33/33

© SAP AG 2004, General Concepts, Joachim Orb

Summary

 Now you should be able to:

describe the main functions and the handling of the Mapping Editor

use Standard Functions of the XI 30. Message Mapping

understand the impact of Element Cardinality on Message Mapping