0% found this document useful (0 votes)
586 views1 page

Sap Convert To XML Format'

This document contains code to convert internal table data to XML format, export the XML data to a file, and download the file. It uses the SAP_CONVERT_TO_XML_FORMAT function to convert an internal table to XML and store it in a changing parameter. Then gui_download is called to export the XML data to a binary file, which is saved with a specified name. Finally a message is displayed confirming the internal table data was successfully downloaded.

Uploaded by

Alan Carino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
586 views1 page

Sap Convert To XML Format'

This document contains code to convert internal table data to XML format, export the XML data to a file, and download the file. It uses the SAP_CONVERT_TO_XML_FORMAT function to convert an internal table to XML and store it in a changing parameter. Then gui_download is called to export the XML data to a binary file, which is saved with a specified name. Finally a message is displayed confirming the internal table data was successfully downloaded.

Uploaded by

Alan Carino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

CALL 

FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
 EXPORTING
*   I_FIELD_SEPERATOR          = ','
*   I_LINE_HEADER              = 'Header'
   I_FILENAME                 = 'C:\test\test1.xml'
*   I_APPL_KEEP                = ' '
*   I_XML_DOC_NAME             = 'doc_name.xml'
* IMPORTING
*   PE_BIN_FILESIZE            =
  TABLES
    I_TAB_SAP_DATA             = zxml_tabl[]
 CHANGING
   I_TAB_CONVERTED_DATA       = ztran
 EXCEPTIONS
   CONVERSION_FAILED          = 1
   OTHERS                     = 2
          .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
endloop.

CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
 bin_filesize = l_xml_size
 filename = file_create
 filetype = 'BIN'
CHANGING
 data_tab = ztran
EXCEPTIONS
 OTHERS = 24.

IF sy-subrc <> 0.
   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

write : 'INTERNAL TABLE DATA IS SUCCESSFULLY DOWNLOADED TO LOCATION', file_cre
ate .

You might also like