Pi Mappings Functions PDF
Pi Mappings Functions PDF
Infrastructure 3.0 -
Graphical Mapping
Introduction and New
Features
William Li
Multi–Mappings
Mapping Templates
Summary
Multi–Mappings
Mapping Templates
Summary
Mapping
n Transformation from one message structure to another
n Transformation of one key value to another
Value
<hh:book-flight xmlns:hh="..."> Mapping
<hh:customer>
<hh:first-name>Micheal</hh:first-name> <ak:BookFlight xmlns:ak="...">
<hh:surname>Moore</hh:surname> <ak:Date>22.11.2001</ak:Date>
</hh:customer> <ak:Flight>087</ak:Flight>
<hh:booking-data> <ak:Passenger>Micheal Moore</ak:Passenger>
<hh:airline>Airline Kingdom</hh:airline>
Structure Mapping <ak:Class>2</ak:Class>
<hh:connection>AK087</hh:connection> <ak:Agency>Happy Holiday</ak:Agency>
<hh:date>2001-11-22</hh:date> </ak:BookFlight>
<hh:class>business</hh:class>
</hh:booking-data>
</hh:book-flight>
Determination of technical
Logical receiver & interface Transformation of sender
connectivity information
determination based on format & values into
(address, transport protocol,
business level rules receiver format & values
adapter, ...)
Integration Server
FROM application systems or adapters
Integration
Routing Rules M apping Relations W eb Services
Directory
Integration
M appings
Repository
Integration Repository
Sender Receiver
Message Interface Interface Mapping(s) Message Interface
Request
Message Mapping
XSLT Mapping
Request Java Mapping Request
Message Type ABAP Mapping
Message Type
Response
Message Mapping
XSLT Mapping
Response Java Mapping Response
Message Type ABAP Mapping Message Type
Message Mapping
XSLT Mapping
Fault
Message Mapping
n Designed by using the graphical mapping editor of Integration
Builder
n Result: Generated Java Code.
n NOT memory–intensive, can “theoretically” handle GB–sized
messages
Imported Archives
n Import externally defined mapping programs into repository
n Java mapping:
Implemented by using a specific interface
n XSLT mapping:
u Runtime supports XSLT processor
u Java methods can be called from within a Style Sheet
ABAP Workbench
n ABAP Mappings in ABAP objects
n XSLT Mappings (ABAP Engine)
You can execute mapping programs in a sequence
(Only for a request or a response message)
Use
n Design structure mapping between any 2 XML structures
n Connect to “value” mapping
n Generates java source code and jar files to be used during
runtime.
n Can load the following into the structure overview:
u A schema from the Integration Repository
l Message Types
l External Definitions
l Imported Objects (RFCs and IDOCs)
u XML or XSD files from a local file (import and include are
ignored in XSD)
Standard Functions
n E.g. string processing, number/date formatting, boolean, …
Value Mapping
Node functions
User-defined functions
n Java method
Icon Types
Icon Meaning
Attribute
Element
Icon Colors
Color Meaning
White Optional attribute or element not assigned
Red Attribute or element must be assigned to complete the
mapping
Yellow Attribute or element has already been assigned but the
corresponding mapping in the data-flow editor is not
complete
Green Mapping to target field complete
Double click on a
Double click on Double click on a white/red field
an any field green/yellow field =
= = insert field into
insert field into navigate to data-flow editor
data-flow editor target field mapping
drag&drop
drag&drop drag&drop
Delete
Delete Current
Floating Mapping
Lay Out
Objects
Mapping
Select
Function
Category
Define Select
User Function
Function
All target
field
mappings
Dependencies
All mappings or
mappings of two selected
subnodes are displayed
Dropdown
XML provides the
Execute document creation and
Tabular
Mapping view saving of test
Tree View
cases
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.
Enter test
data
Using the context menu in the Using the editor for the XML view,
(Tabular) Tree View, you can copy you can manually edit elements
sub-trees, delete nodes, and add and attributes or their values
elements and attributes. In the here. Use CTRL C, CTRL X, and
Value column in the tabular tree CTRL V respectively to copy, cut,
view you can also enter values for and paste parts of an XML
fields. instance.
Note:
The “context”
display and
usage in the
queues will be
discussed in
later slides.
n Most data-flow objects have two or three inbound channels on the left-
hand side, and one outbound channel on the right-hand side.
n There are also conversion functions with one inbound and outbound
channel and functions that get a value without making any entries.
<Customer> <Contact>
<firstname> <name>
Harry Harry Potter
</firstname> </name>
<surname> </Contact>
Potter
</surname>
</Customer>
concat properties
Delimiter=“ “
<Customer> <Contact>
<customerID> <customerNo>
0123456789-181170 0123456789
</customerID> </customerNo>
</Customer> </Contact>
substring properties
start from: 0
count: 10
<Customer> <Contact>
<custBirthday> <birthday>
181170 11/18/1970
</custBirthday> </birthday>
</Customer> </Contact>
DateTrans properties
src Format: ddMMyy
dst Format: MM/dd/yyyy
Example:
Result:
Example: Depending on the value of type (internal or external), the target tag either
internalRequest or externalRequest will be created.
Context Change
n Message mapping works
internally by using queues
n If no further elements are
imported at a particular hierarchy
level, a Context Change is
inserted in the queue
n Use node functions to handle
changes in the message
hierarchy.
removeContexts
n deletes all context changes of a
queue
SplitByValue
n insert additional context changes
in a queue
With removeContexts
<Test_Out_Remove> <Test_In_Remove>
<header name=“A"> <item>A.one</item>
<item>A.one</item> <item>A.two</item>
<item>A.two</item> <item>A.three</item>
<item>A.three</item> <item>B.one</item>
</header> <item>B.two</item>
<header name="B"> </Test_In_Remove
<item>B.one</item>
<item>B.two</item>
</header>
</Test_Out_Remove>
Without removeContexts
<Test_Out_Remove> <Test_In_Remove>
<header name=“A"> <item>A.one</item>
<item>A.one</item> <item>A.two</item>
<item>A.two</item> <item>A.three</item>
<item>A.three</item> </Test_In_Remove>
</header>
<header name="B">
<item>B.one</item>
<item>B.two</item>
</header>
</Test_Out_Remove>
Use removeContext() to delete all the higher contexts for an element. This deletes all
higher hierarchy levels, so that all elements of the target queue are assigned to a root
element of the source queue.
Example when
source has multiple
elements.
String
n All parameters passed in user functions are as String or array of
String:
u Single String variable is passed in simple user function
u String array is passed in advanced user function
n String has the following useful methods:
u substring
u concat
u equals and equalsIgnoreCase
u length
n String comparisons:
u DO NOT use:
String a;
if (a == “PRODUCT”) …
u DO use:
String a;
if (a.equals(“PRODUCT”)) …
or
if (a.equalsIgnoreCase(“PRODUCT”)) …
Arrays
n Parameters in advanced user functions are passed as arrays.
n Most common processing of arrays is the use of for…next:
String[ ] a;
for (int i=0; i<a.length; i++) {
if (a[i].equals(“PRODUCT”) …
…..
}
Integer
n Use Integer class to convert integer to String
int i = 100;
String a = Integer.toString(i);
User–Define Functions:
n Functional enhancements: if standard functions do
not fulfill requirements
n Is only visible in the message mapping in which you
created it
n Can use Java programs from imported archives of
the same software component version
n Use just like standard functions
Object Use
Container This object enables you to cache the values that you
want to read again when you next call the same user-
defined function.
GlobalContainer This object enables you to cache the values that you
want to read again when you next call any user-
defined function that is in the same message
mapping.
MappingTrace This object enables you to transfer information for
the mapping trace during mapping to a container that
can be viewed by users in the message monitoring.
Define
User
Function
Queue
Context
Context changes at the beginning and end of the context or queue are implicit and
cannot identified.
Value Meaning
Method Use
void addValue(String value); Append a value to the results list.
void clear(); Deletes all previously appended values from the list.
if ( a[index].equals(ResultList.cc) ) …
Note:
n When the input array contains only context, no context change
exists.
n When the input array contains the entire queue, context changes can
exist, but not at the beginning or end of the queue.
Cache (or save) data which can be accessed again when the user–function is
called again.
Methods Use
void setParameter(String Saves the obj object under the name parName in a
parName, object obj); container for a user–specific function.
Object getParameter (String Returns the parameter that was saved under the parName
parName); name in this user–specific function by using the
setParameter method. If no such parameter exists, null
is returned.
MappingTrace getTrace(); Returns a MappingTrace object with which messages can
be written to the mapping trace in the monitor. (to be
discussed)
GlobalContainer Returns a GlobalContainer object with which data can be
getGlobalContainer(); saved and read by any user–defined functions in the
same message mapping. (to be discussed)
Java.util.Map Returns a map with the mapping runtime constants. (to
getTransformationParameters(); be discussed)
This object enables you to cache the values that you want to read again
when you next call any user-defined function that is in the same
message mapping.
Note that the sequence in which user-defined functions are called is predefined.
It depends on the position of the target fields that the function was assigned to.
Methods Use
void setParameter(String parName, Saves the obj object under the name parName in
object obj); a global container for a user–specific function.
Object getParameter (String Returns the parameter that was saved under the
parName); parName name in this user–specific function by
using the setParameter method. If no such
parameter exists, null is returned.
This object enables the writing of messages to the mapping trace in the
message monitoring (SXMB_MONI).
Trace Method Use
Level
0 No trace
Trace level can be set in the Pipeline configuration. Each trace level will include messages
from lesser trace levels, e.g. debug will include messages from warning and info.
Usage example:
MappingTrace trace = container.getTrace();
trace.addInfo(“This is a trace message.”);
Multi–Mappings
Mapping Templates
Summary
n Summarization
n Sequence–Number Generation
n Duplicating Subtrees
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 Result:
Example:
The java function creates the sequence number all at once based on the number of
elements in the source.
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.
Example:
Source: Accounting information with
adjustment type and amount.
Mapping Results:
No msg
type
name
Mapping rules are the same as for previously discussed Message Mappings.
SAP AG 2003, Title of Presentation, Speaker Name / 79
Agenda
Concepts / Overview
Test/Debugging Environment
Standard Functions
n Function Usage
n Simple Function Examples
n Node Function Examples
Features:
The Mapping Editor is used to create and load the structures used by
the Mapping Templates.
Defining Mapping Templates
n The Mapping Template can be saved by:
1. Selecting the Source and Target source in the Mapping Editor
2. Choose Save Mapping Template from either the target structure context menu or
from the object toolbar
3. Enter a unique name for the new Mapping Template.
è Public Web:
http://help.sap.com
http://sdn.sap.com
http://service.sap.com
SAP Customer Services Network: http://www.sap.com/services/
Q&A
n 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.
n Some software products marketed by SAP AG and its distributors contain proprietary software components of other
software vendors.
n Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of
Microsoft Corporation.
n 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.
n ORACLE® is a registered trademark of ORACLE Corporation.
n UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.
n Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and
other Citrix product names referenced herein are trademarks of Citrix Systems, Inc.
n HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium,
Massachusetts Institute of Technology.
n JAVA® is a registered trademark of Sun Microsystems, Inc.
n JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented
and implemented by Netscape.
n MarketSet and Enterprise Buyer are jointly owned trademarks of SAP AG and Commerce One.
n 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.
n 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.
n Die von SAP AG oder deren Vertriebsfirmen angebotenen Softwareprodukte können Softwarekomponenten auch
anderer Softwarehersteller enthalten.
n Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® und SQL Server® sind eingetragene Marken der
Microsoft Corporation.
n 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.
n ORACLE® ist eine eingetragene Marke der ORACLE Corporation.
n UNIX®, X/Open®, OSF/1® und Motif® sind eingetragene Marken der Open Group.
n 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.
n HTML, DHTML, XML, XHTML sind Marken oder eingetragene Marken des W3C®, World Wide Web Consortium,
Massachusetts Institute of Technology.
n JAVA® ist eine eingetragene Marke der Sun Microsystems, Inc.
n JAVASCRIPT® ist eine eingetragene Marke der Sun Microsystems, Inc., verwendet unter der Lizenz der von
Netscape entwickelten und implementierten Technologie.
n MarketSet und Enterprise Buyer sind gemeinsame Marken von SAP AG und Commerce One.
n 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.