<?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: Convert XML to PDF Directly in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710703#M32762</link>
    <description>&lt;P&gt;SCMS_XSTRING_TO_BINARY function has exporting parameter &lt;STRONG&gt;OUTPUT_LENGTH&lt;/STRONG&gt;, which is important value which you should use in GUI_DOWNLOAD. If you do not use it, 'BIN' gui_download does not know the correct size of the created file.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;But anyway, I am not sure if you can simply save binary XML and call it PDF. But that is another thing.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jul 2018 07:19:28 GMT</pubDate>
    <dc:creator>Tomas_Buryanek</dc:creator>
    <dc:date>2018-07-09T07:19:28Z</dc:date>
    <item>
      <title>Convert XML to PDF Directly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710702#M32761</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I want to accept XML file from user and convert it directly into PDF and let it downloaded to local system.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Is there any way I can do it.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I have tried below code but PDF file is getting corrupt...&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CALL METHOD gs_cl_xml-&amp;gt;import_from_file
    EXPORTING
      filename = p_file 
    RECEIVING
      retcode = gv_subrc.

IF gv_subrc = 0.
  CALL METHOD gs_cl_xml-&amp;gt;render_2_xstring
      IMPORTING
        retcode = gv_subrc
        stream = gv_xml_string
        size = gv_size.

  IF gv_subrc = 0.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
           buffer = gv_xml_string
        TABLES
           binary_tab = lt_data.
    cl_gui_frontend_services=&amp;gt;gui_download(
      exporting
        filename = 'C:\Users\ast07367\Desktop\PDF.pdf'
        filetype = 'BIN'
      changing
        data_tab = LT_DATA ).
  Endif.
Endif.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 06:58:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710702#M32761</guid>
      <dc:creator>former_member550878</dc:creator>
      <dc:date>2018-07-09T06:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML to PDF Directly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710703#M32762</link>
      <description>&lt;P&gt;SCMS_XSTRING_TO_BINARY function has exporting parameter &lt;STRONG&gt;OUTPUT_LENGTH&lt;/STRONG&gt;, which is important value which you should use in GUI_DOWNLOAD. If you do not use it, 'BIN' gui_download does not know the correct size of the created file.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;But anyway, I am not sure if you can simply save binary XML and call it PDF. But that is another thing.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 07:19:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710703#M32762</guid>
      <dc:creator>Tomas_Buryanek</dc:creator>
      <dc:date>2018-07-09T07:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML to PDF Directly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710704#M32763</link>
      <description>&lt;P&gt;In future please use the "code" button on the editor to post code examples. Use right click "post as text" when pasting code from an editor, and after posting, ensure the code is nicely formatted and readable.&lt;/P&gt;
  &lt;P&gt;I've done it for you this time.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 07:20:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710704#M32763</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-07-09T07:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML to PDF Directly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710705#M32764</link>
      <description>&lt;P&gt;You cant directly convert from XML to PDF, they are difference thing. You can convert data from XML to internal table, write it to spool then export spool to PDF. See this wiki ( you can replace WRITE statement with fm: RSPO_WRITE_SPOOLREQUEST in order to write data to spool ) .&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;A href="https://wiki.scn.sap.com/wiki/display/XI/Generation+of+PDF+File+from+Internal+Table%2C+SAP+Script%2C+Smat+Forms+and+Text+Modules" target="test_blank"&gt;https://wiki.scn.sap.com/wiki/display/XI/Generation+of+PDF+File+from+Internal+Table%2C+SAP+Script%2C+Smat+Forms+and+Text+Modules&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;plus, see this report to know more about spool to pdf: RSTXPDFT4.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 05:22:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-to-pdf-directly/m-p/710705#M32764</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2018-07-10T05:22:05Z</dc:date>
    </item>
  </channel>
</rss>

