Copyright 2024 - BV TallVision IT

A simple example where an XML file is read from a file and it's contents is made available in the Abap report. 

An example XML file (that can be found here

<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Arnold</to>
  <from>Jani</from>  
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>

With the following abap logic, the XML file can be interpreted / made available in Abap variables:

REPORT ZWIMTEST.
include ZABAPCADABRA_EASY_XML.
data: lv_xml_example type string,
      lo_easy_xml type ref to lcl_easy_xml,
      lv_bodytext type string. 

start-of-selection.
* A small test XML document in Note.xml, a memo to someone
create object lo_easy_xml.
lo_easy_xml->upload( 'M:\SAP\note.xml' ).
lo_easy_xml->findfirst( 'note' ).
if lo_easy_xml->gv_result_found = abap_false.
  message 'There is no note node in this XML...' type 'S'.
  exit.
else. 
  lv_bodytext = lo_easy_xml->findfirst( 'heading' ).
endif.