Skip to Content

There are times when you have to send an XML message 

inside a XML tag of the other message.
There are at least two approaches when doing such a scenario:

– you can change the XML message’s tags into something else
and later on chage it back

– you can also include the XML message inside a CDATA tag

But while doing such transformations you cannot use “Graphical mapping”… is that right?

Not always. We can still use Graphical mapping
but we have to combine it with any other kind of mapping.

XI gives us the possibility to use many mappings with one transformation –

Interface mapping

The thing to remember is that only once you can do

Source message


Target message


The rest of those transformations are

Target message


Target message



…but this is just great in our case as we want to do the whole mapping inside the first graphical mapping
and then just transform the result a little.

So how can we do it?

– use graphical mapping to trasform our source message
to our target message
(target message contains all tags – in my example it looks exactly the same as the source message)

– then we want to put the WHOLE “name” node inside the “name” tag within CDATA

The first part is easy but how can we do the second one?

We can use Udo ‘s example with Re: Changing XML message into a string.


Do we have to do the transformation inside the interface mapping if we want to use it always

with this particular communication channel?
No we can include our XSLT mapping inside the Communication Channel.
To do this we have to use MessageTransformBean. I’m using a File/FTP channel in my example.


With the help of SAP standard Bean (MessageTransformBean)
we only need to give path to the XSLT mapping
and we don’t have to add it to our Interface mappings. Obviously we have to remember to use the same structure
(some sort of an envelope) of your Target messages so that it will always contain the same root tags so the XSLT mapping
will always work. But it depends on you XSLT mapping too.


We can now remove XSLT mapping from the Interface mapping
and the result looks just like we wanted:


Basically I wanted to show three things:

– the use of several mappings inside an Interface mapping

– how you can change an XML message into a string

– how you can use XSLT mappings inside a communication channel

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member
      The blog is very good and easy to learn.

    Regarding, use several mappings inside an Interface, will there be any impact on the performance when compared to a single mapping doing the same function inside an interface mapping.

    S.Santhosh Kumar

  2. Michal,<br/><br/>thanks very much for your help!<br/>I’ve managed to correctly serialize a xml into a string with the tips in this blog. However, I’ve not managed to perform the string -> xml (unserialize) step (I’m using Udo’s sugestion).<br/><br/>The problem is that XI generates a namespace prefix in runtime (it can be ns0, ns1, ns2…, depending on the context), and so I need to reference this namespace into the unserializing XSLT. With XMLSpy, I’ve managed to correctly transform it using the XPath “//:my_tag” to the string tag, but this approach didn’t work in XI.<br/><br/>If I try to use just “//my_tag” the transformation concludes successfully, but XI says that the generated XML is not well-formed (probably because it doesn’t fits the Schema of the target message, but I’m just guessing here). If I try to use “//:my_tag”, it doesn’t even performs the transformation, and gives a “Problem When Testing” error, which says “Transformer configuration exception occurred when loading XSLT …”.Thanks again!

  3. Former Member

    Thanks again. I really needed this today. Almost opened a new post, but did a search on the forum and blogs. THERE YOU ARE.


  4. Former Member
    Hello Michel,
    i created my XSLT mapping following this blog…
    but the wS is receiving empty payload..
    i can see the payload in SXMB_MONI and RWB adapter monitoring.. I am not able to find what is wrong with this XSLT mapping.. if i change it to graphical mapping everything is working fine..
    can you please tell me whate to check and what could be the problem…
  5. Former Member

    Has anybody tried to get this to work when the single target XML element is an INPUT field to an RFC Function Module??<br/><br/>It seems this doesn’t work.<br/><br/>An error similar to this is thrown in XI by JCO:<br/><br/>–

    <br/> error while processing message to remote could not convert request from XML to$Exception: (130) JCO_ERROR_XML_PARSER: Expecting a tag to begin with ‘<‘ instead of ‘7’, in “<Identity>750204216<“<br/><br/>—

    <br/><br/>The above “Identity” element is the first element with data in my XML example and it always dies on the first one. The XML is well formed, JCo just doesn’t like it.<br/><br/>Note that the CDATA tags are also transmitted into the single element. Although they are not visible when testing using the Interface Mapping Test Tool, when using SXI_MONITOR you can see they are in there. This is what seems to make JCo fail. If you take out the CDATA tags and manually hard-code the XML with single CDATA tages wrapped around it in the XSLT it works fine, but then you lose the ability to insert dynamic XML because CDATA turns “copy-of” into a literal string rather than a command.<br/><br/>If anyone has got this to work when calling an RFC please let me know.<br/><br/>Otherwise I think we will use Java Mapping for this.<br/>


Leave a Reply