<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to create a nested XML in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746543#M35777</link>
    <description>&lt;P&gt;I changed the path to local drive C: and still no output. &lt;/P&gt;</description>
    <pubDate>Tue, 11 Dec 2018 06:37:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2018-12-11T06:37:26Z</dc:date>
    <item>
      <title>how to create a nested XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746541#M35775</link>
      <description>&lt;P&gt;Good Day, i tried using this sample code below but there were no XML file generated.&lt;/P&gt;
  &lt;P&gt;I hope you can help with this, if there is something missing in source code or we need to activate something in the Admin side for this to work. Thank you in Advance.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  YV_IXML_WRITE
*&amp;amp;---------------------------------------------------------------------*

REPORT  YV_IXML_WRITE.

PARAMETERS:

  " Appserver Windows file. Not from Desktop (presentation server)
  p_fname TYPE string DEFAULT 'I:\USR\SAP\PUT\FILE.XML'. 

  " Appserver UNIX file
  " p_fname TYPE string DEFAULT '/usr/SAP/PUT/FILE.XML'.  

DATA: lo_ixml TYPE REF TO if_ixml.

* Create iXML object
lo_ixml = cl_ixml=&amp;gt;create( ).
**********************************************************************
***  Build iXML DOM  *************************************************
**********************************************************************
* Sample XML contents.
*  &amp;lt;?xml version="1.0"?&amp;gt;
*  &amp;lt;Company&amp;gt;
*   &amp;lt;CompanyName&amp;gt;SAP&amp;lt;/CompanyName&amp;gt;
*   &amp;lt;Employee Type="FT"&amp;gt;
*    &amp;lt;EmployeeName&amp;gt;James&amp;lt;/EmployeeName&amp;gt;
*    &amp;lt;EmployeeNumber&amp;gt;007&amp;lt;/EmployeeNumber&amp;gt;
*   &amp;lt;/Employee&amp;gt;
*  &amp;lt;/Company&amp;gt;
DATA: lo_document TYPE REF TO if_ixml_document.
DATA: lo_company  TYPE REF TO if_ixml_element.
DATA: lo_employee TYPE REF TO if_ixml_element.

lo_document = lo_ixml-&amp;gt;create_document( ).

lo_company  = lo_document-&amp;gt;create_simple_element(
                                    name    = 'Company'
                                    parent  = lo_document ).

lo_document-&amp;gt;create_simple_element( name    = 'CompanyName'
                                    parent  = lo_company
                                    value   = 'SAP' ).

lo_employee = lo_document-&amp;gt;create_simple_element(
                                    name    = 'Employee'
                                    parent  = lo_company ).

lo_employee-&amp;gt;set_attribute(           name  = 'Type'
                                      value = 'FT' ).

lo_document-&amp;gt;create_simple_element( name    = 'EmployeeName'
                                    parent  = lo_employee
                                    value   = 'James' ).

lo_document-&amp;gt;create_simple_element( name    = 'EmployeeNumber'
                                    parent  = lo_employee
                                    value   = '007' ).
**********************************************************************
*** Create Output Stream and Render **********************************
**********************************************************************

DATA:
      lo_streamfactory  TYPE REF TO if_ixml_stream_factory,
      lo_ostream        TYPE REF TO if_ixml_ostream,
      lo_renderer       TYPE REF TO if_ixml_renderer,
      lv_rc             TYPE i,
      lv_xml_size       TYPE i.

* Create Stream Factory
lo_streamfactory = lo_ixml-&amp;gt;create_stream_factory( ).

* Crate Output Stream
lo_ostream  = lo_streamfactory-&amp;gt;create_ostream_uri( system_id = p_fname ).

* Craete renderer
lo_renderer = lo_ixml-&amp;gt;create_renderer( ostream  = lo_ostream
                                        document = lo_document ).
* Set Pretty Print
lo_ostream-&amp;gt;set_pretty_print( 'X' ).

* Render
lv_rc = lo_renderer-&amp;gt;render( ).

* Get XML file size
lv_xml_size = lo_ostream-&amp;gt;get_num_written_raw( ).

* Display Output
WRITE : 'XML File: ', p_fname, lv_xml_size,  'Bytes'.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 02:36:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746541#M35775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-12-10T02:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a nested XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746542#M35776</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I guess you used the wiki here &lt;A href="https://wiki.scn.sap.com/wiki/display/ABAP/iXML+-+Create+XML+file" target="test_blank"&gt;https://wiki.scn.sap.com/wiki/display/ABAP/iXML+-+Create+XML+file&lt;/A&gt; correct?&lt;BR /&gt;Did you check your filename? The example points to an "I:" drive, maybe you do not have it? &lt;BR /&gt;Did you check  in debug which passage got no result?&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 07:13:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746542#M35776</guid>
      <dc:creator>SimoneMilesi</dc:creator>
      <dc:date>2018-12-10T07:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a nested XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746543#M35777</link>
      <description>&lt;P&gt;I changed the path to local drive C: and still no output. &lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 06:37:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-nested-xml/m-p/746543#M35777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-12-11T06:37:26Z</dc:date>
    </item>
  </channel>
</rss>

