Capturing spool number while submit report

Hi all,
Thanx for ur replies. I'm trying submit to spool. This wud suffice my req. But how to capture the spool number other than going to tsp01 as everythng happens in background. Ineed to further process the spool number. My code is
SUBMIT rkpep005 USING SELECTION-SET 'TEST1'
TO SAP-SPOOL
WITHOUT SPOOL DYNPRO
AND RETURN.

hi,
There are some system parameters which captures the spool number.
sy-spono -> Contains the name of the spool number during printing.
SY-PRDSN -> Contains the name of the spool file during printing.
Rgds,
Jothi.P
*Ps close the thread once you got the answer.
Those don't work with submits.
Regards,
John
Edited by: John Smith on Nov 30, 2010 3:40 PM

Similar Messages

  • Getting spool number after SUBMIT report statement

    Hello Everyone,
    Suppose there is a scenario, when 3 users are sharing same session and executing a program simultaneously.
    In the program, the users are submitting a program to sap spool such that a spool no is generated.
    and based on that spool no, the users read its log...
    How will we identify that which spool no belongs to which particular session so that the the user will read its own loag and not the other person/'s log...

    Hi,
    The program can be submitted as a job which has a unique job number and accordingly spool number will be generated which can read.
    See code e.g below:
    DATA: number TYPE tbtcjob-jobcount,
          name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    Hope it helps.
    Regards,
    Mansi.

  • Create spool number from the report program

    Hello,
    I want to know the function module to create the spool request from report program, through which I can write the content of the internal table to spool.
    Thanks,
    Lucky

    Hi Lucky ,
    you will have to use 3 function modules in sucession to create a spool request as follows :
    JOB_OPEN
    JOB_SUBMIT
    JOB_CLOSE
    In case of any problem please get back to me.
    Regards,
    Nikhil

  • Hwo to get the spool number from report output

    Hi,
    I am displaying some output in the report using write statements and within my program I need to collect the output written by write statements and send it as an email.So for that I need to generate the spool number and I am using the below code to do that
    CONSTANTS:
        l_linsz TYPE sy-linsz VALUE 201, " Line size
        l_paart TYPE sy-paart VALUE 'X_65_132'.  " Paper Format
      l_uname = sy-uname .
      l_repid = sy-repid .
    *-- Setup the Print Parmaters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          authority              = space
          copies                 = '1'
          cover_page             = space
          data_set               = space
          department             = space
          destination            = space
          expiration             = '1'
          immediately            = space
          new_list_id            = k_x
          no_dialog              = k_x
          user                   = l_uname
        IMPORTING
          out_parameters         = l_mstr_print_parms
          valid                  = l_mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      IF l_mstr_print_parms-pdest = space.
        l_mstr_print_parms-pdest = k_lp01.
      ENDIF.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      l_mstr_print_parms-linsz = l_linsz.
      l_mstr_print_parms-paart = l_paart.
      l_variante = sy-slset.
    * submitting the spool request
      *SUBMIT (l_repid) TO SAP-SPOOL*
                       *SPOOL PARAMETERS l_mstr_print_parms*
                       *WITHOUT SPOOL DYNPRO*
                       *AND RETURN.*
    *Calculating the lenth of report name
      lv_len = STRLEN( l_repid ) .
    *consutrucing the database variable  rq2name to search the spool
    *request
      IF lv_len >= 9 .
        CONCATENATE l_repid+0(9)
                    l_uname+0(3) INTO lc_rq2name .
      ELSE.
        lv_len = 9 - lv_len .
        DO lv_len TIMES .
          CONCATENATE lv_temp '_' INTO lv_temp .
        ENDDO.
        CONCATENATE l_repid lv_temp
                    l_uname INTO lc_rq2name .
      ENDIF.
    *selecting the spool request using the above consructed varibale
      SELECT   * FROM tsp01 INTO TABLE lt_tsp01
              WHERE rq2name = lc_rq2name .
    *sorting the interbla table
      SORT  lt_tsp01 BY rqcretime DESCENDING .
    *reading the first spool request
      READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.
    but the problem with the above code is I am using variants to execute the report but when the above piece of code is getting executed it is clearing all the variant values on the selection screen and it is defaulting the values on the selection screen.
    Is there any way i can execute the above code without any problem in the selection screen.
    Thanks
    Bala Duvvuri

    Hello Bala,
    I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
    Check the code snippet i've provided below:
    DATA: spfli_wa         TYPE spfli,
          print_parameters TYPE pri_params,
          valid_flag       TYPE c LENGTH 1.
    START-OF-SELECTION.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog            = 'X'
        IMPORTING
          out_parameters       = print_parameters
          valid                = valid_flag
        EXCEPTIONS
          invalid_print_params = 2
          OTHERS               = 4.
      IF valid_flag = 'X' AND sy-subrc = 0.
    *   1. Write the output to the output list(no spool is generated)
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
    *   2. Write the output to SAP spool(no list is displayed)
        NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
        NEW-PAGE PRINT OFF.
        MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
        "You can use the spool number (SY-SPONO) to email the list output
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • Submit report to spool,  from page 2?

    Dear experts,
    I need to send a report to spool via the "submit" command through my program, but I want to print pages from 2 to the end.
    SUBMIT rls10020 WITH s1_lgnum = lrf_wkqu-lgnum
                    WITH s1_lgtyp IN r_lgtyp
                    WITH s1_lgpla IN r_lgpla
                    WITH p_vari   = disvariant-variant
                    TO SAP-SPOOL
                    DESTINATION pri_params_pdest
                     IMMEDIATELY 'X'
                    WITHOUT SPOOL DYNPRO
                    AND RETURN.
    there seem to be no parameter available to send my request "FROM PAGE = 2".
    although if i send it to spool and go from sp01 to pint with changed parameters I can do it.
    Please help. Is there any parameter available for this?
    Thank you,
    Roxani Athousaki

    Hi,
    use this code:
    DATA: number           TYPE tbtcjob-jobcount,
          name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    From jobnumber you obtain the spool number.

  • Suppress spool in Submit Report

    Hi All
    I am doing a Submit Report in background in loop.
    I can check from the background job if the Submit was successful or not. But if it is successful I dont want any output in spool.
    By default it is creating a spool request for every Submit.
    But dont want any spool to be created as the submit will be executed no. of times.
    Kindly let me know if and how we can suppress the spool request. The code I have written is attached below.
    LOOP AT lt_t320a INTO ls_t320a.
               SUBMIT XYZ
                      WITH matnr   IN matnr
                      WITH werks   =  ls_t320a-werks
                      TO SAP-SPOOL SPOOL PARAMETERS print_parameters
                      WITHOUT SPOOL DYNPRO
                      VIA JOB job NUMBER jno
                      AND RETURN .
      ENDLOOP.
    Thanks in advance.
    Regards
    Prafulla

    Hi Narinder,
    I have tried without TO SAP-SPOOL but it doesn't work.
    Submit is automatically creating the spool request when run in background mode.
    Kind Regards
    Prafulla

  • Submit report to spool & import spool id

    hi all.
       I want to submit the report to the sap spool & then import that spool number.
    I want to use use SUBMIT statement.
    give me the code

    Hi,
    use this code:
    DATA: number           TYPE tbtcjob-jobcount,
          name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    From jobnumber you obtain the spool number.

  • Problem with submit for spool number generation

    Hi All,
    I have a ALV report which downloads the output to pdf . I have a footer data in the END_OF_PAGE event which should be displayed for each page. It works fine if I take a  printout using the print option in the report output screen and generate a spool number the footer is getting printed.
    But when I use a submit to sap-spool....statement to generate the spool number the footer is not displayed.
    Any suggestions??

    Hi RAkesh,
    Are you using the FM 'REUSE_ALV_COMMENTARY_WRITE' for footer text or simple using the write statements.
    try with the both options, still problem provide the complete code.
    Regards,
    Satya.

  • PO reporting that can capture PO number, PO value and cost center

    Dear SAP expert and gurus,
    Would like to seek for your professional advise and consult on which report in MM that can capture the PO number, PO value and cost center.
    Kindly advise.
    Thank you
    Regards
    Leonard Tan

    ME80FN is a good report that captured the PO number and amount. However, the cost center is not being captured here. is there any suggestion?
    ME2K is not an ideal report to user cause, user requires the data to be shown in one line instead of 2 to 3 line.
    Is there any report like ME80FN can be captured PO number, PO value and Cost Center.
    Thank you
    Regards
    Leonard Tan

  • How to get spool number when using SUBMIT job

    Hi All,
    I am calling standard program using SUBMIT through JOB as below. Now I need spool number for this job to covert the output to PDF and send to mail. See the below code and guide me.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      data: Zscreen type table of RSPARAMS with header line.
       Zscreen-selname = 'PM_AENNR'.
       Zscreen-kind = 'P'.
       ZSCREEN-LOW = '500000000125'.
       APPEND ZSCREEN.
    SUBMIT RCC00130 WITH selection-table Zscreen TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                       WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5

    Hi,
    Do this way, first get print parameters by using function module 'GET_PRINT_PARAMETERS'
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          destination    = 'LP01'
          list_name      = 'TEST'
          list_text      = 'SUBMIT ... TO SAP-SPOOL'
          immediately    = ' '
          line_size      = '1023'
          no_dialog      = 'X'
        IMPORTING
          out_parameters = wa_pri_params
          valid          = w_valid.
    If it returns success then
        IF w_valid EQ 'X'.
          CONCATENATE 'R'                                   
                       w_tabix                                
                       sy-datum+4(4)
                       sy-uzeit INTO
                       wa_pri_params-plist.
        ENDIF.
        SUBMIT rprccc00
               WITH firmennr = w_cid
               WITH bel_clus = 'X'
               WITH testlauf = ' '
               WITH not_lokl = 'X'
               WITH file_in  = w_arc_out
               TO SAP-SPOOL WITHOUT SPOOL DYNPRO
               SPOOL PARAMETERS wa_pri_params AND RETURN.
        COMMIT WORK AND WAIT.
    SELECT rqident
             FROM tsp01
             INTO w_rqident
             UP TO 1 ROWS
             WHERE rq2name = wa_pri_params-plist.
      ENDSELECT.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid     = w_rqident
          no_dialog       = 'X'
          dst_device      = 'LP01'
          pdf_destination = 'X'
        TABLES
          pdf             = t_pdf.
    Hope it solves your problem
    Regards
    Krishna

  • Capture message after SUBMIT report

    I have called submit report like below in  RFC function module .
    submit rfitemap
                  with kd_lifnr in r_it_lifnr
                  with x_apar   eq abap_true
                  with x_merk   eq abap_true
                  with x_norm   eq abap_true
                  with x_opsel  eq abap_true
                  with x_park   eq abap_true
                  with x_shbv   eq abap_true
                  exporting list to memory and return.
    how to capture  or skip  error or information populated by submit program ?
    As the function module is a RFC function module, the FM is called from some SMDL program  .  Once the program executes  submit statement
    is giving system failure exception and giving message like 'No connection with development system'.
    Instead of giving messages populated in return table ,the SMDL program returns "NO connection"  message.
    How to display the message from return table ?

    Hello Kachana,
    You can try like mentioned in the below thread with JOB OPEN, submit your program, JOB CLOSE and read the job log to get the messages raised during the submit program.
    How do I capture error/information messages and Output of a report using SUMBIT statement, when called in a function mod…
    Regards,
    TP

  • How to get spool number within report?

    Hi experts,
    I have a report that writes some messages to spool. Within this report I want to write out the spool number (where the output goes to) to a Z-table. My question: Where do I get this spool number of the current running report from?
    Thanks in advance for your help!
    Kind regards, Matthias

    Hi,
      DATA: LC_RQ2NAME LIKE TSP01-RQ2NAME.
       F_REPID = Sy-repid.
    f_uname = SY-UNAME.
      CONCATENATE F_REPID+0(9)
                  F_UNAME+0(3) INTO LC_RQ2NAME.
      CONDENSE LC_RQ2NAME.
       SELECT * FROM TSP01
               WHERE  RQ2NAME = LC_RQ2NAME
               ORDER BY RQCRETIME DESCENDING.
        F_RQIDENT = TSP01-RQIDENT.
        EXIT.
      ENDSELECT.
    TSP01-RQIDENT will be spool number.
    regards,
    dhan

  • SUBMIT program and spool number

    How to get a spool number (SY-SPONO or any other number) of the list created by a SUBMIT command, when using
    SUBMIT.. TO SAP-SPOOL
    Also note that the SUBMIT is executed with in a batch / background job
    Helpful answers will be definitely rewarded

    I tried using SY-SPONO, the problem is SY-SPONO is not set after the SUBMIT command both in foreground and background modes.
    I want to access the spool created by a SUBMIT command in the calling program.
    I think, I have found out a way to do this, will have to test.. but if there is any better way...
      submit (p_repid) to sap-spool without spool dynpro
                       spool parameters mstr_print_parms
                       via selection-screen
                       and return.
    *-- Find out what the spool number is that was just created
      perform get_spool_number using sy-repid
                 sy-uname
        changing mi_rqident.
      form get_spool_number using f_repid
         f_uname
                    changing f_rqident.
      data:
        lc_rq2name like tsp01-rq2name.
      concatenate f_repid+0(8)
                  f_uname+0(3)
        into lc_rq2name separated by '_'.
      select * from tsp01 where  rq2name = lc_rq2name
      order by rqcretime descending.
        f_rqident = tsp01-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear f_rqident.
      endif.
    endform." get_spool_number
    <a href="http://abap4.tripod.com/Save_Report_Output_to_a_PDF_File.html">Credits</a>

  • Spool number issue while printing the invoice through VF01

    Hi Experts,
    I have a custom program which will create invoices in the background through VF01 transaction. How do I know the exact spool number which has been generated when the invoice is created. I have checked TSP01 table but I want the exact spool number which got created for that invoice. Your response will be appreciated.
    Thanks,
    Surab

    No, even sy-spono is also not returning any value. I have also checked it inside the called program.
    Surab

  • How to create spool in an online report

    Hi All,
    I have a requirement where the ALV report output has customers and details related to it.For example My report output has three customers(with a check box against it) and each customer has 5 line items.The user will select first and the last customer and press a push button provided.Once he clicks this push button, I should get the customers which are selected by the users and the line items related to this customers.I am able to capture all this.Now the real problem here is that I have to create a pdf document for each customer along with line items and send it as an email.In effect, in this scenario I have to create two pdf documents since the user has selected two customers on the output screen and send it to the email of that particular customer.Is there any FM available to create spool in the background for each of these customers(along with line items data) and make use of this spool number to generate a pdf document using CONVERT_ABAPSPOOLJOB_2_PDF.Once I get this I can send the email.
    Please help!
    Thanks in advance
    Sandeep

    The following steps shows how to download the output data in to PDF.
    1.Provide Spool Parameters using following function module 'GET_PRINT_PARAMETERS'.
    --This function module will provide the print parameters for creating the output in the spool; the required parameters are passed to the ‘OUT_PARAMETERS’ import parameter.
    2.Submit the report to generate the output in the spool.
    SUBMIT (sy-repid) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                         SPOOL PARAMETERS wa_mstr_print_parms
                         WITH SELECTION-TABLE  i_int_tab
                         AND RETURN.
    --Submit the report to generate the output in the spool as i_int_table is an internal table with structure RSPARAMS. As variant allows you to set the names and contents of the parameter and selection options dynamically at runtime, we need to use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the contents of the parameters and selection options of the current program into an internal table i_int_table with the structure RSPARAMS and pass that internal table in above manner.
    3.To Find the spool number from the table TSP01
    Data: l_rq2name LIKE tsp01-rq2name.
    *Concatenate the report and User name as per the value available in the table   
    TSP01.
      CONCATENATE f_repid+0(9)
                  f_uname+0(3)
        INTO l_rq2name.
    *Fetch the most recent spool from the TSP01 table
      SELECT * FROM tsp01 WHERE  rq2name = l_rq2name
      ORDER BY rqcretime DESCENDING.
        l_rqident = tsp01-rqident.
        EXIT.
      ENDSELECT.
    4.Convert Spool to PDF using the FM : CONVERT_ABAPSPOOLJOB_2_PDF.
    5.Download to local file by using the FM : DOWNLOAD
    This function module returns an internal table data_tab contains the PDF formatted output.
    Using above points your can create the output in the PDF from there you can send the email.
    Hope your reqirement can met using the above five points.
    Reward points please
    Thanks,
    Ravi Kanth

Maybe you are looking for

  • Kernel Panic when I use hot corner to put display to sleep (twice)

    As the title above says, for the second night in a row, my new iMac (2012) has had a kernel panic when I perform that action. I also turn off my magic mouse to save the batteries but I'm constantly doing both of these actions throughout the day when

  • Fingerprin​t power on

    Hello, When I try to use the fingerprint reader as an alternative to the power on button to start up the laptop, it works, but the physical power button still starts up the laptop. Furthermore, when I am in the log in screen, the fingerprint scan wor

  • E Table of aggregate has too many partitions

    Hi, While checking performance info of the query I'm getting red light on one of the lines saying aggregate 100067 has too many partitions in E table. Could you guys pls let me know what is this all about and how to reslove the same? Thanks R

  • MSS Overview page

    hi, We have to implement old and new MSS business package as Web Dynpro(new) business package does not provide all the services. So my question here is how to make a comprehensive overview page. What is the best way to make an Overview page with serv

  • G/L Account external service

    When we enter the G/L Account for external service the field gets locked. The PR is created in the system. I there any way I can change the G/L Account (Cost Element) ? regards Sabyasachi