Introduction to Mapping in XI Author: Joachim Orb

1

Objectives
After completing this session, you will be able to:
Where mapping steps occur in SAP XI Which mapping techniques you can use within SAP XI How to implement different mapping techniques in SAP XI

© SAP AG 2004, Mapping Introduction, Joachim Orb

2

Overview Overview – Mapping Introduction Java Mapping XSLT Mapping ABAP Mapping © SAP AG 2004. Joachim Orb 3 . Mapping Introduction.

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> Structure Mapping © SAP AG 2004."> <ak:Date>22... The transformation rules.. Mapping Introduction. The transformation process.General Mapping Types Mapping Transformation from one message structure to another Transformation rules defined by mapping program <hh:book-flight xmlns:hh=". and/or 2..Overview . Independently from XI. you can distinguish two different mappings • • Structure mappings transform entire message structures. Value mappings transform values within messages. Joachim Orb The term Mapping means: 1.11."> <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> Value Mapping <ak:BookFlight xmlns:ak=". 4 .

2 2 Business Process Engine • • Integration Engine © SAP AG 2004. Such an interface pair can optionally reference an Interface Mapping An interface mapping points to one or more mapping programs (for request.2) • 1 Business Process Execution • 1.Mapping at Runtime Messages in XI contain a sender interface IS evaluates configuration data of the Integration Directory • Integration Server Inbound Handling (also in adapters) Receiver Determination Interface Determination Channel Determination Mapping Outbound Handling (also in adapters) During logical routing. 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. the IS determines a Receiver Interface (1). Mapping Introduction. Joachim Orb 5 .

