<?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 convert to pdf in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570063#M586741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;I have data in an internal table. i am not using any smartform function modules.&lt;/P&gt;&lt;P&gt;I just need to convert the itab data to pdf.&lt;/P&gt;&lt;P&gt;Can i convert it directly &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLEASE DONT RELATE IT TO SMART FORM FUNCTION MODULES.&lt;/P&gt;&lt;P&gt;I dont want to go through smartform way.&lt;/P&gt;&lt;P&gt;Cant i do it directly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Aug 2007 07:44:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-03T07:44:57Z</dc:date>
    <item>
      <title>convert to pdf</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570063#M586741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;I have data in an internal table. i am not using any smartform function modules.&lt;/P&gt;&lt;P&gt;I just need to convert the itab data to pdf.&lt;/P&gt;&lt;P&gt;Can i convert it directly &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLEASE DONT RELATE IT TO SMART FORM FUNCTION MODULES.&lt;/P&gt;&lt;P&gt;I dont want to go through smartform way.&lt;/P&gt;&lt;P&gt;Cant i do it directly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 07:44:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570063#M586741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T07:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: convert to pdf</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570064#M586742</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;&lt;/P&gt;&lt;P&gt;Check the links -&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3356606"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="242685"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2804905"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if it helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Omkar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 07:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570064#M586742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T07:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: convert to pdf</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570065#M586743</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;&lt;/P&gt;&lt;P&gt;Use this Fm..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;SRC_SPOOLID = SPOOL_NR&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;PDF_BYTECOUNT = PDF_FILESIZE&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;PDF = PDF_OUTPUT.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;SPOOL_NR_DEL = SPOOL_NR.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;SPOOLID = SPOOL_NR_DEL.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;BIN_FILESIZE = PDF_FILESIZE.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 07:53:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570065#M586743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T07:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: convert to pdf</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570066#M586744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;print the itab, convert this Spool to pdf and download it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 07:53:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570066#M586744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T07:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: convert to pdf</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570067#M586745</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;Try with this&lt;/P&gt;&lt;P&gt; Fms&lt;/P&gt;&lt;P&gt; CONVERT_OTF --&amp;gt;Convert OTF format to various formats (TLINE table) &lt;/P&gt;&lt;P&gt;CONVERT_OTF_2_PDF --&amp;gt;Convert OTF to PDF (TLINE table). OTF can be filled used archivelink. Calls CONVERT_OTF. &lt;/P&gt;&lt;P&gt;CONVERT_OTF_2_PDF_ARCHIVELINK --&amp;gt;Convert OTF to PDF (TLINE table). Calls CONVERT_OTF. Looks like the function names for these two functions are mixed up&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONVERT_OTFSPOOLJOB_2_PDF--&amp;gt;Input: spool # (SAPscript: tsp01-rqdoctype='OTF'); Output: PDF as internal table (TLINE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; Example&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: w_ident     like tsp01-rqident,
      w_doctype   like tsp01-rqdoctype,
      w_bytecount type i.

data: itab_pdf    like tline occurs 0 with header line.

parameter spoolnum like tsp01-rqident obligatory.

selection-screen begin of block a2 with frame.
parameters:  to_pc   radiobutton group a2 default 'X',
             pcfile like rlgrap-filename lower case,
             to_unix radiobutton group a2,
             unixfile(255) lower case.
selection-screen end of block a2.

********************************
at selection-screen on block a2.
********************************
  if to_pc = 'X' and pcfile is initial.
    message e398(00) with 'Enter PC File Name.'.
  elseif to_unix = 'X' and unixfile is initial.
    message e398(00) with 'Enter Unix File Name.'.
  endif.

*******************************
at selection-screen on spoolnum.
*******************************
  select single rqident rqdoctype
         into (w_ident, w_doctype)
         from tsp01
         where rqident = spoolnum.
  if sy-subrc ne 0.
    message e398(00) with 'Spool' spoolnum 'not found'.
  endif.

************************************************
at selection-screen on value-request for pcfile.
************************************************
  call function 'WS_FILENAME_GET'
       exporting
            mask     = ',*.*,*.*.'
       importing
            filename = pcfile
       exceptions
            others   = 1.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message id sy-msgid type 'I' number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.


*******************
start-of-selection.
*******************
  if w_doctype = 'LIST'.
    perform get_abap_spool_in_pdf.
  elseif w_doctype = 'OTF'.
    perform get_otf_spool_in_pdf.
  endif.

  if to_pc = 'X'.
    perform write_pdf_spool_to_pc.
  else.
    perform write_pdf_spool_to_unix.
  endif.

  message i398(00) with 'Completed OK'.

************************************************************************
form get_abap_spool_in_pdf.
  refresh itab_pdf.
  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
       exporting
            src_spoolid              = w_ident
       importing
            pdf_bytecount            = w_bytecount
       tables
            pdf                      = itab_pdf
       exceptions
            err_no_abap_spooljob     = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_destdevice       = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            others                   = 12.

  if sy-subrc ne 0.
    message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
  endif.
endform.

************************************************************************
form get_otf_spool_in_pdf.
  refresh itab_pdf.
  call function 'CONVERT_OTFSPOOLJOB_2_PDF'
       exporting
            src_spoolid              = w_ident
       importing
            pdf_bytecount            = w_bytecount
       tables
            pdf                      = itab_pdf
       exceptions
            err_no_otf_spooljob      = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_dstdevice        = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            others                   = 12.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
  endif.
endform.

************************************************************************
form write_pdf_spool_to_unix.
  open dataset unixfile for output in binary mode.
  if sy-subrc ne 0 .
    message e398(00) with 'Cannot open unix file for output:' unixfile.
  endif.

  loop at itab_pdf.
    transfer itab_pdf to unixfile.
    if sy-subrc ne 0 .
      message e398(00) with 'Cannot write to unix file:' unixfile.
    endif.
  endloop.

  close dataset unixfile.
endform.

************************************************************************
form write_pdf_spool_to_pc.
  call function 'WS_DOWNLOAD'
       exporting
            bin_filesize            = w_bytecount
            filename                = pcfile
            filetype                = 'BIN'
       tables
            data_tab                = itab_pdf
       exceptions
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            others                  = 10.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message e398(00) with 'Cannot download to PC. Error =' sy-subrc.
  endif.
endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONVERT_ABAPSPOOLJOB_2_PDF --&amp;gt;Input: spool # (ABAP listing: tsp01-rqdoctype='LIST'); Output: PDF as internal table (TLINE) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RSPO_RETURN_SPOOLJOB --&amp;gt;Return spool data in text [or PDF format]:&lt;/P&gt;&lt;P&gt;Input: Spool #; Desired Type for output (RAW - text data ready to be printed, PDF - can be used only for OTF spools)&lt;/P&gt;&lt;P&gt;Output: text table (line length = 255), [table for PDF data]  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RSPO_DISPLAY_SPOOLJOB--&amp;gt;  Input: Spool #  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 07:56:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-to-pdf/m-p/2570067#M586745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T07:56:32Z</dc:date>
    </item>
  </channel>
</rss>

