Skip to Content
0
Former Member
Sep 06, 2005 at 08:10 AM

Converting XML into ABAP

262 Views

Hi guys!

I have a problem. I want to have data from a simple XML-File into an ABAP-itab.

This is the XML file:

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

<F>

<P1>

<t_1>value1</t_1>

<t_2>testvalue</t_2>

</P1>

<P2>

</P2>

</F>

I made a XSLT-Program, but it must have an error:

http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl=" http://www.sap.com/sapxsl" version="1.0">

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

<xsl:template match="F">

http://www.sap.com/abapxml" version="1.0">

<asx:values>

<DOCUMENT>

<xsl:apply-templates/>

</DOCUMENT>

</asx:values>

</asx:abap>

</xsl:template>

<xsl:template match="P1">

<t_1><xsl:value-of select="t_1"/></t_1>

<t_2><xsl:value-of select="t_2"/></t_2>

</xsl:template>

</xsl:transform>

My ABAP-Report looks like this:

DATA: BEGIN OF wa_upload,

text(255) TYPE c,

END OF wa_upload,

itab_upload LIKE TABLE OF wa_upload,

BEGIN OF wa_document,

t_1 TYPE string,

t_2 TYPE string,

END OF wa_document,

itab_document LIKE TABLE OF wa_document.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\test.xml'

filetype = 'ASC'

TABLES

data_tab = itab_upload.

CALL TRANSFORMATION zrappel_xml_test

SOURCE XML itab_upload

RESULT document = itab_document.

Executing this report i alway get a CX_XSLT_RUNTIME_ERROR with Exception ' '. (Yes, exception is blank 😉)

Can anyone see the failure?

Greetings

Roland