Start of Content Area

Function documentation Duplicating Subtrees  Locate the document in its SAP Library structure

Use

Even if elements are shown to occur more than once in the XML instance according to XML Schema definition, they are only displayed once in the structure overview. To assign source fields to multiple positions of an element in the target structure, you can either copy individual elements or the entire subtree using the context menu in the target structure.

Example

The records of a CD catalog are to be mapped to a simple HTML table. There are six subelements of <cd> in the source structure that are to be shown in one table line. The target field <td> is only shown once in the structure view, however.

Source Structure (left) and Target Structure (right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

Catalog

1

1

CatalogTable

1

1

  cd

0

unbounded

  table

1

1

    title

1

1

    tr

0

unbounded

    artist

1

1

      td

0

unbounded

    country

1

1

 

 

 

    company

1

1

 

 

 

    price

1

1

 

 

 

    year

1

1

 

 

 

Before you can define the target field mapping to the <td> elements, you must first duplicate the <td> element five times using the context menu. Each target field mapping then comprises simply a 1:1 assignment of the source and target fields:

Message Mapping with Duplicated Elements

Target Field Mapping

/CatalogTable=/Catalog

No mapping for/CatalogTable/table

/CatalogTable/table/tr=/Catalog/cd

/CatalogTable/table/tr/td=/Catalog/cd/title

/CatalogTable/table/tr/td[1]=/Catalog/cd/artist

/CatalogTable/table/tr/td[2]=/Catalog/cd/country

/CatalogTable/table/tr/td[3]=/Catalog/cd/company

/CatalogTable/table/tr/td[4]=/Catalog/cd/price

/CatalogTable/table/tr/td[5]=/Catalog/cd/year

Example

Source Instance

Result

<?xml version="1.0"   encoding="UTF-8"?>

<Catalog>

 

 <cd>

   <title> Empire Burlesque </title>
   <artist> Bob Dylan </artist>
   <country> USA </country>
   <company> Columbia </company>
   <price> 10.90 </price>
   <year> 1985 </year>

 </cd>

 <cd>

   <title> Hide your heart</title>
   <artist> Bonnie Tyler</artist>
   <country> UK</country>
   <company> CBS Records</company>
   <price>9.90</price>
   <year> 1988 </year>

 </cd>

 

</Catalog>

<?xml version="1.0"
  encoding="UTF-8"?>

<ns0:CatalogTable xmlns:ns0="workshopDemo">

  <table>

    <tr>

        <td> Empire Burlesque </td>
        <td> Bob Dylan </td>
        <td> USA </td>
        <td> Columbia </td>
        <td> 10.90 </td>
        <td> 1985 </td>

    </tr>

    <tr>

        <td> Hide your heart </td>
        <td> Bonnie Tyler </td>
        <td> UK </td>
        <td> CBS Records </td>
        <td> 9.90 </td>
        <td> 1988 </td>

    </tr>

</table>

</ns0:CatalogTable>

 

 

 

 

 

 

End of Content Area