Skip to Content
author's profile photo Former Member
Former Member

error while opening XML file

hi all,

i was downloading data from the internal table into an XML file. i wrote the coding in the following way. Mr. Rich Heilman helped to solve this requirement to the maximum extent but iam stuck at the last moment. the coding is

tables:mara.

type-pools: truxs.

parameters: p_matnr like mara-matnr.

data: ixml type truxs_xml_table.

data: xxml like line of ixml.

data: size type i.

data: file_str type string.

file_str = 'C:\simp.xml'.

data: begin of itab_mara occurs 0,

matnr like mara-matnr,

ernam like mara-ernam,

aenam like mara-aenam,

vpsta like mara-vpsta,

end of itab_mara.

select matnr ernam aenam vpsta from mara into table itab_mara up to 5

rows where matnr = p_matnr.

CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'

  • EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER =

  • I_FILENAME =

  • I_APPL_KEEP = ' '

  • I_XML_DOC_NAME =

IMPORTING

PE_BIN_FILESIZE = size

TABLES

I_TAB_SAP_DATA = itab_mara

CHANGING

I_TAB_CONVERTED_DATA = ixml

  • EXCEPTIONS

  • CONVERSION_FAILED = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = size

FILENAME = file_str

FILETYPE = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ixml

EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

but when i tried to open the XML file it is showing the following error.

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

-


A name was started with an invalid character. Error processing resource 'file:///C:/simp.xml'. Line 1, Position 23

<?xml version="1.0"?><%_TYPE0000000019><%_TYPE0000000019><MATNR Datatype="C" Length="18">00000000008...

do anyone know how to rectify this error.

thanks,

anil.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Apr 22, 2007 at 11:49 AM

    check this thread for complete code sample

    https://forums.sdn.sap.com/click.jspa?searchID=2218535&messageID=975797

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.