<?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 ABAP Data to XML file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913846#M57676</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read this weblog &lt;/P&gt;&lt;P&gt;/people/patrick.baer/blog/2005/02/24/abap-serialization--part-i-quick-n-easy and tried to serialize ABAP data into XML format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, I have copied the exact code from this weblog, but somehow this file is not visible in my pc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA example_data TYPE spfli.

select single * from spfli into example_data.

DATA xml_utils TYPE REF TO if_ixml.
xml_utils = cl_ixml=&amp;gt;create( ).

DATA xml_stream_factory TYPE REF TO if_ixml_stream_factory.
xml_stream_factory = xml_utils-&amp;gt;create_stream_factory( ).

DATA xml_output_stream TYPE REF TO if_ixml_ostream.
xml_output_stream = xml_stream_factory-&amp;gt;create_ostream_uri( system_id =
'file://c:test.xml' ).

try.

CALL TRANSFORMATION id
SOURCE data_node = example_data
RESULT XML xml_output_stream.

catch cx_sy_conversion_base64 CX_SY_CONV_ILLEGAL_DATE_TIME.
write 'there is an exception'.

endtry.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This part of the code, I have also changed to :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
xml_stream_factory-&amp;gt;create_ostream_uri( system_id =
'file://test.xml' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and still the file is not visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume three reasons:&lt;/P&gt;&lt;P&gt;a) Looking in the wrong place&lt;/P&gt;&lt;P&gt;b) Some configuration, I am not doing properly&lt;/P&gt;&lt;P&gt;c) Something else has to be done, to write a file to system&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this regard, is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next issue being, how robust is the approach of serializing ABAP data into XML format, so that a third party system can pick up this data and do a comparison ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some parameters that I am looking for in this regards are:&lt;/P&gt;&lt;P&gt;a) Error Validation (can XML data be incorrectly written into a file/while transmitting this data some errors can creep in. If so, how do I rectify it. As far as I know, this data can only be written to Presentation Server or using FTP ,transported to required destination. Is there any other approach ? )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) Security&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be great if you could drop some hints for the above procedure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Mar 2005 07:34:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-03-02T07:34:14Z</dc:date>
    <item>
      <title>ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913846#M57676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read this weblog &lt;/P&gt;&lt;P&gt;/people/patrick.baer/blog/2005/02/24/abap-serialization--part-i-quick-n-easy and tried to serialize ABAP data into XML format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, I have copied the exact code from this weblog, but somehow this file is not visible in my pc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA example_data TYPE spfli.

select single * from spfli into example_data.

DATA xml_utils TYPE REF TO if_ixml.
xml_utils = cl_ixml=&amp;gt;create( ).

DATA xml_stream_factory TYPE REF TO if_ixml_stream_factory.
xml_stream_factory = xml_utils-&amp;gt;create_stream_factory( ).

DATA xml_output_stream TYPE REF TO if_ixml_ostream.
xml_output_stream = xml_stream_factory-&amp;gt;create_ostream_uri( system_id =
'file://c:test.xml' ).

try.

CALL TRANSFORMATION id
SOURCE data_node = example_data
RESULT XML xml_output_stream.

catch cx_sy_conversion_base64 CX_SY_CONV_ILLEGAL_DATE_TIME.
write 'there is an exception'.

endtry.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This part of the code, I have also changed to :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
xml_stream_factory-&amp;gt;create_ostream_uri( system_id =
'file://test.xml' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and still the file is not visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume three reasons:&lt;/P&gt;&lt;P&gt;a) Looking in the wrong place&lt;/P&gt;&lt;P&gt;b) Some configuration, I am not doing properly&lt;/P&gt;&lt;P&gt;c) Something else has to be done, to write a file to system&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this regard, is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next issue being, how robust is the approach of serializing ABAP data into XML format, so that a third party system can pick up this data and do a comparison ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some parameters that I am looking for in this regards are:&lt;/P&gt;&lt;P&gt;a) Error Validation (can XML data be incorrectly written into a file/while transmitting this data some errors can creep in. If so, how do I rectify it. As far as I know, this data can only be written to Presentation Server or using FTP ,transported to required destination. Is there any other approach ? )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) Security&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be great if you could drop some hints for the above procedure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 07:34:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913846#M57676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T07:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913847#M57677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Part of the answer is in this weblog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/thomas.jung3/blog/2004/06/24/bsp-150-a-developer146s-journal-part-v-xml-for-rfcs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 08:52:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913847#M57677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T08:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913848#M57678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Subramanian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure you would have done this, but just in case, have you taken a look at the online documenatation for the &amp;lt;i&amp;gt;call transformation&amp;lt;/i&amp;gt; statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meanwhile, I shall try to get you some sample code that &amp;lt;i&amp;gt;works&amp;lt;/i&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. : Howz France, BTW ? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 09:00:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913848#M57678</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T09:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913849#M57679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Subramanian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must say that I'm not very happy with the answer I'm giving, because I think it is not as precise as I would have wanted it to be ), but here's something I would like to take your attention to - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The Demo Program SXSLTDEMO_FLIGHTS.&lt;/P&gt;&lt;P&gt;2. The following code snippet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : example   TYPE spfli,
       xmlstring TYPE string.

  select single *
    from spfli
    into example.

  try.
    CALL TRANSFORMATION id
      SOURCE data_node = example
      RESULT XML xmlstring.
