Mass printing of spool requests

Hi,
Is it possible to program the triggering of the printing of a PDF document contained in a spool request ? ( the goal is to have the possibility for mass printing )
thanks,
Rolf

Hi rolf here is the program to convert to PDF and mail it .
*& Report  ZSPOOLTOPDFT                                             *
*& Converts spool request into PDF document and emails it to           *
*& recipicant.                                                         *
*& Execution                                                           *
*& This program can be run in background or online and a spool request *
*& will still be created                                               *
report  zspooltopdft                            .
parameter: p_email1 like somlreci1-receiver
                                    default 'sandeep2jinnagmailcom',
           p_delspl  as checkbox,
           p_online no-display.
*DATA DECLARATION
data: gd_recsize type i.
Spool IDs
types: begin of t_tbtcp.
        include structure tbtcp.
types: end of t_tbtcp.
data: it_tbtcp type standard table of t_tbtcp initial size 0,
      wa_tbtcp type t_tbtcp.
Job Runtime Parameters
data: gd_eventid like tbtcm-eventid,
      gd_eventparm like tbtcm-eventparm,
      gd_external_program_active like tbtcm-xpgactive,
      gd_jobcount like tbtcm-jobcount,
      gd_jobname like tbtcm-jobname,
      gd_stepcount like tbtcm-stepcount,
      gd_error    type sy-subrc,
      gd_reciever type sy-subrc.
data:  w_recsize type i,
       w_spool_nr like sy-spono.
      %_print LIKE pri_params.
data: gd_subject   like sodocchgi1-obj_descr,
      it_mess_bod like solisti1 occurs 0 with header line,
      it_mess_att like solisti1 occurs 0 with header line,
      gd_sender_type     like soextreci1-adr_typ,
      gd_attachment_desc type so_obj_nam,
      gd_attachment_name type so_obj_des.
Spool to PDF conversions
data: gd_spool_nr like tsp01-rqident,
      gd_destination like rlgrap-filename,
      gd_bytecount like tst01-dsize,
      gd_buffer type string.
Binary store for PDF
data: begin of it_pdf_output occurs 0.
        include structure tline.
data: end of it_pdf_output.
constants: c_dev like  sy-sysid value 'DEV',
           c_no(1)     type c   value ' ',
           c_device(4) type c   value 'LOCL'.
*START-OF-SELECTION.
start-of-selection.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
  write 'Hello World'.
  new-page.
  commit work.
  new-page print off.
  if p_online = 'X'.
  Processing performed when program calls itself when run online
    gd_spool_nr = sy-spono.
    export gd_spool_nr to memory id 'SPOOLTOPDF'.
    exit.
  endif.
  if sy-batch eq 'X'.
    perform get_job_details.
    perform obtain_spool_id.
  else.
    gd_spool_nr = sy-spono.
If executed online, it submits a program to perform the write statements
instructing it to create a spool request, this could be another program
which just performs the write statements and then exports sy-spono
to memory. But in this example it calls itself passing X to parameter
p_online, which takes it down an alternative procesing path.
    submit zspooltopdf2
           with p_online = 'X'
           to sap-spool
           spool parameters   %_print
          archive parameters %_print
           without spool dynpro
           and return.
  endif.
Get spool id from program called above
  import gd_spool_nr from memory id 'SPOOLTOPDF'.
  perform convert_spool_to_pdf.
  perform process_email.
  if p_delspl eq 'X'.
    perform delete_spool.
  endif.
  if sy-sysid = c_dev.
    wait up to 5 seconds.
    submit rsconn01 with mode   = 'INT'
                    with output = 'X'
                    and return.
  endif.
      FORM obtain_spool_id                                          *
form obtain_spool_id.
  check not ( gd_jobname is initial ).
  check not ( gd_jobcount is initial ).
  select * from  tbtcp
                 into table it_tbtcp
                 where      jobname     = gd_jobname
                 and        jobcount    = gd_jobcount
                 and        stepcount   = gd_stepcount
                 and        listident   <> '0000000000'
                 order by   jobname
                            jobcount
                            stepcount.
  read table it_tbtcp into wa_tbtcp index 1.
  if sy-subrc = 0.
    message s004(zdd) with gd_spool_nr.
    gd_spool_nr = wa_tbtcp-listident.
    message s004(zdd) with gd_spool_nr.
  else.
    message s005(zdd).
  endif.
endform.
      FORM get_job_details                                          *
form get_job_details.
Get current job details
  call function 'GET_JOB_RUNTIME_INFO'
       importing
            eventid                 = gd_eventid
            eventparm               = gd_eventparm
            external_program_active = gd_external_program_active
            jobcount                = gd_jobcount
            jobname                 = gd_jobname
            stepcount               = gd_stepcount
       exceptions
            no_runtime_info         = 1
            others                  = 2.
