Creating a Mapping Template 
You use this procedure to create a mapping template in order to reuse the mapping logic defined in the template in other message mappings, or in other mapping templates where you need to map similar elements.
Mapping template defines a mapping between Data Types, type definitions for external definition, RFC, and IDoc.
Once you have created a mapping template, you can apply the template directly to the elements of a message mapping or mapping template. The mapping template automatically maps the elements and this helps to save time in implementing the mapping.
In the Enterprise Repository Browser, select a software component version to create your mapping template.
From the context menu of the software component version, choose .
Note
You can also create a mapping template from the context menu of Namespace, Folder, or Mapping Template.
Enter a name and description for the mapping template.
Choose Browse to select a Namespace.
Choose Finish.
Select an existing change list or choose New to create a new change list.
In the Signature section, choose Browse to select the required software component version to add source data type from another software component version.
Note
You can also select data type from the same software component version, where you have created the template.
In the Source Messages section, choose Select..., to add source data type.
In the Select Type window, select the required source data type.
Note
The element selected must refer to a non-built-in XSD data type.
Choose OK.
In the Target Type section, add a target data types by repeating steps 1 to 3.
In the Parameters section, choose Add..
Enter the required parameter details in the new row.
Note
You can use the information below as a reference for adding values to the following columns:
Category column:
Category |
Use |
|---|---|
Simple Type |
Transfer a scalable value. |
Adapter |
Select an adapter type for programming a mapping lookup. |
Select Type column
If you have selected Adapter, then adapter metadata can be of type SOAP, JDBC, or RFC.
If you have selected Simple, then type can be a string or integer (depending on the value you want to give).
Parameter column:
Parameter Type |
Use |
|---|---|
Import |
Transfer values to mapping program before it is executed. If you want, you can specify constants beforehand in the operation mapping binding. |
Export |
Transfer values of the mapping program after it has been executed. |
In the Definition tab page, to map a source field to a target field, drag a source field and drop it onto the target field.
Note
You can drag multiple source fields and drop into a target field, as a concatenation.
To assign an expression to a target field, proceed as follows:
Double-click the required target field.
In the expression editor, enter the expression you want to assign to the target field.
Note
An expression can be a string literal, a function with arguments, or an XPath expression.
If you do not find the required function in the function tree, you can create new or use the existing user defined functions.
You can also define the XPath by dragging a source node from the expression tree and dropping it onto the expression editor.
Use the table below as a reference for basic understanding of adding expressions:
Example |
Steps |
|---|---|
Use a source field as an argument. |
Drag the source field from the Context tree to the expression editor.
add(<source field Xpath 1>, <source field Xpath 2 >) In the above example, you can drag the source field Xpaths 1 and 2 from the Context tree into this expression and use them as arguments for the function add. End of the example. |
Enter a function as an argument. |
Drag the source field from the Functions tree to the expression editor.
add(abs(<source field Xpath 1>, <source field Xpath 2 >)) End of the example. |
Provide a string literal as a parameter. |
Enter the required text, as described in the example.
const(1.234). End of the example. OR Enter the required text within double quotes.
const("freeText”) or "freeText”. End of the example. |
Provide an integer or float value as a parameter. |
Enter the required value as described in the example.
const(1.234). End of the example. |
Assign a parameter (defined on the Overview page). |
Drag the param (string name) function located under Functions Adapter and enter the name of the predefined parameter as described in the example.
const(param(“name of predefined parameter>)). End of the example.
Alternatively, to view and select the available parameters of same type, use CTRL and space within double quotes. End of the note. |
Choose OK.
Note
Mapping is not complete if you have not connected any element or attribute of target node to the corresponding element or attribute of a source node.
If you want to add an existing mapping template to this current template, select the source and target node and then select the icon
(Show suitable templates)
.
Note
Selecting this icon displays a list of templates that you can use to map the selected source and target nodes.
Similarly, you can apply a mapping template in message mapping by selecting the source and target node and then selecting the icon for Show suitable templates.
In case you have added a function library, imported archive or JDBC lookup, which are not the part of the software component version of the mapping template or an underlying software component version then a Copy Object wizard appears with the list of objects that need to be copied in the current software component version.
While defining a mapping you can also add local functions.
If you want to add an imported archive, select the folder Imported Archives on the dependencies tab page.
Choose Add and select the imported archive that you want to add.
Select folder Function Library to add function library.
Choose Add and select function library that you want to add.
If you want to add internal documentation, in the Documentation section, choose Edit Documentation link.
Note
This field is not available if you have selected the Use External Documentation check box while defining the software component version.
In case, you have selected the Use External Documentation check box, you can view the external document by selecting View. This option is useful if documentation about the object exists in SAP Solution Composer.
In the Internal Documentation window, choose the Edit Documentation tab page.
Enter the content.
Choose OK.
Note
If an internal documentation exists, you can view it in Web browser, by selecting View Documentation.