cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with XML2ABAP transformation

gjl_arendsen
Explorer
0 Kudos

Hello.

I'm trying to use a XSLT transformation in order to map XML data to ABAP. I've follwed the BIT14E course but unfortunately this didn't help me with my problem.

My problem is that the data is provided to the transformation but it doesn't give the ABAP formatted data back. This is my solution:

Service provider:

Call the transformation:

Content of IV_DATA:

Transformation:

The result from the call transformation is empty.

What am I doing wrong?

Thanx for ypur input. Grtz John.

matt
Active Contributor

Have you tried debugging the transformation? It might give you some clues.

Accepted Solutions (0)

Answers (2)

Answers (2)

horst_keller
Product and Topic Expert
Product and Topic Expert

With XSL your transformation must transform the input XML to asXML. You have to know this format in order deserialize any XML into ABAP data.

As an alternative you might use ST. There you don't have to know asXML but of course the syntax of ST.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_xml_trafo...

As a trick, you might serialize the expected ABAP outcome with the predefined transformation ID to asXML in order to see what your XSLT should produce.

Last but not least, you can also parse the XML yourself with the iXML or sXML libraries.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_xml_libs....

Sandra_Rossi
Active Contributor
0 Kudos

For instance, asXML means that the XSLT must render something like this, so that the values can fill the variables (and we don't see that in your XSLT - did your try the demo programs like SXSLTDEMO_FLIGHTS):

<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> 
  <asx:values> 
    ...
  </asx:values> 
  <asx:heap> 
    ... 
  </asx:heap> 
</asx:abap>
gjl_arendsen
Explorer
0 Kudos

Hello All.

My proble was the exact syntax of the transformation. I wanted to create a flexible transformation related to the input fields.I have followed the BIT14E course but this did not help me at all.

I've solved the problem my self at last by naming al the elements seperatly. Thanks for your effort.

My solution is:

<xsl:template match="/" priority="2">
<abap version="1.0">
<values>
<xsl:apply-templates select="*"/>
</values>
</abap>
</xsl:template>

<xsl:template match="CLAIM" priority="2">
<xsl:element name="V_CLAIM">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>

........

Grtz John