<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple Transformation - deserialization - Match Element Error in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625123#M26149</link>
    <description>&lt;P&gt;Sorry Tariq for late reply. I didnt see notification.&lt;/P&gt;
  &lt;P&gt;You said &amp;lt;Weighing&amp;gt; and &amp;lt;Total&amp;gt; are in same level but let look at your simple transformation, after loop to get Substance you didnt close &amp;lt;Weighing&amp;gt; but get data for Total node, in that way Total become child of Weighing right?. Then you need to fix the transformation.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jul 2018 01:37:37 GMT</pubDate>
    <dc:creator>DoanManhQuynh</dc:creator>
    <dc:date>2018-07-03T01:37:37Z</dc:date>
    <item>
      <title>Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625118#M26144</link>
      <description>&lt;P&gt;I have to parse the following XML into an internal table, I get the short dump, after running the program. Please see the program and simple transformation in the following. An exception occurred in simple transformation that is explained in detail below.&lt;/P&gt;
  &lt;P&gt; The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught and therefore caused a runtime error. &lt;/P&gt;
  &lt;P&gt;The reason for the exception is: &lt;/P&gt;
  &lt;P&gt;XML matching error Expected was element-end: "Total" [ ] Read was element-start: "Weighing" &lt;/P&gt;
  &lt;P&gt;Please someone of you help me to correct my program, I am stuck at the moment. &lt;/P&gt;
  &lt;P&gt;Many thanks in advance&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT ZPP_TT_EXAMPLETEST_ST.
DATA itab1 TYPE string.
CONCATENATE '&amp;lt;Automatic&amp;gt;'
'        &amp;lt;Weighing Tolerance="5" Deviation="1.60" &amp;gt;'
'          &amp;lt;Substance ExtId="3"   Speed="1" /&amp;gt;'
'          &amp;lt;Substance ExtId="22"  Speed="5" /&amp;gt;'
'        &amp;lt;/Weighing&amp;gt;'
'        &amp;lt;Weighing Tolerance="5" Deviation="-16" &amp;gt;'
'          &amp;lt;Substance ExtId="22" Speed="5" /&amp;gt;'
'        &amp;lt;/Weighing&amp;gt;'
'        &amp;lt;Weighing  Tolerance="5" &amp;gt;'
'          &amp;lt;Substance ExtId="22" Speed="5" /&amp;gt;'
'        &amp;lt;/Weighing&amp;gt;'
'       &amp;lt;Total State="0" Result="Ok" /&amp;gt;'
'      &amp;lt;/Automatic&amp;gt;'
INTO itab1.

* Substance *
TYPES: BEGIN OF ty_data,
         ExtId  TYPE CHAR20,
         Speed TYPE CHAR20,
       END OF ty_data.
DATA: wa_ty_data TYPE ty_data.
DATA: lt_data TYPE TABLE OF ty_data.

* Total *
TYPES: BEGIN OF ty_data3,
         State  TYPE CHAR20,
         Result TYPE CHAR20,
       END OF ty_data3.
DATA: wa_ty_data3 TYPE ty_data3.
DATA: lt_data3 TYPE TABLE OF ty_data3.

* Weighing *
TYPES: BEGIN OF ty_data2,
         Tolerance  TYPE CHAR20,
         Deviation  TYPE CHAR20,
         t_data     TYPE TABLE OF ty_data WITH DEFAULT KEY,
         t_data3    TYPE TABLE OF ty_data3 WITH DEFAULT KEY,
       END OF ty_data2.
DATA: wa_ty_data2 TYPE ty_data2.
DATA: lt_data2 TYPE TABLE OF ty_data2.

CALL TRANSFORMATION zpp_tt_exampletest_st
      SOURCE XML itab1
      RESULT xml_tab = lt_data2.


&amp;lt;?sap.transform simple?&amp;gt;
&amp;lt;tt:transform xmlns:tt="http://www.sap.com/transformation-templates"&amp;gt;
  &amp;lt;tt:root name="XML_TAB"/&amp;gt;
  &amp;lt;tt:template&amp;gt;
    &amp;lt;Automatic&amp;gt;
      &amp;lt;tt:loop name="b" ref=".XML_TAB"&amp;gt;
        &amp;lt;Weighing&amp;gt;
          &amp;lt;tt:cond check="not-initial($b.TOLERANCE)"&amp;gt;
            &amp;lt;tt:attribute name="Tolerance" value-ref="$b.TOLERANCE"/&amp;gt;
          &amp;lt;/tt:cond&amp;gt;
          &amp;lt;tt:cond check="not-initial($b.DEVIATION)"&amp;gt;
            &amp;lt;tt:attribute name="Deviation" value-ref="$b.DEVIATION"/&amp;gt;
          &amp;lt;/tt:cond&amp;gt;
          &amp;lt;tt:loop name="a" ref="$b.T_DATA"&amp;gt;
            &amp;lt;Substance&amp;gt;
              &amp;lt;tt:cond check="not-initial($a.EXTID)"&amp;gt;
                &amp;lt;tt:attribute name="ExtId" value-ref="$a.EXTID"/&amp;gt;
              &amp;lt;/tt:cond&amp;gt;
              &amp;lt;tt:cond check="not-initial($a.SPEED)"&amp;gt;
                &amp;lt;tt:attribute name="Speed" value-ref="$a.SPEED"/&amp;gt;
              &amp;lt;/tt:cond&amp;gt;
            &amp;lt;/Substance&amp;gt;
          &amp;lt;/tt:loop&amp;gt;
          &amp;lt;Total&amp;gt;
            &amp;lt;tt:cond check="not-initial($b.STATE)"&amp;gt;
              &amp;lt;tt:attribute name="State" value-ref="$b.STATE"/&amp;gt;
            &amp;lt;/tt:cond&amp;gt;
            &amp;lt;tt:cond check="not-initial($b.RESULT)"&amp;gt;
              &amp;lt;tt:attribute name="Result" value-ref="$b.RESULT"/&amp;gt;
            &amp;lt;/tt:cond&amp;gt;
          &amp;lt;/Total&amp;gt;
        &amp;lt;/Weighing&amp;gt;
      &amp;lt;/tt:loop&amp;gt;
    &amp;lt;/Automatic&amp;gt;
  &amp;lt;/tt:template&amp;gt;