For this purpose. You can even define several interface mappings for the same interface pair to take requirements of different scenarios for the same interface pair into account. XSLT mappings or Java mappings) refer to messages: They are associated either to the request. Thus. for example. an interface mapping embraces the mapping programs that shall be used for request. Thus. you just have to choose the relevant interface mapping that had been defined for this pair in the integration repository. Basically. Mapping Introduction. an interface mapping allows you to define a sequence of mapping programs to be executed. This information is evaluated on the integration server to find out receiver and receiver interface. you relate a corresponding outbound and inbound interface to each other and specify which mapping programs shall be used for this interface pair. recall that message exchange in XI is interface based.Overview . not message types. Together with the name of the sending business system. a message can be sent by calling the method of an outbound proxy. you have to create an interface mapping. the definition of interface mappings is obligatory and simplifies the mapping configuration in the integration directory: To choose mappings for an interface pair. Joachim Orb request or Mapping programs (message mappings. 6 . for example.Relate Mapping Programs to Interfaces © SAP AG 2004. By means of an interface mapping. response and fault message. the response or the fault message by referring to the corresponding message types (as shown in the slide) or to the corresponding part ( response) of an RFC. the name of the corresponding outbound interface is an attribute of the message header. Additionally. That‘s why we somehow have to specify which mapping programs belong to which interface pair and this can be done already during design time in the integration repository. first interfaces are related to each other during runtime to exchange messages. However.

As a result. You can implement your own Java mapping by implementing a specific interface of the mapping API. Developers can even decide to combine the different mapping technologies: Message mappings. XSLT mappings and Java mappings can be combined in a sequence by means of an interface mapping (see next slide). XSLT mappings can use java functions Message mappings support user-defined functions that can use imported java packages of the same namespace. Java code is generated from the graphical representation that is compiled before it can be executed on the integration server. It is expected that they are developed using external development tools. there is no tool support in XI. Joachim Orb The exchange infrastructure supports three types of mappings: Message mappings that can be designed using a graphical mapping editor in the Integration Builder. they have to be imported into the integration repository as JAR files before (JAR: Java Archives). To make them available for the integration server. You can implement an XSLT mapping For the latter two. Imported Archives Import externally defined mapping programs into repository Java mapping: Implemented by using a specific interface XSLT mapping: Runtime supports XSLT processor Java methods can be called from within a Style Sheet ABAP Mapping You can execute mapping programs in a sequence © SAP AG 2004.Overview . 7 .Mapping Programs to Map Messages Message Mapping Designed by using the graphical mapping editor of Integration Builder Result: Generated Java Code. Mapping Introduction.

Overview Overview – Mapping Introduction Java Mapping XSLT Mapping ABAP Mapping © SAP AG 2004. Mapping Introduction. Joachim Orb 8 .

Create a .jar or a .1 Using the jar command of the jdk 2. Create a new Imported Archive and import the . Mapping Introduction.jar to the Integration Repository © SAP AG 2004.zip 2.2 Using a built-in IDE functionality 3.g. Develop your Java code locally e. with your IDE 2.Java Mapping (I) Mapping programs can be implemented in Java 1. Joachim Orb 9 .

Java Mapping (II) . SENDER_NAME) The required libraries are contained in the aii_map_api. public void setParameter(java. which is part of your SAP J2EE Engine installation DOM and SAX Parsers provided by the SAP XML Toolkit for Java can be used API to execute value mappings © SAP AG 2004.io.aii.InputStream in. 2.util.mapping.Development Define a Java class that implements the Java interface com.api.OutputStream out) to perform the mappings.jar. Mapping Introduction.io. public void execute(java.Map param) to access to runtime constants possible (for example: INTERFACE. Joachim Orb 10 .sap.StreamTransformation The interface contains two methods: 1. java.

Java Mapping (III) .Template © SAP AG 2004. Joachim Orb 11 . Mapping Introduction.

Joachim Orb 12 .Overview Overview – Mapping Introduction Java Mapping XSLT Mapping ABAP Mapping © SAP AG 2004. Mapping Introduction.

Develop your XSLT files 2. Create a new Imported Archive and import the . Create a . Mapping Introduction. © SAP AG 2004.jar or a .XSLT Mapping (I) Proceeding equivalent as for Java mappings 1. Uploaded XSLT programs can modified within the XI Repository by means of a simple editor.zip 2. Joachim Orb 13 .2 Using a built-in IDE functionality 3.jar to the Integration Repository 4.1 Using the jar command of your jdk 2.

By means of this interface. XSLT implements XPath expressions to select substructures of an XML document. Since the size of messages depend of the application case. Joachim Orb Java mapping In order to develop a Java mapping. XSLT mapping Messages are in the form of XML documents. To process this stream. using an XSLT definition you can call external Java methods to convert XML structures. However. After your message transformation. you have to implement interface StreamTransformation (see above). Mapping Introduction. XSL Transformation (XSLT) is a member of the XML family of languages.g. First experiences with Java mappings showed that mappings using DOM are very memory extensive and weren’t suitable for very large messages (e.XSLT Mapping (II) . for example. Using templates in XSLT you can define the mapping rules for the selected substructures. Further supported features are: You can use the XSLT tags <xsl:include> and <xls:import> to include predefined templates for substructures in a complete mapping definition. use Java API for XML Processing (JAXP). This gives you great flexibility for mapping definitions with Java. Within your mapping program you can also access runtime constants like senderName or receiverName to implement a mapping that depends on message header content. Using XPath you can address any node in an XML document. you can pass it back to the integration server as a stream. See online documentation for details. you get access to the message as a stream that is received at runtime on the integration server. not all XSLT processors support external Java calls. you can reuse mappings for data types. You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family.. It describes how an XML structure is transformed into another XML structure. Moreover.Features XSL-Transformation: transforming XML structures XPath: Locating information in XML documents <xsl:include> and <xsl:import>: inclusion of other XSLT files <xsl:param> to access runtime constants Invoking external Java methods from within an XSL Transformation © SAP AG 2004. The JAXP supports the Document Object Model (DOM) and the Simple API for XML (SAX). This procedure gives you more flexibility when defining mappings. 14 . catalog data). it was decided to leave the decision of which technology to use (DOM/SAX) to the application and to just pass a stream. In this way.

Joachim Orb 15 .Example XSLT Mapping with Java Enhancement Calls the method merge: © SAP AG 2004. Mapping Introduction.XSLT Mapping (III) .

Overview Overview – Mapping Introduction Java Mapping XSLT Mapping ABAP Mapping © SAP AG 2004. Mapping Introduction. Joachim Orb 16 .

repository.additionaltypes = R3_ABAP|Abap-class.mapping.R3_XSLT|XSL (ABAP Engine) 2. Joachim Orb 17 .ABAP Mapping (I) Mapping programs can be implemented in ABAP 1.sap. Add additional mapping types in your Exchange Profile: com. Mapping Introduction. Develop your ABAP-OO class in the Object Navigator (se80) 3.aii. Create a new Interface Mapping • • Select Mapping Type Abap-class Enter the name of the ABAP-OO class © SAP AG 2004.

ABAP Mapping (II) . Mapping Introduction. Parameter SOURCE PARAM TRACE RESULT Exporting Direction Importing Reference XSTRING IF_MAPPING_PARAM IF_MAPPING_TRACE XSTRING You might use the iXML library in an ABAP Objects environment to parse your document © SAP AG 2004. Joachim Orb 18 .Development Define a ABAP class that implements the interface IF_MAPPING of package SAI_MAPPING The interface contains the method EXECUTE to perform the mappings.

* initialize iXML type-pools: ixml. streamfactory = ixmlfactory->create_stream_factory( ). Joachim Orb 19 . oStream = streamfactory->create_ostream_xstring( result ). © SAP AG 2004. * create input stream data: istream type ref to if_ixml_istream. * … endmethod. istream = streamfactory->create_istream_xstring( source ). * create stream factory data: streamfactory type ref to if_ixml_stream_factory. Mapping Introduction. l_sender_service = param->get( if_mapping_param=>sender_service ). * … * create output stream data: oStream type ref to if_ixml_ostream.ABAP Mapping (III) . * … * get XI parameter data: l_sender_service type string. class cl_ixml definition load.Template method if_mapping~execute.

0 © SAP AG 2004. Mapping Introduction.Summary Now you should be able to: get an overview about the different Mapping Programs. supported by XI 3. Joachim Orb 20 .

Sign up to vote on this title
UsefulNot useful