Skip to Content

Problem with XML2ABAP transformation

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.

p9inb.png (13.9 kB)
vo5ja.png (7.9 kB)
rkt2f.png (42.4 kB)
zalxx.png (32.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 25 at 10:33 AM

    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_trafos.htm

    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.htm

    Add comment
    10|10000 characters needed characters exceeded

    • 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>
  • Jan 29 at 06:09 AM

    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

    Add comment
    10|10000 characters needed characters exceeded