Powered By

Free XML Skins for Blogger

Powered by Blogger

Thursday, July 10, 2008

Overview in SAP XI Designing Mappings

You can define mappings for an interface pair (source and target interface) by using message interfaces and message types in the Integration Repository.

You can also define the corresponding mappings when the source or target interface is an IDoc, an RFC, or another interface connected by an adapter.

This graphic is explained in the accompanying text

As illustrated in the graphic, in the standard case a request contains the data that is defined using the output message type of the outbound message interface. At runtime, a request passes from the outbound to the inbound interface. In the same way, the response contains the data that is defined using the output message type of the inbound message interface. It passes in the opposite direction to the request. If errors are thrown on the inbound side, these can be reported to the sender by using fault messages and then handled there. A fault message, like a response, passes from the inbound interface to the outbound interface. You can define mappings for request messages, response messages, and fault messages. Exchange Infrastructure supports the following mapping programs for this purpose:

Message mappings that you define using a graphical editor in the Integration Builder. This is used to create a Java source code for the runtime.

XSLT and Java mappings that you can import into the Integration Repository as an archive.

XSLT and ABAP mappings that customers can implement using the ABAP Workbench (see Mapping Development with the ABAP Workbench).

Essentially it is possible to create or import multiple mapping programs in the Integration Repository for the same output or input message type pair (or the corresponding part of an imported or external interface).

Comparing Mapping Program Types

SAP recommends that you use message mappings. However, in exceptional cases it may be advisable to use different mapping programs, for example, because you can apply XSLT or Java mapping programs from a previous integration project.

Note the following regarding the speed at which the mapping program types are executed:

Handwritten Java programs by experienced Java developers are usually quicker than generated Java source code from message mappings.

Message mappings can cope with significantly larger messages than XSLT. Whether an XSLT program or a message mapping is quicker depends on the complexity of the mapping. Tests have shown that even message mappings for larger messages are quicker than the equivalent XSLT mapping programs.

Experience has also shown that Java-based mapping programs are quicker than ABAP-based mapping programs.

Interface Mappings

When defining mapping programs for request, response, or fault messages, the definition is first separated from the interfaces that reference the corresponding message types. Furthermore, you can reuse a message type for multiple interfaces. This means that the simple definition of a mapping program is not sufficient to establish a connection (that is based on the assignment of outbound and inbound interfaces).

This role is undertaken by the interface mapping:

An interface mapping specifies the corresponding mapping programs for request, response, or fault messages for a selected interface pair. You use an interface mapping to register mappings for an interface pair.

You can also specify multiple mapping programs to be executed one after the other in the case of requests and responses for an interface mapping.

You can also define multiple interface mappings for the same interface pair, to provide multiple variants in the Integration Repository. At configuration time, the customer can select the appropriate mapping in an interface determination and save it in the Integration Directory.

Structure and Value Mapping

There are two types of mappings, regardless of the mapping technology that you use:

Structure mappings where the structure of an XML document is mapped to the structure of another XML document.

Value mappings where the values of an XML document are mapped to the values of another XML document.

Example

In the example below, data about a flight booking is exchanged using XML documents. The XML schema of the source document provides more hierarchy nodes than the XML schema of the target document. Furthermore, the target document schema does not use all the information that is provided by the source document schema. Both structures can be mapped to each other by using a structure mapping.

An example of when a value mapping is required is for the passenger class on a flight. In the source document, this information is coded by using a string, while in the target document, a decimal value is used. Another example of a value mapping would be the date format.

This graphic is explained in the accompanying text

Using the Integration Builder graphical mapping editor, you can define structure mappings easily using Drag & Drop. You can then use a function to assign fields to each other from source and target structures that require a value mapping.

No comments:

Archives