You can use GUI_UPLOAD function module or IMPORT_FROM_FILE method of CL_XML_DOCUMENT to upload XML document.
Below program use GUI_UPLOAD function module to upload XML document.
*&---------------------------------------------------------------------* *& Data Declaration *&---------------------------------------------------------------------* DATA: gcl_xml TYPE REF TO cl_xml_document. DATA: gv_filename TYPE string. DATA: gt_xml TYPE swxmlcont. DATA: gv_xml_string TYPE string. DATA: gv_size TYPE i. *&---------------------------------------------------------------------* *& start-of-selection *&---------------------------------------------------------------------* START-OF-SELECTION. CREATE OBJECT gcl_xml. gv_filename = 'c:\test.xml'. *Upload XML file CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = gv_filename filetype = 'BIN' has_field_separator = ' ' header_length = 0 IMPORTING filelength = gv_size TABLES data_tab = gt_xml EXCEPTIONS OTHERS = 1. *Convert uploaded data to string CALL FUNCTION 'SCMS_BINARY_TO_STRING' EXPORTING input_length = gv_size IMPORTING text_buffer = gv_xml_string TABLES binary_tab = gt_xml EXCEPTIONS 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. **Parses XML String to DOM CALL METHOD gcl_xml->parse_string EXPORTING stream = gv_xml_string. *Display XML CALL METHOD gcl_xml->display.
Below program use IMPORT_FROM_FILE method of CL_XML_DOCUMENT to upload XML document.
*&---------------------------------------------------------------------* *& Data Declaration *&---------------------------------------------------------------------* DATA: gcl_xml TYPE REF TO cl_xml_document. DATA: gv_subrc TYPE sy-subrc. *&---------------------------------------------------------------------* *& start-of-selection *&---------------------------------------------------------------------* START-OF-SELECTION. CREATE OBJECT gcl_xml. *Upload XML File CALL METHOD gcl_xml->import_from_file EXPORTING filename = 'c:\test.xml' RECEIVING retcode = gv_subrc. IF gv_subrc = 0. *Display XML CALL METHOD gcl_xml->display. ENDIF.