Downloading spool files FM

Hello,
Need your help with downloading 108 spool files.
I have scheduled 108 jobs and now I have to download data of all these 108 spools into excel files (from various PRD systems).
One way is I go to System -> List -> Save -> Local File.
However I don't want to use this.
Neither I have option to create program in SE38, as I don't have access to same.
Please advice if theree is any standard program or function module which can help me in this.
Will be very thankful.

form download_selected tables lsporq type sp01r_tview
                       changing rs_selfield type slis_selfield.
  data: rqnum like sy-tabix,
        filename like rlgrap-filename,
        dw_rc type sy-subrc.     
  perform get_selected3 tables lsporq
                        using ' ' rs_selfield changing rqnum.
  if rqnum > 0.
    loop at lsporq where selected = 'X'.
      filename(3) = lsporq-sys.
      filename+3(10) = lsporq-rqid_char.
      filename+13(4) = '.TXT'.
      move-corresponding lsporq  to tsp01sys.
      call function 'RSPO_CHECK_OUTRQ_PERMISSION'
        exporting
          spoolreq = tsp01sys
          access   = 'DOWN'
        exceptions
          others   = 1.
      if sy-subrc  0.
        out_message ti.
      MESSAGE i059 WITH tsp01sys-rqident tsp01sys-sys.
      else.
        gprog = 'RSPO_DOWNLOAD_SPOOLJOB'.
        if lsporq-sys = sy-sysid.
          call function 'RSPO_DOWNLOAD_SPOOLJOB'
            exporting
              id     = lsporq-rqident
              fname  = filename
            exceptions
              others = 1.
        else.
          call function 'RSPO_DOWNLOAD_SPOOLJOB'
            destination lsporq-sys
            exporting
              id                    = lsporq-rqident
              fname                 = filename
            exceptions
              communication_failure = 102  message msg_text
              system_failure        = 103  message msg_text
              others                = 1.
        endif.
        dw_rc = sy-subrc.        
        out_rfc_message lsporq-sys ti.
      endif.
    endloop.
    if dw_rc = 0.             
      message s028.
    endif.                     
  endif.
endform.                    "DOWNLOAD_SELECTED

