<?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: sample code for retrieving recent spool numbers in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595776#M594542</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this Link and it would definitely solve u r problem with an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba5fc35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba5fc35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And alternatively if u execute the report in the background (se38&lt;DEL&gt;&amp;gt; program&lt;/DEL&gt;&amp;gt;execute--&amp;gt;background)&lt;/P&gt;&lt;P&gt;and for this u have to create a variant and supply the values for selection screen..&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;Abhay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;rewrads point&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2007 06:56:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-24T06:56:46Z</dc:date>
    <item>
      <title>sample code for retrieving recent spool numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595772#M594538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i need to retrieve the recent spool number from table TSP01,&lt;/P&gt;&lt;P&gt;i am going through some previously done programs,&lt;/P&gt;&lt;P&gt;can some one send me the spool logic within a program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and if any one has , please send me a sample code where spool is handled .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 06:50:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595772#M594538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T06:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for retrieving recent spool numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595773#M594539</link>
      <description>&lt;P&gt;See this sample code it might help u.&lt;/P&gt;&lt;P&gt;[Removed by the moderator.]&lt;/P&gt;&lt;P&gt;Save Report Output to a PDF File&lt;/P&gt;&lt;P&gt;This report takes another report as input, and captures the output of that report. The output is then converted to PDF and saved to a local file. This shows how to use some of the PDF function modules, as well as an easy way to create PDF files.&lt;/P&gt;&lt;P&gt;One thing I am not thrilled about is how the spool number is retrieved. If anyone has any better method, please let me know! Until I actually have a production use for a program like this, I will not try to find a better way.&lt;/P&gt;&lt;P&gt;Source Code Listing &lt;/P&gt;&lt;P&gt;report zabap_2_pdf.&lt;/P&gt;&lt;P&gt;*-- Enhancements: only allow to be run with variant. Then called&lt;/P&gt;&lt;P&gt;*-- program will be transparent to users&lt;/P&gt;&lt;P&gt;*-- TABLES&lt;/P&gt;&lt;P&gt;tables:&lt;/P&gt;&lt;P&gt;tsp01.&lt;/P&gt;&lt;P&gt;*-- STRUCTURES&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;mstr_print_parms like pri_params,&lt;/P&gt;&lt;P&gt;mc_valid(1) type c,&lt;/P&gt;&lt;P&gt;mi_bytecount type i,&lt;/P&gt;&lt;P&gt;mi_length type i,&lt;/P&gt;&lt;P&gt;mi_rqident like tsp01-rqident.&lt;/P&gt;&lt;P&gt;*-- INTERNAL TABLES&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;mtab_pdf like tline occurs 0 with header line,&lt;/P&gt;&lt;P&gt;mc_filename like rlgrap-filename.&lt;/P&gt;&lt;P&gt;*-- SELECTION SCREEN&lt;/P&gt;&lt;P&gt;parameters:&lt;/P&gt;&lt;P&gt;p_repid like sy-repid, " Report to execute&lt;/P&gt;&lt;P&gt;p_linsz like sy-linsz default 132, " Line size&lt;/P&gt;&lt;P&gt;p_paart like sy-paart default 'X_65_132'. " Paper Format&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;concatenate 'c:\'&lt;/P&gt;&lt;P&gt;p_repid&lt;/P&gt;&lt;P&gt;'.pdf'&lt;/P&gt;&lt;P&gt;into mc_filename.&lt;/P&gt;&lt;P&gt;*-- Setup the Print Parmaters&lt;/P&gt;&lt;P&gt;call function 'GET_PRINT_PARAMETERS'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;authority= space&lt;/P&gt;&lt;P&gt;copies = '1'&lt;/P&gt;&lt;P&gt;cover_page = space&lt;/P&gt;&lt;P&gt;data_set = space&lt;/P&gt;&lt;P&gt;department = space&lt;/P&gt;&lt;P&gt;destination = space&lt;/P&gt;&lt;P&gt;expiration = '1'&lt;/P&gt;&lt;P&gt;immediately = space&lt;/P&gt;&lt;P&gt;in_archive_parameters = space&lt;/P&gt;&lt;P&gt;in_parameters = space&lt;/P&gt;&lt;P&gt;layout = space&lt;/P&gt;&lt;P&gt;mode = space&lt;/P&gt;&lt;P&gt;new_list_id = 'X'&lt;/P&gt;&lt;P&gt;no_dialog= 'X'&lt;/P&gt;&lt;P&gt;user = sy-uname&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;out_parameters = mstr_print_parms&lt;/P&gt;&lt;P&gt;valid = mc_valid&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;archive_info_not_found = 1&lt;/P&gt;&lt;P&gt;invalid_print_params = 2&lt;/P&gt;&lt;P&gt;invalid_archive_params = 3&lt;/P&gt;&lt;P&gt;others = 4.&lt;/P&gt;&lt;P&gt;*-- Make sure that a printer destination has been set up&lt;/P&gt;&lt;P&gt;*-- If this is not done the PDF function module ABENDS&lt;/P&gt;&lt;P&gt;if mstr_print_parms-pdest = space.&lt;/P&gt;&lt;P&gt;mstr_print_parms-pdest = 'LOCL'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;*-- Explicitly set line width, and output format so that&lt;/P&gt;&lt;P&gt;*-- the PDF conversion comes out OK&lt;/P&gt;&lt;P&gt;mstr_print_parms-linsz = p_linsz.&lt;/P&gt;&lt;P&gt;mstr_print_parms-paart = p_paart.&lt;/P&gt;&lt;P&gt;submit (p_repid) to sap-spool without spool dynpro&lt;/P&gt;&lt;P&gt;spool parameters mstr_print_parms&lt;/P&gt;&lt;P&gt;via selection-screen&lt;/P&gt;&lt;P&gt;and return.*-- Find out what the spool number is that was just created&lt;/P&gt;&lt;P&gt;perform get_spool_number using sy-repid&lt;/P&gt;&lt;P&gt;sy-uname&lt;/P&gt;&lt;P&gt;changing mi_rqident.&lt;/P&gt;&lt;P&gt;*-- Convert Spool to PDF&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= mi_rqident&lt;/P&gt;&lt;P&gt;no_dialog = space&lt;/P&gt;&lt;P&gt;dst_device = mstr_print_parms-pdest&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;pdf_bytecount = mi_bytecount&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;pdf = mtab_pdf&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;err_no_abap_spooljob = 1&lt;/P&gt;&lt;P&gt;err_no_spooljob = 2&lt;/P&gt;&lt;P&gt;err_no_permission = 3&lt;/P&gt;&lt;P&gt;err_conv_not_possible = 4&lt;/P&gt;&lt;P&gt;err_bad_destdevice = 5&lt;/P&gt;&lt;P&gt;user_cancelled = 6&lt;/P&gt;&lt;P&gt;err_spoolerror = 7&lt;/P&gt;&lt;P&gt;err_temseerror = 8&lt;/P&gt;&lt;P&gt;err_btcjob_open_failed = 9&lt;/P&gt;&lt;P&gt;err_btcjob_submit_failed = 10&lt;/P&gt;&lt;P&gt;err_btcjob_close_failed = 11&lt;/P&gt;&lt;P&gt;others = 12.&lt;/P&gt;&lt;P&gt;call function 'DOWNLOAD'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;bin_filesize = mi_bytecount&lt;/P&gt;&lt;P&gt;filename = mc_filename&lt;/P&gt;&lt;P&gt;filetype = 'BIN'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;act_filename = mc_filename&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;data_tab = mtab_pdf.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;HR /&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;FORM get_spool_number *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;HR /&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Get the most recent spool created by user/report *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;HR /&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;--&amp;gt; F_REPID *&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;
