Skip to Content
avatar image
-1
Former Member

Dump while coverting XML UTF32 to SAP

Hi Experts,

I am facing a problem while converting the UTF32 file in sap.

I have developed a program to create the Purchase order with the data coming from XML file,For testing Purpose I have generated the testing XML file from system and while using the system generated XML file my program works fine.

But when the XML coming from user it is showing the Dump

"Matching error when executing a Simple Transformation." screen shot attached.Though the structure of both the files are same (1.System generated 2.User file).

Please suggest your solution.

Thanks in Advance.

j7i6g.png (11.3 kB)
2fg71.png (27.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 22, 2017 at 06:03 AM

    First of all, catch the exception, see the detailed message provided in the exception object, then revert back if you don't find the solution. You should also attach the XML file here, how could we analyze otherwise?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 22, 2017 at 02:46 PM

    Hi,

    Files : indentcreate-1.txtcfaindentgenerated.txt

    open these file by changing the extensions as XML.

    IndentCreate.xml works fine but the other one is not working

    and we are not able to find the difference between those.

    please let me know if any info needed

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks.

      Yes, please, provide what I requested : the detailed message from the exception object CX_ST_MATCH_ELEMENT (use TRY CATCH). Display it using debug if you don't know how to get the text.

      By the way, your file is UTF-16 (little endian by the way, with a leading BOM), not UTF-32 ! Anyway, I don't see the reason why it fails with CX_ST_MATCH_ELEMENT. I see that your dates DD/MM/YYYY do not conform classic XML date format (YYYY-MM-DD), so maybe SAP just don't convert them and it attempts copying them including the slashes and there's a data loss exception (but it should be CX_ST_CONVERSION_DATA_LOSS (unless you set the ignore loss option), not CX_ST_MATCH_ELEMENT)

      I just saw this SAP note: 1450949 - Simple Transformation exception CX_ST_MATCH_ELEMENT, and you should check whether there are other notes.


  • avatar image
    Former Member
    Feb 22, 2017 at 04:20 PM

    hi,

    in case you do not find a solution with the simple tranformation, you may convert your input xml stream to an iXML document and convert it using FM SDIXML_DOM_TO_DATA. This one is able to handle deep structures and table types.

    You first need the gr_document (ref to IF_IXML_DOCUMENT), look at google for a how-to.

    gs_xml_data is the complete (SAP DDIC) data structure, but I prefer to use string data type during this step to handle number conversion issues.

    DATA:  lr_xmldocelem  TYPE REF TO if_ixml_element,
           ls_ctl       TYPE dcxmldescl.
    
      ls_ctl-warn_treat = 'E'.
      ls_ctl-err_treat = space.
    
      lr_xmldocelem = gr_document->get_root_element( ).
    
    * parse provided XML document into our structure
    * structure used should contain only Strings, mapping happens later!
      CALL FUNCTION 'SDIXML_DOM_TO_DATA'
        EXPORTING
          data_as_dom    = lr_xmldocelem
          control        = ls_ctl-dcxmldescl
        IMPORTING
          dataobject     = gs_xml_data
    *       Problems       =
        EXCEPTIONS
          illegal_object = 1
          OTHERS         = 2.
    * .....
    Add comment
    10|10000 characters needed characters exceeded