cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping between XML

emmanuel_turci
Advisor
Advisor
0 Kudos

Hi all,

I would like to use a tool to make a mapping between two XML files

(this tool has to be accessible from SAP Basis system R/3 - ABAP)

The structure of the first one could change (Client structure)

The second xml file is the target one, his structure is known

The idea is to map element by element or attributes by attributes and

if needed to indicate which conversion's function to use

very simple example :

xml source:

<CLIENT:doc>

<CLIENT:title>TITRE</CLIENT:title>

<CLIENT:description>DESCRIPTION</CLIENT:description>

<CLIENT:price>12.5</CLIENT:price>

</CLIENT:doc>

and with this wonderfull mapping tool the result could be depending on rules set :

<INTER:mydoc>

<INTER:my_title>TITRE<INTER:my_title>

<INTER:desc>DESCRIPTION<INTER:desc>

<INTER:full_price>12 , 50 ?</INTER:full_price>

</INTER:mydoc>

do you know kind of similar tool ?

thanks for your answer

best regards,

Emmanuel.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Emmanuel,

This sounds like a job for XSLT.

The xml source: (I added additional info to make it valid.)

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

<CLIENT:doc xmlns:CLIENT="http://mydomain.com/test/client">

<CLIENT:title>TITRE</CLIENT:title>

<CLIENT:description>DESCRIPTION</CLIENT:description>

<CLIENT:price>12.5</CLIENT:price>

</CLIENT:doc>

The XSL program/template:

<?xml version="1.0" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:CLIENT="http://mydomain.com/test/client">

<xsl:template match="CLIENT:*">

<INTER:mydoc xmlns:INTER="http://mydomain.com/test/inter">

<INTER:my_title>

<xsl:value-of select="//CLIENT:title"/>

</INTER:my_title>

<INTER:desc>

<xsl:value-of select="//CLIENT:description"/>

</INTER:desc>

<INTER:full_price>

<xsl:value-of select="//CLIENT:price"/>

</INTER:full_price>

</INTER:mydoc>

</xsl:template>

</xsl:stylesheet>

The result XML:

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

<INTER:mydoc xmlns:INTER="http://mydomain.com/test/inter">

<INTER:my_title>TITRE</INTER:my_title>

<INTER:desc>DESCRIPTION</INTER:desc>

<INTER:full_price>12.5</INTER:full_price>

</INTER:mydoc>

Please note that this is only an example of 1 way to do it in XSL.

Please reference XSLT manuals for additional features.

Ciao,

Bill

emmanuel_turci
Advisor
Advisor
0 Kudos

Hello Bill,

ok, thanks for your example

in fact it is one of possible solution

But this solution is not easy for a client to change or to add an element

Also, as I wrote from my first post, I need some conversion (12.5 -> 12,50 ?)

or I need to call some function modules to add for example some runtime data or new data

I would like in fact to find a SAP tool to do this mapping user friendly.

I know already XSLT program but I search another solution to do a mapping

between 2 xml using a kind of UI or anything else

Regards,

Emmanuel

Former Member
0 Kudos

Hi Emmanuel,

A GUI mapping tool is available in XI. Before you can use it, data types and message types must be defined. All of these are done in the Integration Repository.

Regards,

Bill