Skip to Content

Simple Transformation CX_ST_MATCH_ELEMENT

Dec 23, 2016 at 06:16 PM


avatar image
Former Member


I am using simple transformation to convert XML to ABAP. The XML is getting read correctly just the last line of the XML throws the exception CX_ST_MATCH_ELEMENT for a certain element.

It is always the last record which gives this issue. If i add more records below the last one the one which had the issue does not cause any problems the new last record will cause the record to dump. All the other lines load the element correctly when i debug thru the XML.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Dec 23, 2016 at 06:20 PM

" The error message is below

The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT' was not caught and therefore caused a runtime error. The reason for the exception is: XML comparison error Expected element-end: "BEGABRPE" [ ] Read invalid: " " [ ].

-- The XML

<?sap.transform simple?>" xmlns:ddic="" xmlns:def="">
<tt:root name="BILL_REQUEST" type="ddic:ZTTBILL_XML_IN"/>
<tt:loop ref=".BILL_REQUEST">
<MASS_GUID tt:value-ref="MASS_GUID"/>
<ITEM_GUID tt:value-ref="ITEM_GUID"/>
<ENDABRPE tt:value-ref="ENDABRPE"/>
<BEGABRPE tt:value-ref="BEGABRPE"/>
<ACTION tt:value-ref="ACTION"/>
<STATUS tt:value-ref="STATUS"/>
<tt:loop ref="ATTRIBUTES">
<NAME tt:value-ref="NAME"/>
<VALUE tt:value-ref="VALUE"/>
<START_DATE tt:value-ref="START_DATE"/>
<END_DATE tt:value-ref="END_DATE"/>


Show 3 Share
10 |10000 characters needed characters left characters exceeded

It should work with the following XML input (that should insert one initial line into the target internal table). Could you check it? If it works, then check what is different with your own XML input.

<?xml version="1.0"?>

Former Member
Sandra Rossi

Hi Sandra,

Thanks for your response. Attributes is deep structure within my original XML. Its a table structure. I never faced this issue when i had a simple structure. This issue started happening once i added the deep structure. I am still facing the issue in the last line. The field <BEGABRPE> is where it error's out ... any idea













If you had tried with the XML I have provided, you would have noticed it works, and that's because I have added a required root node, because in your ST you're looping over ZBILL_XML_IN, which means it cannot be a root (there can't be several root nodes).

The following code works (note that I have also removed SHADOW_RATE because it's not in your ST)

TYPES : BEGIN OF ty_ls_zbill_request_at,
                name        TYPE string,
                value       TYPE string,
                start_date  TYPE string,
                end_date    TYPE string,
  END OF ty_ls_zbill_request_at,
BEGIN OF ty_ls_zbill_xml_in,
          mass_guid     TYPE string,
          item_guid     TYPE string,
          endabrpe      TYPE string,
          begabrpe      TYPE string,
          source_system TYPE string,
          request_type  TYPE string,
          action        TYPE string,
          status        TYPE string,
          attributes TYPE STANDARD TABLE OF ty_ls_zbill_request_at WITH DEFAULT KEY,
        END OF ty_ls_zbill_xml_in.
DATA: lt_zbill_xml_in TYPE TABLE OF ty_ls_zbill_xml_in,
      xml TYPE string.
'<?xml version="1.0"?>'
'<BILL_REQUEST>' " <=========== ADD a root because, as you are looping over
                 " ZBILL_XML_IN consequently this latter cannot be the root
*'<SHADOW_RATE/>' " <=========== REMOVE
'</BILL_REQUEST>' " <=========== ADD
INTO xml.
    CALL TRANSFORMATION zzsro_test13
    SOURCE XML xml
    RESULT bill_request = lt_zbill_xml_in.
    DATA lx_root TYPE REF TO cx_root.
  CATCH cx_root INTO lx_root.