Similar Messages

  • Spool to PDF - Problems with downloading PDF file when converting with job

    Hi all!
    I've got a problem. I've got a program that writes a smartform into the spool. After that, I am using the function modules RSTS_GET_ATTRIBUTES and CONVERT_OTFSPOOLJOB_2_PDF to convert it into PDF. I retrieve a internal table with the binary content for the PDF file. Now i can download the file to the desktop by using the method cl_gui_frontend_services=>gui_download.
    But there is a problem: when the spool excesses 99 pages, the function module CONVERT_OTFSPOOLJOB_2_PDF asks the user via popup if the PDF should be created in background. If the user commits, the internal tables that should contain the binary PDF data is emtpy. A background job writes the binary data into the spool. The user has got an empty file that will be generated by cl_gui_frontend_services=>gui_download.
    So, is it possible to suppress the popup to create the PDF allways online? Or how can I write the PDF file if there will be create any spool id in background? You'll find my current code below.
    * Prüfen ob es die übergebene Spoolnummer überhaupt gibt
      SELECT SINGLE * FROM tsp01 INTO ls_tsp01 WHERE rqident = id_spoolid.
      IF ( sy-subrc <> 0 ).
        cf_error = 'X'.
        EXIT.
      ENDIF.
    * TemSe-Objekte speichern sequentielle Daten. Ein TemSe-Objekt kann aus
    * mehreren Teilen bestehen. Dieser FB ermittelt die wichtigsten Attribute
    * eines TemSe-Objekts. Falls das Objekt aus mehreren Teilen besteht, werden
    * die Attribute entsprechend zusammengefaßt.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
        EXPORTING
          client        = ls_tsp01-rqclient
          name          = ls_tsp01-rqo1name
          part          = 1
        IMPORTING
          objtype       = ld_objtype
        EXCEPTIONS
          fb_error      = 1
          fb_rsts_other = 2
          no_object     = 3
          no_permission = 4
          OTHERS        = 5.
      IF ( sy-subrc <> 0 ).
        cf_error = 'X'.
        EXIT.
      ENDIF.
      IF ld_objtype(3) = 'OTF'.
        lf_is_otf = 'X'.
      ELSE.
        lf_is_otf = ' '.
      ENDIF.
      IF ( lf_is_otf = 'X' ).
    *   Konvertiere OTF-Spoolauftrag nach PDF
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = id_spoolid
            no_dialog                = ' '
    *        pdf_destination          = 'T'
          IMPORTING
            pdf_bytecount            = ld_numbytes
            pdf_spoolid              = ld_pdfspoolid
            btc_jobname              = ld_jobname
            btc_jobcount             = ld_jobcount
          TABLES
            pdf                      = lt_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.
        IF ( sy-subrc <> 0 ).
          cf_error = 'X'.
          EXIT.
        ENDIF.
      ELSE.
    *   Konvertiere ABAP-Liste-Spoolauftrag nach PDF
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = id_spoolid
            no_dialog                = ' '
          IMPORTING
            pdf_bytecount            = ld_numbytes
            pdf_spoolid              = ld_pdfspoolid
            btc_jobname              = ld_jobname
            btc_jobcount             = ld_jobcount
          TABLES
            pdf                      = lt_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.
        IF ( sy-subrc <> 0 ).
          cf_error = 'X'.
          EXIT.
        ENDIF.
      ENDIF.
      WHILE ( lf_file_ok = '' ).
    *   Die in der Tabelle lt_pdf enthaltenen Binärdaten werden nun in eine
    *   Datei geschrieben. Da alle übergebenen Tickets in die gleiche Datei
    *   geschrieben werden, kann der im Speicher gehaltente Protokolleintrag
    *   gelesen werden
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize              = ld_numbytes
            filename                  = cd_filename
            filetype                  = 'BIN'
    *    append                    = SPACE
    *    write_field_separator     = SPACE
    *    header                    = '00'
    *    trunc_trailing_blanks     = SPACE
    *    write_lf                  = 'X'
    *    col_select                = SPACE
    *    col_select_mask           = SPACE
    *    dat_mode                  = SPACE
          confirm_overwrite         = 'X'
    *    no_auth_check             = SPACE
    *    codepage                  = SPACE
    *    ignore_cerr               = ABAP_TRUE
    *    replacement               = '#'
    *    write_bom                 = SPACE
    *    trunc_trailing_blanks_eol = 'X'
    *    wk1_n_format              = SPACE
    *    wk1_n_size                = SPACE
    *    wk1_t_format              = SPACE
    *    wk1_t_size                = SPACE
    *  IMPORTING
    *    filelength                =
          CHANGING
            data_tab                  = lt_pdf
          EXCEPTIONS
            file_write_error          = 1
            no_batch                  = 2
            gui_refuse_filetransfer   = 3
            invalid_type              = 4
            no_authority              = 5
            unknown_error             = 6
            header_not_allowed        = 7
            separator_not_allowed     = 8
            filesize_not_allowed      = 9
            header_too_long           = 10
            dp_error_create           = 11
            dp_error_send             = 12
            dp_error_write            = 13
            unknown_dp_error          = 14
            access_denied             = 15
            dp_out_of_memory          = 16
            disk_full                 = 17
            dp_timeout                = 18
            file_not_found            = 19
            dataprovider_exception    = 20
            control_flush_error       = 21
            not_supported_by_gui      = 22
            error_no_gui              = 23
            OTHERS                    = 24.

    Creating a PDF file with over 99 pages through SAP seems rather unreasonable to me. What are you printing - Encyclopedia Britannica? For cripes sake... Have you thought about creating more than one spool request or using something completely different? Why do you have to do this through spool? You can get Smartform output directly into PDF, there are a lot of example out there.
    The only solution that comes to mind is rather brutal - create a copy of the function module and get rid of the popup. Although it just might time out after that...

  • Reg :  Script spool file downloading into xl-file

    Dear friends,
    I need  to find the script spool no as well as the same script spool
    to be download into xl-file.
    Could u please give me guidelines, how to do that.
    Thanks and Regards
    V.Raja sekaran

    Thanks for your reply,
    My requirements is like  below,
    I am calling the script from report, In report i have a check box for excel download,
    If the user selected the option check box download into excel file than i need to indentify the spool number as well as download the script spool file into excel file.
    Thanks and regards
    V.Rajasekaran.

  • Downloading 108 spool files: Any FM?

    Hello,
    Need your help with downloading 108 spool files.
    I have scheduled 108 jobs and now I have to download data of all these 108 spools into excel files (from various PRD systems).
    One way is I go to System -> List -> Save -> Local File.
    However I don't want to use this.
    Neither I have option to create program in SE38, as I don't have access to same.
    Please advice if theree is any standard program or function module which can help me in this.
    Will be very thankful.
    Regards,
    Surpreet Singh Bal

    http://www.sapfans.com/forums/viewtopic.php?f=13&t=316295
    form download_selected tables lsporq type sp01r_tview
                           changing rs_selfield type slis_selfield.
      data: rqnum like sy-tabix,
            filename like rlgrap-filename,
            dw_rc type sy-subrc.     
      perform get_selected3 tables lsporq
                            using ' ' rs_selfield changing rqnum.
      if rqnum > 0.
        loop at lsporq where selected = 'X'.
          filename(3) = lsporq-sys.
          filename+3(10) = lsporq-rqid_char.
          filename+13(4) = '.TXT'.
          move-corresponding lsporq  to tsp01sys.
          call function 'RSPO_CHECK_OUTRQ_PERMISSION'
            exporting
              spoolreq = tsp01sys
              access   = 'DOWN'
            exceptions
              others   = 1.
          if sy-subrc <> 0.
            out_message ti.
    *       MESSAGE i059 WITH tsp01sys-rqident tsp01sys-sys.
          else.
            gprog = 'RSPO_DOWNLOAD_SPOOLJOB'.
            if lsporq-sys = sy-sysid.
              call function 'RSPO_DOWNLOAD_SPOOLJOB'
                exporting
                  id     = lsporq-rqident
                  fname  = filename
                exceptions
                  others = 1.
            else.
              call function 'RSPO_DOWNLOAD_SPOOLJOB'
                destination lsporq-sys
                exporting
                  id                    = lsporq-rqident
                  fname                 = filename
                exceptions
                  communication_failure = 102  message msg_text
                  system_failure        = 103  message msg_text
                  others                = 1.
            endif.
            dw_rc = sy-subrc.        
            out_rfc_message lsporq-sys ti.
          endif.
        endloop.
        if dw_rc = 0.             
          message s028.
        endif.                     
      endif.
    endform.                    "DOWNLOAD_SELECTED

  • DOWNLOAD ALL SPOOL FILES

    Hi,
    We have scheduled a background job for archiving the data and would like to download all the spool files generated...
    There are about 300 spool files..instead of downloading each spool file data is there any way where we can download all the spool files at one time..
    Regds,
    Satyanarayana N.

    Hi Satya,
    Pretty simple. In SP01 Select all the relevant spools using select all option and then from menu select:
    Spool Request>Forward-->Export as text.
    The spools will get saved as seperate individual files under SAPWORKDIR which will located inside Documents and Settings for user (Windows).
    Regards.
    Ruchit.

  • Can I download a spool file from ALV payroll recon report in Fixed Ascii?

    We have a process that imports the spool files from our various nightly payroll recon reports but have recently upgraded to ECC 6.0 and the ALV formatted report does not appear to create a fixed format spool file - the width of the columns changes from spool to spool based on the contents.
    Does anyone know how to accomplish our need?
    Thanks,
    DeWayne

    Does the printer show up in the Windows Printers folder?  We've used PDF995 or Cute pdfwriter for years.  All of these create virtual windows printers.  When you print to them, a dialog box pops up asking for the filename for the pdf.  If you have Activex calls to Excel in order to open a file, you should be able to make ActiveX calls to print it to a print driver such as this.  I don't know if any of these drives have a way to bypass the filename dialog box.  That may take some research and experimentation.  I don't know where the postscript file comes into play in the scenario you are describing.

  • Add comments to a spool file

    Is there any way to add comments to a spool file? Below is the typical output I have. I'd like to add comments to let me know what table has been updated or analyzed.
    Table altered.
    708662 rows updated.
    Commit complete.
    Index created.
    Table analyzed.
    Table altered.
    Index created.
    Table analyzed.
    Commit complete.

    Perhaps you are looking for the PROMPT command?
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1010446

  • Download spool and convert it to pdf in background job

    Hello experts,
    RSTXPDFT4 works fine for me if i want to convert spools to pdf files in foreground mode.
    If i want to do this in background mode as a daily job i am not able to use RSTXPDFT4.
    With report RSTXPDFT5 i am able to download in background as binary data but not as pdf.
    So, i want to download spools to network shared folder in pdf formaat.
    Thanks for suggestions & Regards
    Janez

    If i use GUI_DOWNLOAD which is used in this function than i have to be loged on and file is saved in my sapworkdir on my computer and not on networh share.
    To create and save TXT file on network shared folder i have to use opendataset statement and write data in file. But i don't know how to use it or to implement it in program RSTXPDFT4 to save spool job with specific id as pdf file. If i pass spool job id to RSTXPDFT4 i can save pdf file on local drive inside of sapworkdir or any where on clien computer nd of course in dialog mode.
    I want to save specific spool job with specific spool ID in background mode on network folder.
    Thanks & Regards
    Janez

  • Save Spool File to Local PC

    Hi there,
    We have run our P60 program which has created a spool file which can be seen
    in SP01 as a PDF file.
    When I go into the menu SPOOL REQUEST => Forward => the save as local file is greyed out :
    I need to download this file to my local PC.
    Does anybody know how to do this.
    Thanks
    Andy

    Hello,
    It is a very simple process.
    Go to SP01, and select the spool number which you want to save as PDF.
    Follow the below path:
    Goto-->Display Requests-->Content
    this will show the content which is to be printed using this spool number.
    Then type PDF! ( exclamation mark) which will give a pop up like screen to you. This is actually a PDF preview.
    Navigate your mouse toward the below part of the screen and a save button will come. You can now save the file.
    Regards,
    Hrishav

  • Problem downloading spool data

    Hi,
    We have a requirment wherein we need to print chinese text in the script.We are facing problem while downloading the file from the spool(SP02).The chinese text is showing up perfectly in the spool but when we download it,and open it,it shows junk characters..is there any setting to be done in SAP?
    Thanks..

    hii rakesh
    The logic to build SAP Script and Smart form of all languages will be same. But while working on Asian language please take care of the following points.
    1 Make sure you logon to SAP in CHINESE language only.
    2 At the Operating system level install the hungarian language.[Control panel - >Regional and language Option - >language Tab - > Click on Install Files for East Asian languages] If these language already installed then click on Detail and add the  CHINESE languages .
    3 At SAP level click on Customizing of Local layout[Alt+F12] and click on options.Go to tab I18N and click on Activate the multi-byte functionalities to support check box.
    4.Take care of the Font while assigning to Character formar or paragraph format. Dont use normal font name.
    USE  CHINESE FONT
    REGARDS
    Naresh

  • Is there any  function module to download pdf file

    is there any  function module to download pdf file
    WITH OUT GUI_DOWNLOAD FUNCTION MODULE.
    THANKS IN ADVANCED.

    Dear Laxman,
    Tryout the following Function Modules:
    (1)  CONVERT_ABAPSPOOLJOB_2_PDF --> convert abap spool output to PDF
    (2)  CONVERT_OTF --> Convert SAP documents (SAPScript) to other types.
    Example:
    CALL FUNCTION "CONVERT_OTF"
           EXPORTING    FORMAT                = "PDF"
           IMPORTING    BIN_FILESIZE          = FILE_LEN
           TABLES       OTF                   = OTFDATA
                        LINES                 = PDFDATA
           EXCEPTIONS   ERR_MAX_LINEWIDTH     = 1                  
                        ERR_FORMAT            = 2
                        ERR_CONV_NOT_POSSIBLE = 3
                        OTHERS                = 4.
    Regards,
    Abir
    Don't forget to award Points *

  • How to read spool file and get the spool file number

    Hey everyone.
    I created a program ztemp that is calling another program ztemp2 within, ztemp2 creates a spool file. Now the requirement is I need to write a code within ztemp to download that spool request and then convert it to the pdf file. I know I can use program rstxpdft4 to convert the spool file to the PDF but for this I need to give the spool number, so can you please tell me how can I get the spool number and then fetch it to the program rstxpdft4 .
    Thank you.
    Rhul goel

    Hi,
       Please check the [link|Convert ABAP List to PDF and display without downloading first; (Rich's reply) and get the spool similarly.
    Or read from table TSP01 to get the latest spool using sy-uname.
    Regards,
    Srini.

  • Extraction of oracle pkg and pkg bodies into spool file??

    Hi,
    I need to extract all packages and its bodies into spool file. can you give me script or guide how to do this.. i have more than 200 packages.. need to create spool file for each package. great thanks for help.
    /mr
    Edit/Delete Message

    From 10g, DBMS_METADATA is designed for ! :)
    [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414]
    Edited by: Leo Anderson on 1 sept. 2008 14:22

  • Downloading spool requests

    I have a requirement to download 1600 pages of spool request instead of printing it.
    The issue we have is the timeout when we are downloading it from SP01.
    Is there anyway i can download from SAP to a local file either in excel or as a PDF file.

    Hi Vijay,
    You can download the spool to file at SP01 -> Mark the spool request to download the click on Spool request -> Forward -> Save to local file
    If the request time out you can increase parameter rdisp/max_wprun_time but this will require a system restart and probably once you have downloaded the file you'll need to return the parameter value to the previous one as it can potentially cause performance problems if left with large value.
    regards
    Juan
    Please reward with points if helpful

  • Error while downloading a file via APEX screen

    While I try to download a file using the below code;
    an HTTP 404 error is coming although the proc is being called and the parameter is correctly being passed.
    Please help.
    create or replace procedure download_myfile1(p_id in number)
    as
    v_mime varchar2(255);
    v_length number;
    v_file_name varchar2(2000);
    Lob_loc BLOB;
    BEGIN
    -- -- Selecting the details from the table whoch contains the extracts
    select EXTRACT_FILE,FILE_NAME,dbms_lob.getlength(EXTRACT_FILE) into lob_loc,v_file_name,v_length from table_name where ID = p_id;
    -- -- set up HTTP header
    -- -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( 'application/octet', FALSE );
    -- set the size so the browser knows how much to download
    --v_file_name := substr(v_file_name,1,instr(v_file_name,'.')-1);
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="'||v_file_name|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( lob_loc );
    end download_myfile1;
    It shows a POP up window by which u can save or opens the file. But no pop up displayed in this case.
    -Shreya

    Hi,
    Made the same changes but still getting the same error.
    The earlier URL also that I had mentoned would dynamically make this url mentioned by you and then shows the pop up window.
    However when I am right clicking on the download link and then clicking 'Save target as' then this error message is provided:
    Internet Cannot download [schema name].download_myfile2 from [DNS name]
    Internet Explorer was not able to open this Internet Site.The requested site is either unavailable or cannot be found .Please try again.
    Please help..
    Thanks in Advance ...
    Shreya
    Edited by: 935203 on Jul 9, 2012 11:58 PM

Maybe you are looking for