&amp;lt;/tt:transform&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Jun 2018 22:42:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625118#M26144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-06-18T22:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625119#M26145</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Did you try &amp;lt;Total&amp;gt; &amp;lt;/Total&amp;gt; instead of &amp;lt;Total /&amp;gt; ?&lt;/P&gt;
  &lt;P&gt;If there is any tag not defined in your template, its also raised 'CX_ST_MATCH_ELEMENT'. you can read this link:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://help.sap.com/saphelp_nw70/helpdata/en/a5/c2ef412f695f24e10000000a1550b0/content.htm?no_cache=true"&gt;https://help.sap.com/saphelp_nw70/helpdata/en/a5/c2ef412f695f24e10000000a1550b0/content.htm?no_cache=true&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 08:29:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625119#M26145</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2018-06-20T08:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625120#M26146</link>
      <description>&lt;P&gt;Hi Quynh,&lt;/P&gt;
  &lt;P&gt;Thanks for your response. &lt;/P&gt;
  &lt;P&gt;As you have suggested, I have tried &amp;lt;Total&amp;gt; &amp;lt;/Total&amp;gt; instead of &amp;lt;Total /&amp;gt; in my input XML stream, it didn't work.&lt;/P&gt;
  &lt;P&gt;If you meant to try &amp;lt;Total&amp;gt; &amp;lt;/Total&amp;gt; instead of &amp;lt;Total /&amp;gt; in simple transformation, I don't know how to do it?? Please can you elaborate it or help me with another suggestion.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Looking forward to your reply.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 08:16:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625120#M26146</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-06-21T08:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625121#M26147</link>
      <description>&lt;P&gt;Hi Tariq.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Sorry I take a look in your xml in itab1 and transformation again and find out the error reason is not about tag reconization but the order of the xml template and transformation template.&lt;/P&gt;
  &lt;P&gt;As your transformation, node Total is a child of Weighing but in your xml template Total is separate with Weighing. If your xml and transformation didnt match, it would rise the exception.&lt;/P&gt;
  &lt;P&gt;I change the code like this and it pass through that exception (but I dont have data in lt_data2 so it raise another exception, that you can check by yourself):&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;ABAP:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;XML_T = VALUE #( ( '&amp;lt;Automatic&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Weighing Tolerance="5" Deviation="1.60" &amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Substance ExtId="3" Speed="1" /&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Substance ExtId="22" Speed="5" /&amp;gt;' )&lt;BR /&gt;
 ( '&amp;lt;Total State="0" Result="Ok" /&amp;gt;' )&lt;BR /&gt;
 ( '&amp;lt;/Weighing&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Weighing Tolerance="5" Deviation="-16" &amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Substance ExtId="22" Speed="5" /&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;/Weighing&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Weighing Tolerance="5" &amp;gt;' )&lt;BR /&gt; ( '&amp;lt;Substance ExtId="22" Speed="5" /&amp;gt;' )&lt;BR /&gt; ( '&amp;lt;/Weighing&amp;gt;' )&lt;BR /&gt;
* ( '&amp;lt;Total State="0" Result="Ok" /&amp;gt;' )&lt;BR /&gt;
 ( '&amp;lt;/Automatic&amp;gt;' ) ).&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 03:58:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625121#M26147</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2018-06-25T03:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625122#M26148</link>
      <description>&lt;P&gt;Hi Quynh,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Thanks for your efforts. But your answer doesn't work in my problem.&lt;/P&gt;
  &lt;P&gt;My XML Template is correct, in which &amp;lt;Weighing&amp;gt; and &amp;lt;Total&amp;gt;, both are children nodes of &amp;lt;Automatic&amp;gt;, and are on same level. &amp;lt;Weighing&amp;gt; contains one child node &amp;lt;Substance&amp;gt; and &amp;lt;Total&amp;gt; is not child node of &amp;lt;Weighing&amp;gt;.&lt;/P&gt;
  &lt;P&gt;I know, I have a problem in my Simple Transformation, but not in my XML Template. Please point out my mistake in Simple transformation. I have to parse the above mentioned XML by writing a error free Simple Transformation program, not the other way around (you have changed and adjusted my XML template in order to work my simple transformation). &lt;/P&gt;
  &lt;P&gt;I have tried in many different ways to solve this problem since last one week, but nothing work so far. &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Looking forward to your reply.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 07:34:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625122#M26148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-06-26T07:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation - deserialization - Match Element Error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625123#M26149</link>
      <description>&lt;P&gt;Sorry Tariq for late reply. I didnt see notification.&lt;/P&gt;
  &lt;P&gt;You said &amp;lt;Weighing&amp;gt; and &amp;lt;Total&amp;gt; are in same level but let look at your simple transformation, after loop to get Substance you didnt close &amp;lt;Weighing&amp;gt; but get data for Total node, in that way Total become child of Weighing right?. Then you need to fix the transformation.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 01:37:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-deserialization-match-element-error/m-p/625123#M26149</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2018-07-03T01:37:37Z</dc:date>
    </item>
  </channel>
</rss>

