Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML to Internal Table Error

Former Member
0 Likes
829

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.

1 ACCEPTED SOLUTION
Read only

VijayCR
Active Contributor
0 Likes
748

CHeck whether all the opened nodes are closed?

4 REPLIES 4
Read only

Former Member
0 Likes
748

In the XML file change the encoding to UTF-16 and it will upload.

Read only

VijayCR
Active Contributor
0 Likes
749

CHeck whether all the opened nodes are closed?

Read only

Former Member
0 Likes
748

Hello,

It has been solved thanks for your reply........

Read only

VijayCR
Active Contributor
0 Likes
748

This message was moderated.