<?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: Binary to XML using GUI_DOWNLOAD in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194199#M1625557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Holger,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this helped me a lot. Great work.... Very often you read the advice to download the content in ASC-format which will probably causes trouble using an extended charset in ABAP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hendrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 07:50:21 GMT</pubDate>
    <dc:creator>hgedicke</dc:creator>
    <dc:date>2015-02-24T07:50:21Z</dc:date>
    <item>
      <title>Binary to XML using GUI_DOWNLOAD</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194197#M1625555</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 am trying to download (local) the data in binary format to XML using CL_GUI_FRONTEND_SERVICES=&amp;gt;GUI_DOWNLOAD. But the data that has been downloaded contains all chinese characters instead of the actual data. And this doesn't happen everytime I download the file, but very sporadic. I am guessing this is something to do with the code pade. I have tried using different code pages and couldn't resolve the issue. we are on 4.7 and it is non-unicode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD CL_GUI_FRONTEND_SERVICES=&amp;gt;GUI_DOWNLOAD&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        BIN_FILESIZE               = L_LEN&lt;/P&gt;&lt;P&gt;        FILETYPE                   = 'BIN'&lt;/P&gt;&lt;P&gt;        FILENAME                   = 'C:/XML/Test.xml'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       CODEPAGE                   = '4110'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        DATA_TAB                = LT_DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2011 03:26:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194197#M1625555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-19T03:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Binary to XML using GUI_DOWNLOAD</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194198#M1625556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tony,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you might want to check out interface IF_IXML and class CL_IXML_80_20 for conversions before download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
form xstring_download using p_xml_xstring type xstring.
  data: lt_filename  type standard table of file_table with header line.
  data: lv_rc type i. " Anzahl der Dateien := 1.

* Deklarationen für DOWNload...
  data: lv_download_rc type sysubrc.
  data: lv_filename type string.

  types: lty_x_line(256) type x,
       lty_x_tab type table of lty_x_line.
  data:
         lr_ixml type ref to if_ixml,
         lr_document type ref to if_ixml_document,
         lr_streamfactory type ref to if_ixml_stream_factory,
         lr_parser type ref to if_ixml_parser,
         lr_istream type ref to if_ixml_istream,
         lv_xtab_size type i,
         lt_xtab type lty_x_tab.

*** STEP 1
*** transform XML String of type XSTRING  into Table

* create the ixml main factory
  lr_ixml = cl_ixml=&amp;gt;create( ).
* create a stream factory
  lr_streamfactory = lr_ixml-&amp;gt;create_stream_factory( ).

*   create a input stream
  lr_istream  =
          lr_streamfactory-&amp;gt;create_istream_xstring( string = p_xml_xstring ).
*   create a ixml document (DOM Respresentation)
  lr_document = lr_ixml-&amp;gt;create_document( ).
*   create a xml parser
  lr_parser = lr_ixml-&amp;gt;create_parser(
                                   document       = lr_document
                                   stream_factory = lr_streamfactory
                                   istream        = lr_istream ).
*   parse document
  check lr_parser-&amp;gt;parse( ) = 0.

* render to table of x -&amp;gt; default encoding utf-8
  call method cl_ixml_80_20=&amp;gt;render_to_table_of_x "also: table_of_c
    exporting
      document          = lr_document
      pretty_print      = 1
    importing
      stream_table      = lt_xtab
      stream_table_size = lv_xtab_size.


*** Step 2
*** Download
* Init
  clear lv_rc.
  refresh lt_filename.
  lv_download_rc = 4.
  while lv_download_rc ne 0.
    call method cl_gui_frontend_services=&amp;gt;file_open_dialog
      changing
        file_table              = lt_filename[]
        rc                      = lv_rc
      exceptions
        file_open_dialog_failed = 1
        cntl_error              = 2
        error_no_gui            = 3
        not_supported_by_gui    = 4
        others                  = 5.

    if sy-subrc &amp;lt;&amp;gt; 0.
*    MESSAGE annn(kkkk) WITH space. "&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; adjust
    elseif lv_rc lt 1. "e.g. abort by user
      exit. "from while loop.
    endif.

    if not lt_filename[] is initial.

      read table lt_filename index 1.
      move lt_filename-filename to lv_filename. "implicit conversion

  call function 'GUI_DOWNLOAD'
    exporting
      bin_filesize = lv_xtab_size
      filename     = lv_filename
      filetype     = 'BIN'
    tables
      data_tab     = lt_xtab
    exceptions
      others       = 1.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

      if sy-subrc &amp;lt;&amp;gt; 0.
*      MESSAGE innn(kkkk) WITH g_filename. &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; adjust
*   GUI-Übertragungsfehler (UPLOAD &amp;amp;1)
      else.
        lv_download_rc = 0.
      endif.
    endif. "not lt_filename[] is initial.
  endwhile.

endform .                    "xstring_download
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;have fun!&lt;/P&gt;&lt;P&gt;hp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:53:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194198#M1625556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-24T15:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Binary to XML using GUI_DOWNLOAD</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194199#M1625557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Holger,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this helped me a lot. Great work.... Very often you read the advice to download the content in ASC-format which will probably causes trouble using an extended charset in ABAP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hendrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 07:50:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-to-xml-using-gui-download/m-p/8194199#M1625557</guid>
      <dc:creator>hgedicke</dc:creator>
      <dc:date>2015-02-24T07:50:21Z</dc:date>
    </item>
  </channel>
</rss>