endform.
      FORM convert_spool_to_pdf                                     *
form convert_spool_to_pdf.
  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
       exporting
            src_spoolid              = gd_spool_nr
            no_dialog                = c_no
            dst_device               = c_device
       importing
            pdf_bytecount            = gd_bytecount
       tables
            pdf                      = it_pdf_output
       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.
  check sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
  loop at it_pdf_output.
    translate it_pdf_output using ' ~'.
    concatenate gd_buffer it_pdf_output into gd_buffer.
  endloop.
  translate gd_buffer using '~ '.
  do.
    it_mess_att = gd_buffer.
    append it_mess_att.
    shift gd_buffer left by 255 places.
    if gd_buffer is initial.
      exit.
    endif.
  enddo.
endform.
      FORM process_email                                            *
form process_email.
  describe table it_mess_att lines gd_recsize.
  check gd_recsize > 0.
  perform send_email using p_email1.
perform send_email using p_email2.
endform.
      FORM send_email                                               *
-->  p_email                                                       *
form send_email using p_email.
  check not ( p_email is initial ).
  refresh it_mess_bod.
Default subject matter
  gd_subject         = 'Subject'.
  gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
  it_mess_bod        = 'Message Body text, line 1'.
  append it_mess_bod.
  it_mess_bod        = 'Message Body text, line 2...'.
  append it_mess_bod.
If no sender specified - default blank
  if p_sender eq space.
    gd_sender_type  = space.
  else.
    gd_sender_type  = 'INT'.
  endif.
Send file by email as .xls speadsheet
  perform send_file_as_email_attachment
                               tables it_mess_bod
                                      it_mess_att
                                using p_email
                                      'Example .xls documnet attachment'
                                      'PDF'
                                      gd_attachment_name
                                      gd_attachment_desc
                                      p_sender
                                      gd_sender_type
                             changing gd_error
                                      gd_reciever.
endform.
      FORM delete_spool                                             *
form delete_spool.
  data: ld_spool_nr type tsp01_sp0r-rqid_char.
  ld_spool_nr = gd_spool_nr.
  check p_delspl <> c_no.
  call function 'RSPO_R_RDELETE_SPOOLREQ'
       exporting
            spoolid = ld_spool_nr.
endform.
*&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
      Send email
form send_file_as_email_attachment tables it_message
                                          it_attach
                                    using p_email
                                          p_mtitle
                                          p_format
                                          p_filename
                                          p_attdescription
                                          p_sender_address
                                          p_sender_addres_type
                                 changing p_error
                                          p_reciever.
  data: ld_error    type sy-subrc,
        ld_reciever type sy-subrc,
        ld_mtitle like sodocchgi1-obj_descr,
        ld_email like  somlreci1-receiver,
        ld_format type  so_obj_tp ,
        ld_attdescription type  so_obj_nam ,
        ld_attfilename type  so_obj_des ,
        ld_sender_address like  soextreci1-receiver,
        ld_sender_address_type like  soextreci1-adr_typ,
        ld_receiver like  sy-subrc.
data:   t_packing_list like sopcklsti1 occurs 0 with header line,
        t_contents like solisti1 occurs 0 with header line,
        t_receivers like somlreci1 occurs 0 with header line,
        t_attachment like solisti1 occurs 0 with header line,
        t_object_header like solisti1 occurs 0 with header line,
        w_cnt type i,
        w_sent_all(1) type c,
        w_doc_data like sodocchgi1.
  ld_email   = p_email.
  ld_mtitle = p_mtitle.
  ld_format              = p_format.
  ld_attdescription      = p_attdescription.
  ld_attfilename         = p_filename.
  ld_sender_address      = p_sender_address.
  ld_sender_address_type = p_sender_addres_type.
Fill the document data.
  w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name  = 'SAPRPT'.
  w_doc_data-obj_descr = ld_mtitle .
  w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
  clear w_doc_data.
  read table it_attach index w_cnt.
  w_doc_data-doc_size =
     ( w_cnt - 1 ) * 255 + strlen( it_attach ).
  w_doc_data-obj_langu  = sy-langu.
  w_doc_data-obj_name   = 'SAPRPT'.
  w_doc_data-obj_descr  = ld_mtitle.
  w_doc_data-sensitivty = 'F'.
  clear t_attachment.
  refresh t_attachment.
  t_attachment[] = it_attach[].
Describe the body of the message
  clear t_packing_list.
  refresh t_packing_list.
  t_packing_list-transf_bin = space.
  t_packing_list-head_start = 1.
  t_packing_list-head_num = 0.
  t_packing_list-body_start = 1.
  describe table it_message lines t_packing_list-body_num.
  t_packing_list-doc_type = 'RAW'.
  append t_packing_list.
