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 itab

Former Member
0 Likes
441

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

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

2 REPLIES 2
Read only

Former Member
0 Likes
400

Hi,

this link below has the same issue which is resolved.You can follow this

Hope it works.

Please do reward if helpful.

Regards

rose

Read only

Former Member
0 Likes
400

code:

TYPES: BEGIN OF T_ATTACHMENT,

LINE_NO(5),

FILENAME(200),

DESCRIPTION TYPE STRING,

END OF T_ATTACHMENT,

D_ATTACHMENT TYPE T_ATTACHMENT OCCURS 0.

TYPES: BEGIN OF T_ATTACHMENTLIST,

ATTACHMENT TYPE D_ATTACHMENT,

END OF T_ATTACHMENTLIST,

D_ATTACHMENTLIST TYPE T_ATTACHMENTLIST OCCURS 0.

TYPES: BEGIN OF T_HEADER,

NAME(140),

PHONE(23),

EMAIL(100),

ATTACHMENTLIST TYPE D_ATTACHMENTLIST,

END OF T_HEADER,

D_HEADER TYPE T_HEADER OCCURS 0.

TYPES: BEGIN OF T_ITEM,

HEADER TYPE D_HEADER,

END OF T_ITEM.

TYPES:D_ITEM TYPE T_ITEM OCCURS 0.

TYPES: BEGIN OF T_LIST,

ITEM TYPE D_ITEM,

END OF T_LIST,

D_LIST TYPE T_LIST OCCURS 0.

TYPES: BEGIN OF TYPE_DATA,

LIST TYPE D_LIST,

END OF TYPE_DATA.

DATA: ITEMLIST TYPE STANDARD TABLE OF T_LIST INITIAL SIZE 0.

DATA: XMLOUT TYPE STRING.

DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.

PERFORM UPLOAD_XML.

&----


*& Form UPLOAD_XML

&----


-


  • text

-


  • --> p1 text

  • <-- p2 text

-


FORM UPLOAD_XML .

REFRESH ITAB.

clear ITEMLIST.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\test11.XML'

filetype = 'BIN'

TABLES

data_tab = ITAB.

LOOP AT ITAB.

CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.

ENDLOOP.

CALL TRANSFORMATION ('ZTEST11X2A')

SOURCE XML XMLOUT

RESULT ITEMLIST = ITEMLIST.

BREAK-POINT.

ENDFORM.[/code]

Regards

Venkat