&lt;P&gt;--&amp;gt; F_UNAME *&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;
&lt;P&gt;--&amp;gt; F_RQIDENT *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;HR /&gt;
&lt;P&gt;form get_spool_number using f_repid&lt;/P&gt;&lt;P&gt;f_uname&lt;/P&gt;&lt;P&gt;changing f_rqident.&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;lc_rq2name like tsp01-rq2name.&lt;/P&gt;&lt;P&gt;concatenate f_repid+0(8)&lt;/P&gt;&lt;P&gt;f_uname+0(3)&lt;/P&gt;&lt;P&gt;into lc_rq2name separated by '_'.&lt;/P&gt;&lt;P&gt;select * from tsp01 where rq2name = lc_rq2name&lt;/P&gt;&lt;P&gt;order by rqcretime descending.&lt;/P&gt;&lt;P&gt;f_rqident = tsp01-rqident.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;clear f_rqident.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endform." get_spool_number&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;P&gt;Also refer&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;Abhay Singh.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;rewards point&amp;lt;/b&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2007 06:55:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595773#M594539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T06:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for retrieving recent spool numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595774#M594540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;go theough the following Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT Z_ABAPOUTPUT_PDF .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_ident like tsp01-rqident,&lt;/P&gt;&lt;P&gt;w_doctype like tsp01-rqdoctype,&lt;/P&gt;&lt;P&gt;w_bytecount type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab_pdf like tline occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameter spoolnum like tsp01-rqident obligatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block a2 with frame.&lt;/P&gt;&lt;P&gt;parameters: to_pc radiobutton group a2 default 'X',&lt;/P&gt;&lt;P&gt;pcfile like rlgrap-filename lower case,&lt;/P&gt;&lt;P&gt;to_unix radiobutton group a2,&lt;/P&gt;&lt;P&gt;unixfile(255) lower case.&lt;/P&gt;&lt;P&gt;selection-screen end of block a2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;at selection-screen on block a2.&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;if to_pc = 'X' and pcfile is initial.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Enter PC File Name.'.&lt;/P&gt;&lt;P&gt;elseif to_unix = 'X' and unixfile is initial.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Enter Unix File Name.'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************&lt;/P&gt;&lt;P&gt;at selection-screen on spoolnum.&lt;/P&gt;&lt;P&gt;*******************************&lt;/P&gt;&lt;P&gt;select single rqident rqdoctype&lt;/P&gt;&lt;P&gt;into (w_ident, w_doctype)&lt;/P&gt;&lt;P&gt;from tsp01&lt;/P&gt;&lt;P&gt;where rqident = spoolnum.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Spool' spoolnum 'not found'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************&lt;/P&gt;&lt;P&gt;at selection-screen on value-request for pcfile.&lt;/P&gt;&lt;P&gt;************************************************&lt;/P&gt;&lt;P&gt;call function 'WS_FILENAME_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;mask = ',&lt;STRONG&gt;.&lt;/STRONG&gt;,&lt;STRONG&gt;.&lt;/STRONG&gt;.'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;filename = pcfile&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;others = 1.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message id sy-msgid type 'I' number sy-msgno&lt;/P&gt;&lt;P&gt;with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;*******************&lt;/P&gt;&lt;P&gt;if w_doctype = 'LIST'.&lt;/P&gt;&lt;P&gt;perform get_abap_spool_in_pdf.&lt;/P&gt;&lt;P&gt;elseif w_doctype = 'OTF'.&lt;/P&gt;&lt;P&gt;perform get_otf_spool_in_pdf.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if to_pc = 'X'.&lt;/P&gt;&lt;P&gt;perform write_pdf_spool_to_pc.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;perform write_pdf_spool_to_unix.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;message i398(00) with 'Completed OK'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form get_abap_spool_in_pdf.&lt;/P&gt;&lt;P&gt;refresh itab_pdf.&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 = w_ident&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;pdf_bytecount = w_bytecount&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;pdf = itab_pdf&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;err_no_abap_spooljob = 1&lt;/P&gt;&lt;P&gt;err_no_spooljob = 2&lt;/P&gt;&lt;P&gt;err_no_permission = 3&lt;/P&gt;&lt;P&gt;err_conv_not_possible = 4&lt;/P&gt;&lt;P&gt;err_bad_destdevice = 5&lt;/P&gt;&lt;P&gt;user_cancelled = 6&lt;/P&gt;&lt;P&gt;err_spoolerror = 7&lt;/P&gt;&lt;P&gt;err_temseerror = 8&lt;/P&gt;&lt;P&gt;err_btcjob_open_failed = 9&lt;/P&gt;&lt;P&gt;err_btcjob_submit_failed = 10&lt;/P&gt;&lt;P&gt;err_btcjob_close_failed = 11&lt;/P&gt;&lt;P&gt;others = 12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form get_otf_spool_in_pdf.&lt;/P&gt;&lt;P&gt;refresh itab_pdf.&lt;/P&gt;&lt;P&gt;call function 'CONVERT_OTFSPOOLJOB_2_PDF'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;src_spoolid = w_ident&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;pdf_bytecount = w_bytecount&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;pdf = itab_pdf&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;err_no_otf_spooljob = 1&lt;/P&gt;&lt;P&gt;err_no_spooljob = 2&lt;/P&gt;&lt;P&gt;err_no_permission = 3&lt;/P&gt;&lt;P&gt;err_conv_not_possible = 4&lt;/P&gt;&lt;P&gt;err_bad_dstdevice = 5&lt;/P&gt;&lt;P&gt;user_cancelled = 6&lt;/P&gt;&lt;P&gt;err_spoolerror = 7&lt;/P&gt;&lt;P&gt;err_temseerror = 8&lt;/P&gt;&lt;P&gt;err_btcjob_open_failed = 9&lt;/P&gt;&lt;P&gt;err_btcjob_submit_failed = 10&lt;/P&gt;&lt;P&gt;err_btcjob_close_failed = 11&lt;/P&gt;&lt;P&gt;others = 12.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form write_pdf_spool_to_unix.&lt;/P&gt;&lt;P&gt;open dataset unixfile for output in binary mode.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0 .&lt;/P&gt;&lt;P&gt;message e398(00) with 'Cannot open unix file for output:' unixfile.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_pdf.&lt;/P&gt;&lt;P&gt;transfer itab_pdf to unixfile.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0 .&lt;/P&gt;&lt;P&gt;message e398(00) with 'Cannot write to unix file:' unixfile.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset unixfile.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form write_pdf_spool_to_pc.&lt;/P&gt;&lt;P&gt;call function 'WS_DOWNLOAD'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;bin_filesize = w_bytecount&lt;/P&gt;&lt;P&gt;filename = pcfile&lt;/P&gt;&lt;P&gt;filetype = 'BIN'&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;data_tab = itab_pdf&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;file_open_error = 1&lt;/P&gt;&lt;P&gt;file_write_error = 2&lt;/P&gt;&lt;P&gt;invalid_filesize = 3&lt;/P&gt;&lt;P&gt;invalid_type = 4&lt;/P&gt;&lt;P&gt;no_batch = 5&lt;/P&gt;&lt;P&gt;unknown_error = 6&lt;/P&gt;&lt;P&gt;invalid_table_width = 7&lt;/P&gt;&lt;P&gt;gui_refuse_filetransfer = 8&lt;/P&gt;&lt;P&gt;customer_error = 9&lt;/P&gt;&lt;P&gt;others = 10.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e398(00) with 'Cannot download to PC. Error =' sy-subrc.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Abhay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;rewards point&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 06:56:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595774#M594540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T06:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for retrieving recent spool numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595775#M594541</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 like thi s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: ITSP01 TYPE TABLE OF TSP01 WITH HEADER LINE.
SELECT * FROM TSP01 INTO TABLE ITSP01.
SORT ITSP01 BY RQIDENT descending.
LOOP AT ITSP01.
EXIT.
ENDLOOP.
WRITE: / ITSP01-RQIDENT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To retrieve from job check this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use FM '&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RSPO_SPOOLDATA_GET_PRINTABLE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or write select query &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT * FROM tbtco WHERE jobname IN sel_job AND status = 'S'.
SELECT SINGLE * FROM tbtcp WHERE jobcount = tbtco-jobcount
AND jobname = tbtco-jobname.
CLEAR zeile.
CONCATENATE tbtco-jobname ',' tbtcp-progname ',' tbtcp-variant
':' tbtco-jobclass ',' tbtco-execserver
':' tbtco-sdlstrtdt ',' tbtco-sdlstrttm
':' tbtco-prdmins ',' tbtco-prdhours ',' tbtco-prddays ','
tbtco-prdweeks ',' tbtco-prdmonths
INTO zeile.
CONCATENATE sy-sysid ':JOBS:' zeile INTO zeile.
TRANSFER zeile TO filename.
ENDSELECT.&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;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>Tue, 24 Jul 2007 06:56:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595775#M594541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T06:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for retrieving recent spool numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595776#M594542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this Link and it would definitely solve u r problem with an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba5fc35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba5fc35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And alternatively if u execute the report in the background (se38&lt;DEL&gt;&amp;gt; program&lt;/DEL&gt;&amp;gt;execute--&amp;gt;background)&lt;/P&gt;&lt;P&gt;and for this u have to create a variant and supply the values for selection screen..&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;Abhay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;rewrads point&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 06:56:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-retrieving-recent-spool-numbers/m-p/2595776#M594542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T06:56:46Z</dc:date>
    </item>
  </channel>
</rss>

