cancel
Showing results for 
Search instead for 
Did you mean: 

xml to itab

Former Member
0 Kudos

Hi ,

i'm trying extract data from PDF file. (Adobe Offline scenario).

I'm getting this XML runtime error.

could anybody can help me to solve this problem.

This is my code ,

CALL TRANSFORMATION id

SOURCE XML lv_xml_data_string

RESULT zscustomer12 = wa_zcustomer12.

Here is the error

The reason for the exception is:

Either the source document contains invalid XML or it is handled

incorrectly in the ABAP program that called the transformation.

How to correct the error

The most common cause of this error is a conflict between the encoding

specified in the declaration <?xml version="1.0" encoding="..."?> in the

document and the actual encoding of the data.

If the document is held in an ABAP string, the actual encoding is the

system code page. If this does not match the declaration, a parsing

error may occur.

These conflicts are a particular issue when XML documents are produced

in one system and then imported into a system with a different code page

(as strings).

For this reason, XML documents should be held as binary data (X strings)

, if they are extracted from the system or accessed from outside.

If the error occures in a non-modified SAP program, you may be able to

find an interim solution in an SAP Note.

If you have access to SAP Notes, carry out a search with the following

keywords:

"XSLT_BAD_SOURCE_CONTEXT" "CX_XSLT_RUNTIME_ERROR"

"ZFORM_12_RECEIVEPDF" or "ZFORM_12_RECEIVEPDF"

"START-OF-SELECTION"

please help me out.

Regards,

Keerthi

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It comes from the header of the xml file .

Try to add this code before calling the transformation


CLASS cl_abap_char_utilities DEFINITION LOAD.
REPLACE ALL OCCURENCES OF cl_abap_char_utilities=>newline IN
                lv_xml_data_string WITH ' '.

* Make the XML envelope compliant with identity transform
REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
        IN lv_xml_data_string
        WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
REPLACE '</data>'
IN lv_xml_data_string
WITH '</asx:values></asx:abap>'.

Hope this help you

Regards

Former Member
0 Kudos

Hi,

I'm encounter the same error as you have. I've replace the XML codes with the suggestion in the thread, but still error exits.

Did you ever solve the problem? if so, are you able to share the code?

Thanks