Create attachment notification
  t_packing_list-transf_bin = 'X'.
  t_packing_list-head_start = 1.
  t_packing_list-head_num   = 1.
  t_packing_list-body_start = 1.
  describe table t_attachment lines t_packing_list-body_num.
  t_packing_list-doc_type   =  ld_format.
  t_packing_list-obj_descr  =  ld_attdescription.
  t_packing_list-obj_name   =  ld_attfilename.
  t_packing_list-doc_size   =  t_packing_list-body_num * 255.
  append t_packing_list.
Add the recipients email address
  clear t_receivers.
  refresh t_receivers.
  t_receivers-receiver = ld_email.
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  append t_receivers.
  call function 'SO_DOCUMENT_SEND_API1'
       exporting
            document_data              = w_doc_data
            put_in_outbox              = 'X'
            sender_address             = ld_sender_address
            sender_address_type        = ld_sender_address_type
            commit_work                = 'X'
       importing
            sent_to_all                = w_sent_all
       tables
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.
Populate zerror return code
  ld_error = sy-subrc.
Populate zreceiver return code
  loop at t_receivers.
    ld_receiver = t_receivers-retrn_code.
  endloop.
endform.

Similar Messages

  • 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.

  • Function module which can print from spool request ?

    Hi ,
    Is there any function module which can print from spool request ?
    Regards
    pabi

    I think NO.
    You have to take print from SP01.
    Amit.

  • Account statement printing - single spool requests

    Dear SAP experts,
    We would like to use print program RFKORD10 for correspondence type SAP06 (account statements for customers) to print account statements for a range of customers, so in mass processing. I see that the standard behaviour of the program is to put the output in 1 spool request.
    Is there any possibility to create a single spool request per account statement / customer? This would be helpful when converting spool requests to a PDF file, in order to send the statements by email.
    Regards,
    Mark

    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.

  • 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

  • Best practice for schedule printing of spool requests

    Hi there,
    I am searching for a method / best practice how to schedule the printing of different spool requests.
    The following situation:
    A lot of different spool requests are generated in the night, but they should be printed at a specific time in the morning. So I am searching for a method to get the spool requests and print them to a specific printer at a specific time by job.
    Thanks ahead,
    Bernd

    I found a (very old) SAP program RSPO0065 that seems to do just that. However it does not allow overriding the print paramters, so the actual jobs need be scheduled with the correct parameters, most notably the desired printer.
    Thomas

  • 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

  • ALV - print - create spool request

    Hi all,
    We have made SAP Query (The majority and 'was written in ABAP code), a report using ALV grid (function 'REUSE_ALV_GRID_DISPLAY'). There is a 'Print' button on the grid. If the user presses this button the system will send a screen where the user can choose print parameters (name of printer, printing, direct or not, etc..) If the user presses 'Continue' a spool request is then created.
    But the users do not want to see the screen parameters.
    After pressing the button 'Print' on the grid, the spool request should be immediately created using the parameters seted in the ABAP program, the same program that creates ALV.
    Any idea how to do this?
    Thanks in advance

    Hi,
    Please refer to the link to add button in the ALV tool bar:
    [http://www.sapalv.net/2009/07/sap-alv-tutorial-4-%E2%80%93-add-button-to-toolbar/]
    For creating spool on click of this pushbutton you can use the following:
    * Set the Spool Parameters
      DATA: lwa_params TYPE pri_params,
            lv_valid TYPE c.
      CLEAR: lwa_params, lv_valid.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          in_parameters          = lwa_params
          layout                 = 'X_65_132'
          line_count             = 65
          line_size              = 132
          no_dialog              = 'X'
        IMPORTING
          out_parameters         = lwa_params
          valid                  = lv_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
      IF sy-subrc EQ 0.
        NEW-PAGE PRINT ON PARAMETERS lwa_params NO DIALOG.
    *                  Write code for displaying the ALV here......
        NEW-PAGE PRINT OFF.
      ENDIF.
    Regards,
    Aparna Alashe.

  • Badi in printing - changing Spool request name

    Hello everyone!
    I'd like to dynamically change some of printer (printining) attributes, exactly I mean Spool request name (suffix2). I tried BADI definition EFG_PRINTPARAMS, but it looks it's not a proper one. Have maybe anyone some idea how to do that.
    Regards,
    Mariusz

    Hi Mariusz,
    Take a look at Function modules GET_PRINT_PARAMETERS and SET_PRINT_PARAMETERS.
    Mainly the structure PRI_PARAMS are to be used to collect and change printer and spool details.
    Regards,
    Rob.

  • MD01 printing immediately - spool request

    Dear,
    after running MD01, automatically scheduling agreement lines are printed. In the details of the spool request the checkbox "Print Immediately" is flagged. How can I avoid this field to be flagged?
    Thnx!

    Check in NACE transaction for the outputtype.Change the output condition record as per your requirement.

  • Not able to print to locl printer, spool request status is in wait

    Hi All,
    When user print to locl printer, the spool request is created and we get a error message saying "connection closed after (protocol) error (RC=1)". And we found the status of spool request is in wait state and if double clicked on it, it is showing "Internal error printing".
    Below is the log of Spool work process for your reference
    Found unqueued job 21701/1 (LOCL)
    ERROR => Printer LOCL: Lookup failed ?!?!? -> Status DELAY http://rspopcc. 0813
    Just to update you user is able to print all other documents except the documents from SAP application. And user is connecting to SAP application server through Citrix.
    We are on HP-UX, Oracle database and SAP R/3 3.1i version.
    Thanks in advance.
    Regards,
    Chandrika

    sundaresh suryanarayan wrote:
    Hello Chandrika,
    >
    > Is this printer is a network printer ?.   Use Device Type : SWIN and Access Method : G Front End Printing .  
    >
    > Thanks
    >
    > Sundaresh Suryanarayan
    Hi Sundaresh,
    Thanks for your reply.
    Yes it is a network printer. User is printing to his default printer(LOCL, with host printer __DEFAULT) and we are using  device type SAPWIN and access method F(printing on front end computer).
    Regards,
    Chandrika

  • Unable to send spool request to printer through BSP

    Hi Experts,
    We have an application build on BSP and provided a button called print in the application. When I press print, in our client requirement, an adobe with details should create a spool as well it should print the document automatically.
    Currently we some how managed to create a spool after pressing print but spool request is not going print automatically, its showing status as waiting with following error message
    "Frontend unavailable"
    Please help me out
    Thanks in advance
    Regards,
    Sridhar

    Hi,
    this will not work!
    If you print local, the GUI starts a local printing program. The browser is not able to start local programs, because of the restictions of Browsers.
    To use Networkprinter should work.
    Best regards
    Renald

  • OMJ3 configuration not picked up in spool request

    Hi all,
    I have configured the printer determination for an message output for 261 movements. When I check the testing data, one of the material doc, the message output shows the OMJ3 output type and printer being selected.
    However, when i go to the spool's request, the spool request picks up the printer defaulted in my user's profile(SU3 transaction) instead.
    When i remove the default printer in user's profile and perform a re-print, no spool request is created at all.
    Seems that the printing of the GI slip seems to bypass the configuration at all, but strangely the material doc is picking up the output type and printer correctly.
    Can anyone advise what could be the root cause for this? thanks.

    Hi
    1. check all the settings in NACE transaction for your Application & Condition/Output Type.
    2. Check Parameter, Printer, Parameter ID in SU3.
    3. Have you defined Print code in Mov Type, check that.
    4. & Condition Records
    Rgds

  • Pop problem while creating spool request in reuse_alv_grid_display

    Hi Experts,
    I am trying to create a spool request of alv
    and problem is that i do not want pop-up window for asking output devices,
    actually i am calling reuse alv in loop and following steps i have done:
    w_print-print = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_BYPASSING_BUFFER = 'X'
          I_CALLBACK_PROGRAM = SY-REPID
          IT_FIELDCAT         = FIELDCAT[]
          I_DEFAULT           = 'X'
          I_SAVE                = 'X'
          is_print                 = w_print
        TABLES
          T_OUTTAB           = T_FINAL
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Please give the solution.
    Thanks
    Pankaj

    Hi,
    Use FM GET_PRINT_PARAMETERS ,  and  use command NEW-PAGE PRINT ON PARAMETERS <wa_params> NO DIALOG. before calling the alv FM.
    ls_print-print = 'X'.
    DATA: lwa_params TYPE pri_params,
          lv_valid TYPE c.
    CLEAR: lwa_params, lv_valid.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        in_parameters          = lwa_params
        layout                 = 'X_65_132'
        line_count             = 65
        line_size              = 132
        no_dialog              = 'X'
      IMPORTING
        out_parameters         = lwa_params
        valid                  = lv_valid
      EXCEPTIONS
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        OTHERS                 = 4.
    MOVE-CORRESPONDING lwa_params TO ls_print-print_ctrl-pri_params.
    ls_print-print_ctrl-pri_params-pdest = 'LP01'. " your printr device
    NEW-PAGE PRINT ON PARAMETERS lwa_params NO DIALOG.
    then call FM CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
    this will work.
    refer link [ALV - print - create spool request;
    Regards,
    Ravi.

  • Print from spool

    Hi all,
        how can we print a spool request.
        All answers will be appreciated.
    Thanks,
    Prashanth

    Hi,
    Please use Tcode: SP01 for printing spool requests.
    You can give inputs like spool request number/username/From Date/Output Device etc to get the relevant spool request.
    Then select or check mark the relevant spool and click on the Print button available on the toolbar.
    Hope this helps.
    Thanks,
    Srinivas

Maybe you are looking for