Code: Alles auswählen.
REPORT zread_xml.
TYPE-POOLS truxs.
data fil type string value 'C:\temp\testxml.xml'.
*data fil type string value 'C:\temp\TEST_Table_XML.xml'.
data mif_ixml TYPE REF TO if_ixml.
data my_document TYPE REF TO if_ixml_document.
data xdat TYPE truxs_xml_table.
data i type i.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
FILENAME = fil
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = i
CHANGING
data_tab = xdat
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
others = 19.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
mif_ixml = cl_ixml=>create( ).
CHECK NOT mif_ixml IS INITIAL.
my_document = mif_ixml->create_document( ).
CALL FUNCTION 'SDIXML_XML_TO_DOM'
EXPORTING
xml = xdat
SIZE = i
* IS_NORMALIZING = 'X'
IMPORTING
DOCUMENT = my_document
EXCEPTIONS
INVALID_INPUT = 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 'SDIXML_DOM_TO_SCREEN'
EXPORTING
document = my_document
* TITLE =
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.