cancel
Showing results for 
Search instead for 
Did you mean: 

Help Required for XSLT mapping

Former Member
0 Kudos

Hi Folks,

I am working on a scenario, where we had 17 different one to one mapping with same source strcture but different target structures. Source is a Idoc common for everyone.

Sample Target Structure :

Message Type(XYZ)

RECORDS(0,u)

A(0,1)

B(0,1)

C(0,1)

D(0,1)

As per our requirement we need the output in which we need to have "GLOBE " at the top and the value of A, B, C and D on single row for each ouurance of RECORD. For 2nd occurance we need to change the line and 2 nd set of ABCD on 2nd row and so on. e.g.

GLOBE

0002044452KNA1 0000027079 0001E

0002044452KNA1 0000027080 0001E

0002044452KNA1 0000027080 0001E

To acheive the above output we are using a XSLT map after Message Mapping

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

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

<xsl:output method="text" indent="no" encoding="UTF-8" omit-xml-declaration="yes"/>

<xsl:preserve-space elements="*"/>

<xsl:template match="/">GLOBE<xsl:text>&#xD;&#xA;</xsl:text>

<xsl:for-each select="//RECORDS">

<xsl:for-each select="*">

<xsl:value-of select="current()"/>

</xsl:for-each><xsl:text>&#xD;&#xA;</xsl:text></xsl:for-each>

</xsl:template>

</xsl:stylesheet>

NOW WE HAVE changed the 17 one to one maps to one multi mapping (1:17) as our source is same.

Now as the output of this multi mapping is getting into XSL code, it is not able to parse it.

How can we do the changes in this particular code So that we can Achieve: 17 different file out of single multi mapping and XSL map like it was comming previously from 17 different maps.

Thanks

Pradeep

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Pradeep,

Depending on how you setup your multi mapping, when you execute you will end up with something like this as the xml output:


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
  <ns0:Message1>
    <XYZ></XYZ>
    <XYZ></XYZ>
  </ns0:Message1>
</ns0:Messages>

Or this:


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
  <ns0:Message1>
    <XYZ></XYZ>
  </ns0:Message1>
  <ns0:Message2>
    <XYZ></XYZ>
  </ns0:Message2>
</ns0:Messages>

The single xml message with the u201CMessagesu201D wrapper is not split into separate messages until it hits one of the adapters in the adapter engine. Perhaps you can try to adjust the xslt to expect this as input, but the output would still need to be <ns0:Messages>. That might be what is causing the failure with your current xslt. Can the flat file conversion in the file adapter?

Thanks,

-Russ