Show TOC

Procedure documentationCreating a Mapping Template Locate this document in the navigation structure

 

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.

Procedure

1. Create a Mapping Template
  1. In the Enterprise Repository Browser, select a software component version to create your mapping template.

  2. From the context menu of the software component version, choose   New   Mapping Template   .

    Note Note

    You can also create a mapping template from the context menu of Namespace, Folder, or Mapping Template.

    End of the note.
  3. Enter a name and description for the mapping template.

  4. Choose Browse to select a Namespace.

  5. Choose Finish.

  6. Select an existing change list or choose New to create a new change list.

2. Define Signatures
  1. In the Signature section, choose Browse to select the required software component version to add source data type from another software component version.

    Note Note

    You can also select data type from the same software component version, where you have created the template.

    End of the note.
  2. In the Source Messages section, choose Select..., to add source data type.

  3. In the Select Type window, select the required source data type.

    Note Note

    The element selected must refer to a non-built-in XSD data type.

    End of the note.
  4. Choose OK.

  5. In the Target Type section, add a target data types by repeating steps 1 to 3.

3. (Optional) Add Parameters
  1. In the Parameters section, choose Add..

  2. Enter the required parameter details in the new row.

    Note 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.

    End of the note.
4. Define Mapping
  1. 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 Note

    You can drag multiple source fields and drop into a target field, as a concatenation.

    End of the note.
  2. To assign an expression to a target field, proceed as follows:

    1. Double-click the required target field.

    2. In the expression editor, enter the expression you want to assign to the target field.

    Note 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.

    Example Example

    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.

    Example Example

    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.

    Example Example

    const(1.234).

    End of the example.

    OR

    Enter the required text within double quotes.

    Example Example

    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.

    Example 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.

    Example Example

    const(param(“name of predefined parameter>)).

    End of the example.

    Note Note

    Alternatively, to view and select the available parameters of same type, use CTRL and space within double quotes.

    End of the note.
    End of the note.
  3. Choose OK.

    Note 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.

    End of the note.
  4. 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 (Show suitable templates) .

    Note 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.

    End of the note.
5. (Optional) Add Imported Archives and Function Library
  1. If you want to add an imported archive, select the folder Imported Archives on the dependencies tab page.

  2. Choose Add and select the imported archive that you want to add.

  3. Select folder Function Library to add function library.

  4. Choose Add and select function library that you want to add.

6. (Optional) Assign Documentation
  1. If you want to add internal documentation, in the Documentation section, choose Edit Documentation link.

    Note 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.

    End of the note.
  2. In the Internal Documentation window, choose the Edit Documentation tab page.

  3. Enter the content.

  4. Choose OK.

    Note Note

    If an internal documentation exists, you can view it in Web browser, by selecting View Documentation.

    End of the note.