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

SAP_CONVERT_TO_XML_FORMAT

Former Member
0 Likes
756

Hi,

After converting a SAP file to XML with function SAP_CONVERT_TO_XML_FORMAT, I get the following error or message when trying to open the generetaed XML file:

The XML page cannot be displayed.

A name was started with an invalid character. Error processing resource 'file://sapdev/sapmnt/Daily/SAQ/Output/OUTBOUND2009...

<?xml version="1.0"?><OUTBOUND><%_T00004S00000000O0000002096/><%_T00004S00000000O0000002096><NAME...

Here is the code:



  concatenate sy-datum '_' sy-uzeit '.xml' into filename.
  concatenate '\\sapdev\sapmnt\Daily\SAQ\Output\OUTBOUND' filename into infile.

  filename = infile.

  data doc_name(30) value 'OUTBOUND'.

  clear: xml_table[], totalSize.

  CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
      I_FILENAME           = infile
      I_XML_DOC_NAME       = doc_name
    IMPORTING
      PE_BIN_FILESIZE      = totalSize
    TABLES
      I_TAB_SAP_DATA       = xml_file_list
    CHANGING
      I_TAB_CONVERTED_DATA = xml_table
    EXCEPTIONS
      CONVERSION_FAILED    = 1
      OTHERS               = 2.

  check not xml_table[] is initial.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME   = filename
      FILETYPE   = 'BIN'
    IMPORTING
      FILELENGTH = totalSize
    TABLES
      DATA_TAB   = xml_table
    EXCEPTIONS
      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.

Thanks in advance.

2 REPLIES 2
Read only

Former Member
0 Likes
449

Hi Issac,

i seen you are trying to download the file using using GUI_DOWNlOAD using the Application server path..

GUI_DOWNlOAD is used for presentation server...

Regards,

Prabhudas

Edited by: Prabhu Das on May 13, 2009 5:51 PM

Read only

0 Likes
449

Hi,

I have change the path to my presentation server and added the XML tag as follows:

"C:\Documents and Settings\APolo\My Documents\outbound.xml" , but still the same result.

How does it suppose to be formatted the internal table I_TAB_SAP_DATA ?

Thanks.