*      catch cx_sy_conversion_base64 CX_SY_CONV_ILLEGAL_DATE_TIME.
*      write 'there is an exception'.
  endtry.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The string variable &amp;lt;b&amp;gt;xmlstring&amp;lt;/b&amp;gt; contains the data in XML format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 10:01:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913849#M57679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T10:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913850#M57680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Poornanand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. Yes I have more/less figured out how serializing to XML format works. The weblog given by Thomas Jung has been pretty useful and in fact he has also given a mention of the development class/package to be used for this . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably tomorrow, I might have a chance to figure out, why the serializing process is not happening.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only question remaining is the second part :&lt;/P&gt;&lt;P&gt;a) How to store ABAP data serialized to XML files into a different system, altogether ?&lt;/P&gt;&lt;P&gt;b) How robust will this approach be and how secure will it be ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. - France must be good, I got no idea, why you ask.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 13:46:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913850#M57680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T13:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913851#M57681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are perhaps overestimating the capabilities of the osteam object.  If you want to write the XML to a file the easiest thing to do is render it an ostream_itable (internal ABAP table).  Then you can download it your PC with the GUI_DOWNLOAD function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
parameter: ifile type file_table-filename obligatory
           default 'c:issue.xml'.
****Temp File name for function module call.
data: ifilename type string.

  move ifile to ifilename.

  create object issue
     exporting
       id     = id
       create_mode = abap_false.

  data: g_ixml type ref to if_ixml,
         g_stream_factory type ref to if_ixml_stream_factory,
         xslt_err type ref to cx_xslt_exception,
         g_encoding type ref to if_ixml_encoding,
         ostream type ref to if_ixml_ostream.

  constants:  line_length type i value 4096.
  types:      line_t(line_length) type x,
              table_t type standard table of line_t.
  data: restab type table_t.

  constants:
* encoding for download of XML files
    encoding     type string value 'utf-8'.
  data: ressize type i.

  try.
      g_ixml = cl_ixml=&amp;gt;create( ).
      g_stream_factory = g_ixml-&amp;gt;create_stream_factory( ).
      g_encoding = g_ixml-&amp;gt;create_encoding( character_set = encoding
        byte_order = 0 ).


      refresh restab.
      ostream =
        g_stream_factory-&amp;gt;create_ostream_itable( table = restab ).

      ostream-&amp;gt;set_encoding( encoding = g_encoding ).
      call transformation id_indent
        source     asap_issue = issue
        result xml restab
        options
        data_refs = 'embedded'.

      ressize = ostream-&amp;gt;get_num_written_raw( ).

    catch cx_xslt_exception into xslt_err.
      data: s type string.
      s = xslt_err-&amp;gt;get_text( ).

  endtry.

  call function 'GUI_DOWNLOAD'
    exporting
      bin_filesize = ressize
      filename     = ifilename
      filetype     = 'BIN'
    tables
      data_tab     = restab
    exceptions
      others       = 1.

  call method cl_gui_frontend_services=&amp;gt;execute
     exporting
       document               = ifilename
*    APPLICATION            =
*    PARAMETER              =
*    DEFAULT_DIRECTORY      =
*    MAXIMIZED              =
*    MINIMIZED              =
*    SYNCHRONOUS            =
    exceptions
      cntl_error             = 1
      error_no_gui           = 2
      bad_parameter          = 3
      file_not_found         = 4
      path_not_found         = 5
      file_extension_unknown = 6
      error_execute_failed   = 7
      others                 = 8.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as a different system, once you have the data serialized into a string or internal table you have lots of possibilites.  If the other system is an SAP system you could send the data via RFC.  You could always write the XML string to the server file system (via open dataset, transfer to dataset).  You can then FTP the file (using built in SAP FTP functionality) just about anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are you looking for as far as robust and secure.  The XML serializer is built in the ABAP Kernel and quite robust.  As far as secure- the data isn't secure at all.  The data is written into a simple string (if written into the file system or your pc - it is a text or binary file that can easily be read by just about anything).  Serializing to XML in and of itself isn't going to provide any security.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 14:09:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913851#M57681</guid>
      <dc:creator>thomas_jung</dc:creator>
      <dc:date>2005-03-02T14:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913852#M57682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would not put it as overestimating, but ignorance of what ostream can do. Thank you , anyway, for your help, I am sure, I will be able to eventually figure out how the pieces fit in, by reading the help, weblogs etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2005 14:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913852#M57682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-02T14:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913853#M57683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The file is created on the application server and you can use transaction AL11 to see the file in the DIR_HOME directory. But if do not execute the CLOSE method of the output stream object, you create a empty file of size 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2005 06:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913853#M57683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-03T06:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913854#M57684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Heinrich. I did see my test.xml in DIR_HOME directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2005 07:04:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913854#M57684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-03T07:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Data to XML file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913855#M57685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;when downloading an XML file , make sure &lt;/P&gt;&lt;P&gt;you have serialized the XML into a raw table or xstring and&lt;/P&gt;&lt;P&gt;you have used utf-8 or utf-16 as your encoding. Otherwise, you will have problems displaying different character sets &lt;/P&gt;&lt;P&gt;depending on your PC locale settings.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2005 14:45:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-data-to-xml-file/m-p/913855#M57685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-03T14:45:40Z</dc:date>
    </item>
  </channel>
</rss>

