cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Multimapping Tags

Former Member
0 Kudos

Hi,

We had java mapping for an interface(BPM) on the server. Which will always create tags of multimapping like <Message> etc

Now we are replacing the BPM and making it plain xml-idoc scenario. But such multimapping output tags are not supported for idoc adapter.

We dont want to change the existing Java mapping as it contains complex logic.

Can any one help wit some idea to remove the multimapping tags coming up from the Java mapping output..

Some xsl code may be?

TIA

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Kiran,

Try this XSL:

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

    <xsl:template match="node()|@*">

        <xsl:copy>

            <xsl:apply-templates select="node()|@*"/>

        </xsl:copy>

    </xsl:template>

    <xsl:template match="message|message/*">

        <xsl:apply-templates select="node()"/>

    </xsl:template>

</xsl:stylesheet>

With this source XML:

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

<message>

    <message1>

        <tag1>e</tag1>

    </message1>

    <message2>

        <tag2>sss</tag2>

    </message2>

</message>

You could obtain this output:

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

<tag1>e</tag1>

<tag2>sss</tag2>

Regards.

udo_martens
Active Contributor
0 Kudos

The result has two root nodes -> not well formed

Former Member
0 Kudos

Hi,

Tried it but no change.

I modified it a bit though

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

    <xsl:template match="node()|@*">

        <xsl:copy>

            <xsl:apply-templates select="node()|@*"/>

        </xsl:copy>

    </xsl:template>

    <xsl:template match="sxi:Messages|sxi:Message1/*">

        <xsl:apply-templates select="node()"/>

    </xsl:template>

</xsl:stylesheet>

For information

Input will be like

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

<sxi:Messages xmlns:sxi="http://sap.com/xi/XI/SplitAndMerge">

<sxi:Message1>

<ZDetails>

.

..

.

.

</ZDetails>

</sxi:Message1>

</sxi:Messages>

I want it to be

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

<ZDetails>

.

..

.

.

</ZDetails>

udo_martens
Active Contributor
0 Kudos

Hi,

as mentioned before a simple

<xsl:copy-of select="//ZDetails">

would do the job

( <xsl:template match="*"> )

Regards,

Udo

Answers (3)

Answers (3)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Kiran,

             Rather than adding a new mapping altogether, I would suggest to modify exiting java mapping. I would like to take a look in the present java mapping code to check if that can be modified. If you want to give it a try, I need the present java mapping code and an input xml for testing the results. Check if this works. In case it does notwork  you always have xslt code written here to be used after java mapping. Please also mention the version of PI you atre working in as this affects the java mapping code.

Regards

Anupam

former_member190624
Active Contributor
0 Kudos

Hi Kiran,

Check this thread  http://scn.sap.com/thread/3243372 . It may help you.

Regards

Hari.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

These tags are removed at runtime. The tags are only there during design time.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Nope. Actually the problem i am facing now is. Java mapping produces a message with output

<Message>

<Message1>

   <Z********>

etc

But at call adapter i am getting an error. Tag Message1 found instead of IDoc Begin.

So i want to remove those tags.. And want my payload to start from

<Z*********>

<Idoc>

<begin>

etc

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Kiran,

If you don't want to change the Java Mapping Logic, then  you have no choice but to use another Java/XSLT mapping to remove those tags.

Regards,

Mark

udo_martens
Active Contributor
0 Kudos

Hi,

the removal is done by Java adapters during runtime, not by ABAP adapter like idoc. Therefore the error.

Add an addtional mapping program to to operation mapping, so you avoid changing the java code. For example a xsl using expressions like <xsl:copy-of select="//IDOC"> (pseudo code)

Regards,

Udo

Former Member
0 Kudos

Thanx guys. Do we have any such xslt code on SDN. i am searching but wit zero luck so far . So opened a new discussion