‎2012 May 16 10:12 PM
Hello,
I am trying to upload XML file using call transformation. I am getting following exception 'CX_ST_MATCH_ELEMENT'. Find the template and code that I used. Please give me some inputs for my problem
XML input
<?xml version="1.0" encoding="UTF-8"?>
-<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml"> -<asx:values> -<NEWCHECK> -<item> <IDNUMBER>03123</IDNUMBER> <NAME>SFSDFSD</NAME> <LOCATION>FSDFSD</LOCATION> <AMOUNT>00121</AMOUNT> </item> -<item> <IDNUMBER>11111</IDNUMBER> <NAME>TEST</NAME> <LOCATION>TEST</LOCATION> <AMOUNT>00012</AMOUNT> </item> -<item> <IDNUMBER>43423</IDNUMBER> <NAME>DSDFSD</NAME> <LOCATION>FSDFDSF</LOCATION> <AMOUNT>00011</AMOUNT> </item> </NEWCHECK> </asx:values> </asx:abap>
XSLT Template
<?sap.transform simple?>
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">
<tt:root name="ROOT" type="?"/>
<tt:root name="NEWCHECK" type="ddic:ZNEW"/>
<tt:template>
<NEWCHECK>
<tt:loop ref=".NEWCHECK">
<ZSTRUCT>
<IDNUMBER tt:value-ref="IDNUMBER"/>
<NAME tt:value-ref="NAME"/>
<LOCATION tt:value-ref="LOCATION"/>
<AMOUNT tt:value-ref="AMOUNT"/>
</ZSTRUCT>
</tt:loop>
</NEWCHECK>
</tt:template>
</tt:transform>
Code I used
types: BEGIN OF ZSTRUCT,
IDNUMBER TYPE ZTABLE-IDNUMBER,
NAME TYPE ZTABLE-NAME,
LOCATION TYPE ZTABLE-LOCATION,
AMOUNT TYPE ZTABLE-AMOUNT,
END OF ZSTRUCT.
data: XML type string.
data: lt_msg type ty_msg.
DATA : lt_data TYPE STANDARD TABLE OF ZSTRUCT,
wa_data type ZSTRUCT,
wa_msg LIKE LINE OF lt_msg.
TRY.
CALL TRANSFORMATION ZZTABLE1
SOURCE XML XML
RESULT NEWCHECK = lt_data.
CATCH cx_st_error.
ENDTRY.
Please help me.
‎2012 May 26 6:18 AM
‎2012 May 17 8:43 AM
In the XML file change the encoding to UTF-16 and it will upload.
‎2012 May 26 6:18 AM
‎2012 May 28 8:39 PM
‎2012 May 29 9:43 AM