How to print the spool request with a given file name.

Dear Experts;
I used FM RSPO_OUTPUT_SPOOL_REQUEST to print spool request. And the device type is a local pdf printer. By default, the download file name will be the spool id. How can I change the download file name? Thanks!
Convert 'CutePrinter' to qualify the format.
  CALL FUNCTION 'CONVERSION_EXIT_SPDEV_INPUT'
    EXPORTING
      input  = 'CutePrinter'
    IMPORTING
      output = lv_device.
Downloading as pdf by printer
  CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
    EXPORTING
      device                         = lv_device
      spool_request_id               = pa_spool
   EXCEPTIONS
     archive_dest_invalid           = 1
     archive_dest_not_found         = 2
     archive_dest_no_right          = 3
     cannot_archive                 = 4
     change_archdest_no_right       = 5
     change_copies_no_right         = 6
     change_dest_no_right           = 7
     change_devtype_no_right        = 8
     change_prio_no_right           = 9
     change_telenum_no_right        = 10
     change_title_no_right          = 11
     dest_invalid                   = 12
     dest_not_found                 = 13
     dest_no_right                  = 14
     internal_problem               = 15
     invalid_fax_attribute          = 16
     invalid_parameters             = 17
     non_owner_no_right             = 18
     no_layout                      = 19
     no_spool_request               = 20
     out_again_no_right             = 21
     spooler_problem                = 22
     OTHERS                         = 23

SELECT SINGLE * FROM tsp01 into rq WHERE rqident = p_spool  .
*   To get attributes of spool request
CALL FUNCTION 'RSPO_GET_ATTRIBUTES_SPOOLJOB'
    EXPORTING
      rqident     = p_spool             "Spool Request Number
    IMPORTING
      rq          = rq                                 "Consists the Spool Document Type Details
    TABLES
      attributes = dummy
    EXCEPTIONS
      no_such_job = 1
      OTHERS      = 2.
  IF sy-subrc <> 0.
  ENDIF.
*Convert spool request into PDF, dependent on document type
IF rq-rqdoctype = 'OTF' OR rq-rqdoctype = 'SMART'.    "Doc Type is of Sap Script or Smart form
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spool               "Spool Request Number
        no_dialog                = 'X'
        pdf_destination          = 'X'
        no_background            = 'X'
      IMPORTING
        pdf_bytecount            = bin_size
        bin_file                 = pdf_xstring                  "This fm will convert the spool data into
     TABLES
        pdf                      = it_pdf   .                                                                       "PDF Format in this importing string
  ELSEIF rq-rqdoctype = 'LIST'.                 "Doc Type of List
* Convert spool to PDF
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spool               "Spool Request Number
        no_dialog                = ' '
        dst_device               = 'LOCL'
        pdf_destination          = 'X'
        no_background            = 'X'
      IMPORTING
        pdf_bytecount            = bin_size
        bin_file                 = pdf_xstring                     "This fm will convert the spool data into
                                                                              "PDF Format in this importing string
      TABLES
        pdf                      = it_pdf.
    ENDIF.
*      Downloading file to p_file loation in PDF foramt
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize            = bin_size
          filename                = w_filename     "Custom File name
          filetype                = 'BIN'
        TABLES
          data_tab                = it_pdf
Prabhudas

