Use the below steps to display XML document in ABAP.
- Create a XML string
- Parse XML string to DOM
- Display XML
Below program displays the XML document in SAP.
*&---------------------------------------------------------------------* *& Data Declaration *&---------------------------------------------------------------------* DATA: gcl_xml TYPE REF TO cl_xml_document. DATA: gv_xml TYPE string. *&---------------------------------------------------------------------* *& start-of-selection *&---------------------------------------------------------------------* START-OF-SELECTION. *Create XML string CONCATENATE '' gv_xml INTO gv_xml. CREATE OBJECT gcl_xml. *Parses XML String to DOM CALL METHOD gcl_xml->parse_string EXPORTING stream = gv_xml. *Display XML CALL METHOD gcl_xml->display. Value
Output
vi