You are on page 1of 9

Conversions in Graphical Mapping (XI)

By Yugandhar Kotha, PI Competency Core Team, YASH Technologies

This document focuses on achieving Conversions in Graphical Mapping.

In general most of the development scenarios work with simple mapping of the source elements of the
outbound message to the target elements of the inbound message or otherwise manipulation of the
source data and map it to the target XML structure. However, at times we come across some cases which
require conversions while mapping the source and target structures for example there might be a set of
pre-defined values that come from the source for a particular source element and for each source value
there will be pre-defined mapping rule to pick the target value.

For these types of conversions, XI has provided the following concepts:

Fix Values at design time


Value Mapping at configuration time

Where we could have some pre-defined mapping rules stored in a mapping context and XI during runtime
will pick the specific mapping rule for the value in the source structure and get the target value.

Scenario Demonstrating the usage of Conversions in


Graphical Mapping
The scenario here involves the conversion of a customer format xml file containing the
information of the employees in one specific format to another format. The source file is available on the
FTP and the Sender file adapter picks it. This file is deleted and archived on a different directory on the
FTP. The source xml file is converted into target XML file by the Message mapping and this target file is
placed on the FTP again on a different directory.

Here is the source XML structure:


Here is the target XML structure:

Fix Values at design Time


Find FixValues as the standard function delivered by XI in category Conversions. Use this to map the
source element to target value and maintain the table with entries by clicking the function to consider key
values as source and value as target.

Here, Fixed values mapping of GENDER element with GENDER element of target

XI during runtime will pick the specific mapping value in the target value based on the source value
obtained in the payload.

That is when the source value in the payload comes as M for Gender element; it picks Male, where as if
it is F it picks Female to form the target message.
Value Mapping at Configuration Time
An object can have different representations, depending on the context in which it is used.

For example, consider that Mr.Arun has different roles in two different companies (Company A and
Company B) to which we need to send his personnel data.

Vendor Mr. Arun has a particular vendor number in a company A and has a particular employee number
in a company B, ie., his roles are different as business changes. Hence it should be required to trap the
values when we send the information of Mr.Arun to different business units.

We use Value Mapping to send different representations of an object to different business units by
defining Mapping rules.

The mapping rules defined for a specific sender and receiver are stored in the Value mapping table that
can be maintained during the configuration time. The value mapping can be used in both the java
mapping and the message mapping.

In this document we will work with Graphical mapping alone.

From the above, we understand that an object can have its own representation based on the sender and
receiver service. So different representations of the object need to be available in the SAP XI and SAP XI
during the runtime has to pick up the exact mapping based on the business services participating in the
communication. For this, in SAP Exchange Infrastructure, an Issuing Agency and an Identification
Scheme define the representation of an object. And the representation of an object is not complete until
the Issuing Agency, Identification Scheme and Value are known.

The value mapping rules are maintained in the value mapping tables in two ways:

Manual Input using the user interface of the Integration Directory


Replication from external data sources using a specialist interface.

In this document we will work with the Manual Input one.

Issuing agency
Issuing agency is one of the trios needed to identify an object uniquely. It can represent one of the
following:

1. To identify unique rules of converting the data from source to target, use either Business Service or
Business System

2. You can use Organization or Company as other identifier to produce and manage an identification
scheme

Identification scheme
Identification schemes are produced and managed by issuing agencies. An identification scheme,
agency, and value form a key to be recognized as identifier.
Displaying/Editing the Value Mapping Table
The display/edit of the contents of value mapping tables is done in the Integration Directory.

For more details


referhttp://help.sap.com/saphelp_nw04/helpdata/en/13/ba20dd7beb14438bc7b04b5b6ca300/frames
et.htm

Here we use fixed value mapping between the GENDER element of the source to the GENDER
element of the target, value mapping with senderservice as issuing agency for the mapping of
GRADE element to TRAVEL element of the target and value mapping with some arbitrary string
as issuing agency for mapping of GRADE element to DESIGNATION element of the target.

Here in this document I have presented only the documents related to one scenario i.e. sender
service A to receiver service B. we could maintain similar mapping rules w.r.t the service C as
receiver and use them in the mapping while service A communicates with service C.

In this scenario I take the sender business service as YASH_FTP and the receiver business
service as YASH_FTP

Value mapping of GRADE element with the TRAVEL element of the target using SenderService as
issuing agency:

Value
mapping of GRADE element with the DESIGNATION element of the target using some arbitrary
string(SenderEmp) as the issuing agency :
Receiver determination and Objects created in the Integration Directory as a part of the value
mapping:

o Receiver Determination
o Go to Integration directory Tools->value mapping to maintain the value mapping records for the
GRADE->TRAVEL elements. We will find the below pop up

As we have given the issuing agency as senderservice we need to maintain the mapping records with the
name of the service participating in the communication.
Maintain the mapping records as below:

o Now maintain the records for the GRADE->DESIGNATION elements. We have to maintain the records
with the issuing agency and identification scheme as the same string values provided during the message
mapping, as below:

Maintain the mapping records as below:


TESTING OF VALUE MAPPING

Source Input XML File:


<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_Employee xmlns:ns0="http://yash.com/YH203/value_mapping">
- <EMPLOYEE>
<ID>YH205</ID>
<FIRSTNAME>Saibaba</FIRSTNAME>
<MIDDLENAME />
<LASTNAME>Kondani</LASTNAME>
<GENDER>M</GENDER>
<GRADE>E2</GRADE>
<JOINDATE>20071007</JOINDATE>
</EMPLOYEE>
</ns0:MT_Employee>
Target output XML File generated:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_Employee_details xmlns:ns0="http://yash.com/YH203/value_mapping">
- <EMPLOYEE>
<ID>YH205</ID>
<FULLNAME>Saibaba Kondani</FULLNAME>
<GENDER>Male</GENDER>
<DESIGNATION>Consultant</DESIGNATION>
<TRAVEL>Train (First AC)</TRAVEL>
<JOINDATE>20071007</JOINDATE>
</EMPLOYEE>
</ns0:MT_Employee_details>

You might also like