Similar Messages

  • How to see the spool request number

    hi experts,
    how to see the spool request number of any object......
    may be form or report........

    U can go to SP01/SP02.
    For generating spool u can look into this code.
    FORM write_to_spool.
      DATA : l_f_list_name LIKE pri_params-plist,
             l_f_destination LIKE pri_params-pdest,
             l_f_spld LIKE usr01-spld,
             l_f_layout LIKE pri_params-paart,
             l_f_line_count LIKE pri_params-linct,
             l_f_line_size LIKE pri_params-linsz,
             l_f_out_parameters LIKE pri_params,
             l_f_valid.
      l_f_line_size = 255.
      l_f_line_count = 65.
      l_f_layout = 'X_65_255'.
      l_f_list_name = sy-repid.
    to get defult spool device for the user
      SELECT SINGLE spld INTO l_f_spld FROM usr01 WHERE bname = sy-uname.
      IF sy-subrc = 0.
        MOVE l_f_spld TO l_f_destination.
      ENDIF.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            ARCHIVE_ID             = C_CHAR_UNKNOWN
            ARCHIVE_INFO           = C_CHAR_UNKNOWN
            ARCHIVE_MODE           = C_CHAR_UNKNOWN
            ARCHIVE_TEXT           = C_CHAR_UNKNOWN
            AR_OBJECT              = C_CHAR_UNKNOWN
            ARCHIVE_REPORT         = C_CHAR_UNKNOWN
            AUTHORITY              = C_CHAR_UNKNOWN
            COPIES                 = C_NUM3_UNKNOWN
            COVER_PAGE             = C_CHAR_UNKNOWN
            DATA_SET               = C_CHAR_UNKNOWN
            DEPARTMENT             = C_CHAR_UNKNOWN
               destination            = l_f_destination
            EXPIRATION             = C_NUM1_UNKNOWN
               immediately            = 'X'
            IN_ARCHIVE_PARAMETERS  = ' '
            IN_PARAMETERS          = ' '
               layout                 = l_f_layout
               line_count             = l_f_line_count
               line_size              = l_f_line_size
               list_name              = l_f_list_name
            LIST_TEXT              = C_CHAR_UNKNOWN
            MODE                   = ' '
            NEW_LIST_ID            = C_CHAR_UNKNOWN
            NO_DIALOG              = C_FALSE
            RECEIVER               = C_CHAR_UNKNOWN
            RELEASE                = C_CHAR_UNKNOWN
            REPORT                 = C_CHAR_UNKNOWN
            SAP_COVER_PAGE         = C_CHAR_UNKNOWN
            HOST_COVER_PAGE        = C_CHAR_UNKNOWN
            PRIORITY               = C_NUM1_UNKNOWN
            SAP_OBJECT             = C_CHAR_UNKNOWN
            TYPE                   = C_CHAR_UNKNOWN
            USER                   = SY-UNAME
          IMPORTING
            OUT_ARCHIVE_PARAMETERS =
               out_parameters         = l_f_out_parameters
               valid                  = l_f_valid
          EXCEPTIONS
               archive_info_not_found = 1
               invalid_print_params   = 2
               invalid_archive_params = 3
               OTHERS                 = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      IF l_f_valid NE space.
        NEW-PAGE PRINT ON PARAMETERS l_f_out_parameters.
        WRITE : /5 'Material No.',
                 25 'Message Type',
                 40 'Message Issued'.
        ULINE.
        LOOP AT g_t_message_table WHERE type = 'E'.
          WRITE : / g_t_message_table-matnr UNDER 'Material No.',
                    g_t_message_table-type UNDER 'Message Type',
                    g_t_message_table-message UNDER 'Message Issued'.
        ENDLOOP.
        NEW-PAGE PRINT OFF.
      ENDIF.
    ENDFORM.                    " WRITE_TO_SPOOL
    Regards

  • How to print the list outout with out getting output?

    How to print the list outout with out getting output?
    My requirement is that when i exicute the program the list output has to print with out getting output list display on the screen.
    if possible cana anyone share the code....
    Phani,

    See this Sample Program.
    DATA: PARAMS LIKE PRI_PARAMS,
          DAYS(1)  TYPE N VALUE 2,
          COUNT(3) TYPE N VALUE 1,
          VALID    TYPE C.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING DESTINATION           = 'LT50'
                COPIES                = COUNT
                LIST_NAME             = 'TEST'
                LIST_TEXT             = 'SUBMIT ... TO SAP-SPOOL'
                IMMEDIATELY           = 'X'
                RELEASE               = 'X'
                NEW_LIST_ID           = 'X'
                EXPIRATION            = DAYS
                LINE_SIZE             = 79
                LINE_COUNT            = 23
                LAYOUT                = 'X_PAPER'
                SAP_COVER_PAGE        = 'X'
                COVER_PAGE            = 'X'
                RECEIVER              = 'SAP*'
                DEPARTMENT            = 'System'
                NO_DIALOG             = ' '
      IMPORTING OUT_PARAMETERS        = PARAMS
                VALID                 = VALID.
    IF VALID <> SPACE.
      SUBMIT RSTEST00 TO SAP-SPOOL
        SPOOL PARAMETERS PARAMS
        WITHOUT SPOOL DYNPRO.
    ENDIF.
    Awrd POints If useful
    Bhupal

  • How to get the spool request number ?

    Hi All,
    I am working on a smart-forms. I am using a custom transaction to print these smartforms. When I execute
    the transaction the print screen comes where I can do
    print preview or print.
    Now to convert this Smart Form to PDF I need to know the spool request number to use in the report called RSTXPDFT5.
    How do I get the spool request number ?
    Do I need to do some changes in spool control options of print screens to get the spool request number or something else ?
    Please let me know.
    Answers will be awarded...
    Tushar

    Hi,
    You will get the spool no. in the parameter "job_output_info" after calling the smartform function module in print program. The spool ids of the prints is stored in table job_output_info-SPOOLIDS.
    Regards,
    Gagan

  • How to know the spool requests generated from my program?

    hi
         I want to get the spool request(s) that are generated from my report that's run either in foreground or background? how to know this? i know that we can go to sm37 and see, but is there any table or fm which stores this data? if i give my program name that's run on a particular date, i should get the spool request numbers. tsp01 only has the spool no. and not the program name..pl suggest...thanks all
    Sathish. R

    Hi ,
    The system field sy-spono contains the spool numbers .
    If you have such requirement, you can create one custom table with fields :
    spool no, program , date , time
    whenever you run ur program update this table ,
    with system fields . spono , sy-repid , sy-datum and sy-uzeit .
    Thaks .

  • How to genrate the spool request for the smart form.

    Hi Friends,
    I have a page to FAX to vendor for which i have made a smartform for the page to be send. For this purpose i have to genrate the spool request without displaying the output of the smartform. The program should give the spool number genrated.
    can you please suggest somthing.
    Regards,
    Vidya.

    hi
    for this when u r callin the form write some code in u r program
    IF RADIOBUTTON = 'X' .     "GET THE SPOOL
    CONTROL_PARAMETERS-NO_DIALOG = 'X'.
    ELSE.
    CONTROL_PARAMETERS-NO_DIALOG = ' '.
    ENDIF.
    and pass this to the calling form.
    Please Close this thread.. when u r problem is solved. Reward if Helpful
    Regards
    Naresh Reddy K

  • How to print the mirror image of a pdf file?

    Hi,
    Does anyone know if it is possible to print the mirror image of a pdf file? I could have sworn I have done this before in an older version of Acrobat.
    I am currently working with Adobe Acrobat 8.0 Professional.
    Thank you,
    Tina

    I just tested this and it worked fine for me.
    When you select to print the cropped page, in the print dialog will be a thumbnail of what is about to be printed. Does this display just the cropped portion or the whole page?

  • How to delete the spool request number

    HI Masters,
                My program creates a spool request. And i want to delete that spool request number? How to delete that??
                  Thanks in advance.

    hi
    good
    The program are RSPO0041 or RSPO1041.
    This is handy whenever you encounter a user who managed to create a lot of spool requests which are choking your system.
    Deleting them with SP01 will be too slow and you will get time out if it exceed the online time limit specify by your basis people.
    <b><REMOVED BY MODERATOR></b>
    thanks
    mrutyun^
    Message was edited by:
            Alvaro Tejada Galindo

  • How to print the swing frame with muliple panel into 2 pages

    Hi all,
    I want your help, I have one problem in printing swing component. I can print the swing component from the screen.
    my problem is in my page have textboxes, and jtable. jtable display data from the database, i want to proceed the jtable to next page until the last row printed and visible . after that i want to print the text component and other component can anybody help me please.

    hello everyone i'm new to this forum..how are you all...
    Jack Brosnan
    [mobile phone|http://www.mobilephonesforsale.net.au/apple-iphone-f-2.html]

  • How to print the Form and all its attached files

    Hello,
    I have a form created with Designer 7.0.7. I have extended the form to allow the data to be saved with the form, allow attachments, and allow printing of the form. What would like to do is to add a button to print the from and all of its attached files. If anyone has any samples I would greatly appreciate them.
    What I really needed to do was to insert/append a PDF file but this is not supported by the designer.
    Thanks,
    -Yolanda

    Hi Yolanda,
    I need to do the same in my form. Would you mind let me know if you found any solution. Appreciate if you can share some code.
    Thanks in advance,
    SekharN

  • How to export a report data with a custom file name?

    Hello:
    Env: OBIEE 11g Answers/Interactive Dashboards
    I have a tabular report (built in Answers) and displayed in a Dashboard. I want to export the report data in csv format prefixed with the <OBIEE user login name>_<Name of the Report>_<current timestamp> on a certain folder.
    Any ideas appreciated..
    Thanks
    Sankar Bala
    Edited by: 589151 on Mar 7, 2012 6:14 AM

    This does not help solve my problem.
    Tabular Report->Place it in a section in a dashboard->Report Links (Export Option turned on). When doing the export, I want to change the file name as the <Login Name>_<File Name>_<Time Stamp>.csv when doing the export into csv from the dashboard.
    Regards
    Sankar

  • Printing multiple spool requests at a time

    Hi All,
    I am using function module RSPO_OUTPUT_SPOOL_REQUEST to print the contents of the spool request. I want to print multiple spool requests at a time. We can input only one spool request number to the above function module at a time. Is there any way that I can print multiple spool requests with only single Print Popup Window ?
    Thanks.

    Hi Khanna,
    I tried that option at first place only. It results in multiple Print Popups. I want to avoid this. For all spool print requests, I want to show ONLY ONE Print Popup.
    Thanks.

  • Splitting the Spool Request for Form Printing

    Hello,
    I have a requirement where I need to print data for 1500 employees (1 Page per employee) which makes 1500 pages per spool request. Now, there is a change in the printer due to which the printer only accepts only 300 pages in the buffer. So, after printing 300 pages, it stops. Is there any way I can split the spool request and generate 5 spool requests (1 request for every 300 pages) so that all the pages are printed at once? Please let me know.
    Regards,
    Venkata Phani Prasad Konduri

    i have created a program using which you can create multiple pdf from a single spool number
    first in the code below i have taken a spool number which has 2 pages in it.
    second you must use the FM : RSPO_RETURN_SPOOLJOB  in the program to get the content of the spool .  while to perform analysis on how to build logic to split the spool otf/pdf user the FM RSPO_DISPLAY_SPOOLJOB, here by passing the spool number you will get the content in display mode and then based on the keyword you will build logic for e.g in my case i have to perform segregation based on material number so it can be used to decide how many pages are reserved by a specific material number.
    another important point to kept in mind is that otf begins with "//"  and a page ends with "EP" and last page ends with  "//" along with "EP". It can be used to remove the number of lines to keep specific pages .
    program layout as with proper documentation has been provided.
    REPORT  zdk_spool_split.
    * DATA DECLARATION.
    TYPES : tbuf LIKE tline OCCURS 1.
    FIELD-SYMBOLS: <buf> TYPE tbuf.
    FIELD-SYMBOLS : <lit_otf> TYPE ANY TABLE.
    DATA : lit_otf TYPE STANDARD TABLE OF itcoo.
    DATA : objcont LIKE soli  OCCURS 0 WITH HEADER LINE.
    DATA : format(5) TYPE c, dummy TYPE i.
    DATA : buffer_pdf TYPE STANDARD TABLE OF tline.
    DATA : p_file LIKE rlgrap-filename VALUE 'C:\temp\file1.pdf'. "#EC NOTEXT
    DATA : numbytes TYPE i VALUE 255.
    DATA : cancel.
    DATA : otfcmd LIKE itcoo VALUE '//'.
    DATA : pdfcnv_archive_index LIKE toa_dara.
    DATA : bin_file TYPE xstring,
            pdf_username TYPE c.
    * GET THE SPOOL NUMBER FROM THE USER.
    PARAMETERS : p_sid TYPE tsp01-rqident OBLIGATORY.
    * GET THE CONTENT OF THE SPOOL NUMBER
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
       EXPORTING
         rqident              = p_sid
       TABLES
         buffer               = objcont
       EXCEPTIONS
         no_such_job          = 1
         job_contains_no_data = 2
         selection_empty      = 3
         no_permission        = 4
         can_not_access       = 5
         read_error           = 6
         type_no_match        = 7
         OTHERS               = 8.
    IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * INCORPORATE YOUR LOGIC TO DELETE LINES WHICH ARE NOT REQUIRED.
    * IN MY CASE I HAVE REMOVED LINES FROM 351 TO 715 TO REMOVE THE SECOND PAGE FROM MY SPOOL
    * MY OBJCONT AFTER DELTED BEGINS WITH "//" AND ENDS WITH "EP" AND "//"
    DELETE objcont[] FROM 351 TO 715.
    * IT ONLY CONTAINS ONE PAGE OUT OF 2 PAGES FROM THE SPOOL NUMBER I HAVE PROVIDED.
    * CONVERT OTF TO PDF
    lit_otf = objcont[]. " GET THE OTF IN CORRECT OTF FORMAT
    ASSIGN buffer_pdf TO <buf>.
    format = 'PDF'. " CHOOSE THE CORRECT FORMAT IE PDF MUST FOR CONVERSION
    CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
         format                = format
       IMPORTING
         bin_filesize          = dummy
       TABLES
         otf                   = lit_otf
         lines                 = <buf>
       EXCEPTIONS
         err_max_linewidth     = 1
         err_format            = 2
         err_conv_not_possible = 3
         OTHERS                = 4.
    IF sy-subrc IS NOT INITIAL.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * GET THE NUMBYTES OF THE PDF CONTENT OBTAINED AFTER THE CONVERSION
    * CORRECT NUMBYTE IS VERY IMPORTANT OTHERWISE IT WILL NOT GENERATE
    * PDF IN CORRECT FORMAT.
    PERFORM convert_otf2pdf_end(rstxcpdf) TABLES <buf>
                                           USING otfcmd
                                                 numbytes
                                                 pdfcnv_archive_index
                                                 bin_file
                                                 pdf_username.
    * NOW DOWNLOAD THE PDF TO VIEW IN ACTUAL PDF AT DESIRED PATH
    PERFORM download_w_ext(rstxpdft) TABLES <buf>
                                      USING p_file
                                            '.pdf'
                                            'BIN'
                                            numbytes
                                            cancel.

  • Simple Request - How Do I Print a Spool Request in 3.1i?

    Here is the scenario:
        I have created an FI Misc Credit Memo for a customer who wants a hard copy of the document. Using transaction code FB12, I generate a correspondence. Then using transaction code F.64, I attempt to print the document. This generates a spool request with a number like 86,007.
    From there I go to system>services>output control which takes me to the spool request screen. From there, I am missing the next step.
    This screen has fields for:
    Spool request number (attempted number given when spool request was generated - 86,007, field only fits 5 characters so comma has been excluded)
    Spool request name ( I think this is my problem as I have no idea where to find this)
    User name (field is populated)
    From date  (field is populated)
    Client  (field is populated)
    Output device (have entered desired printer name)
    Format (usually self-populates once a successful print request is entered)
    Title (unnecessary field I believe)
    Recipient (unnecessary field)
    Department (unnecessary field)
    No one on our staff has been able to help me with this issue so I've turned to the community. I am an end user (Tax Analyst) who possesses little technical knowledge. My apologies. Thank you in advance for any help given!

    Hello,
    remove values from all the fields in the selection screen and enter only your spool number. The Execute wiht 'F8' and if the spool request is found, with the "printer" push-button you can print it.
    Best regards,
    Andrea

  • How to send as an email the spool request?

    Dear Experts,
    My last post was Email background schedule report to gmail or yahoo mail .
    I got solution but it's work as a notification which we can say the after report run it triggers mail that report is completed as this time.
    But i required the thing how to send a spool request of a report  as an email attachment.
    it will be in .xls or .pdf or xyz format.
    It was the additional task which was required by my organization.
    I also want to know the following things.
    1. what is sap default configuration and system behind it.
    2. what the things abaper have to check.
    3. what is bcs_examples & where do i found these bcs_example8.
    Please guide me to explore my knowledge.
    Thanks & regards
    Nayan Lad
    Note for moderator : Sir, I will close request at 2:30 pm today onward, so please do not lock it.
    Moderator Message: All your questions can be answered by searching.
    Edited by: kishan P on Nov 13, 2010 3:29 PM

    need solution..

Maybe you are looking for