Spool number of sumitted program

Hello,
does somebody know, how I can get the generated spool number of a submitted program?
Unfortunately, the system variables sy-spono or sy-sponr will be deleted, when the submitted program will be left.
Is it possibly feasible to get the spool number between the function modules 'JOB_OPEN' and 'JOB_CLOSE'?
Thanks a lot and regards.
Sergej

Hello Sergej,
Yes, you can get the Spool Number from the Job created.
1. Use the FM: 'GET_JOB_RUNTIME_INFO' to get the Background Job Runtime Data.
2. Then use the table TBTCP to get the Spool Number.
* get the 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.
* Get the spool number
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.
IF sy-subrc = 0.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
gd_spool_nr = wa_tbtcp-listident. "gd_spool_nr --> contains spool no.
ENDIF.
Hope this helps.
BR,
Suhas

Similar Messages

  • How to get Spool Number after submtting the program and return

    Hi All,
    Could you please assist me on this issue. I have ABAP program which will create a spool number and this spool number is generated by submitting the same report. Now when try to retrive the spool number from sy-spono it is displaying as 000000 but it suppose to be the spool which is created during submit program. COuld you please assist me on this issue. I have added the part of code for your reference,
    DATA: l_params TYPE pri_params,
    l_valid TYPE string,
    w_spool_nr like sy-spono,
    p_m_werks like marc-werks.
    export p_werks to memory id 'P_WERKS'.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    IMPORTING
    out_parameters = l_params
    valid = l_valid
    IF sy-subrc <> 0.
    ENDIF.
    import p_werks from memory id 'P_WERKS'.
    p_m_werks = p_werks.
    SUBMIT zmmlist01 with p_werks eq p_m_werks
    to SAP-SPOOL
    spool parameters l_params
    without spool dynpro and return.
    write: sy-SPOno.
    Thanks & Regards,
    Nagaraj Kalbavi

    Hi,
    You can use the code snippet as below :
    SELECT MAX( RQIDENT ) INTO G_SPOOL_NUM
    FROM TSP01
    WHERE RQCLIENT = SY-MANDT AND
    RQOWNER = SY-UNAME.
    Also you can use the FM RSPO_FIND_SPOOL_REQUESTS' and pass the relevant parameters to this FM. This should get you the desired results.
    Hope this would be of some help!!
    Regards,
    Lalit Kabra

  • How  to  crate a spool number for the abap program

    hi
    how  to  create a spool number for the abap program

    Hi,
    Check this thread
    how to create a spool requset for 'z program'.
    Regards,
    Satish

  • Spool number and program name

    Hi All,
    Im trying to fetch spool number based on object name(program name).
    The table TSP01 has the field RQ2NAME has the program name in it, with some additional characters.
    For example, if the program name is ZQRR1234 , its showing it as ZQRR1234_ABC.
    Is there any other way to fetch spool numbers other than this? Please let me know.
    The other issue is, Spool created for ReportWriter reports, are having a different name in the RQ2NAME field(Totally different from the above case). For example if the report name is Z31L, its showing as GP3ITN115113. Im not sure whether this name will be same in Quality and production system.
    Finally please let me know how to fetch spool numbers based on program name in either case.

    Hello Saravanan,
    Please use FM RSPO_OUTPUT_SPOOL_REQUEST to display your spool.
    Have a Nice Day,
    Regards,
    Sujeet

  • Spool Number back to the program

    HI all,
    I am handling with smart forms. The problem is that I have to write a code which will bring the spool number for each document back to program when executed with user id "Batch_Admin".  Can anyone give an idea for the same.  There is any function module available for the same.  Please give some suggestions.
    Thanks in advance.
    John

    Hi John,
    Welcome to SDN.
    You can use this function module RSPO_FIND_SPOOL_REQUESTS to find all spool numbers which belong to user ID 'BATCH_ADMIN'.
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful.

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

  • 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

  • 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

  • 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

  • Spool number

    Hi,
    I have a dout regarding Spool Request
    Here in my program after calling the Function module 'GET_PRINT_PARAMETERS' , There is a codeing to generate Spool Request Number.
    Codeing
    TO SAP-SPOOL
          SPOOL PARAMETERS V_PARAMS
          ARCHIVE PARAMETERS V_ARPARAMS
          WITHOUT SPOOL DYNPRO
    My dout what is the need for generating the Spool request number

    hi ,
    A spool request is a document for which a print function has been selected. SPOOL is nothing but a buffer where the data given to print is stored .
    The data is stored in a temporary format. You can also display the print document.
    The system automatically assigns a 10 digit ID number to a spool request.
    From the point of view of the SAP spool system, an output request is outputting the print data of a spool request on a particular output device.
    So a spool number uniquely identifies the doc to be printed. This can be used in future if you want to take the output in various formats like PDF etc and also you can send EMAILS etc.
    Thanks and regards.

  • Getting only one spool number for every print out

    hi guys,
    when i execute my customize program i suppose to get a form in my screen, showing customer statement, when I exicute customer A out put as expected with 5 pages but after that if i exicute customer B which is supposed to be 3 pages but I am getting 8 pages which is including first out put also, its repeating same spool number for every thing and keep on adding every page , please let me know where to see for this ?? 
    for spool request    RS38L_FNAM
    and to display         'COM_SE_SPOOL_DISPLAY'

    Change ur table declaration as shown below, replace the word <b>TYPE</b> with <b>LIKE</b>
    DATA: BEGIN OF i_final OCCURS 0,
    srno TYPE i, " Serial no
    anln1 LIKE anla-anln1, " asset code no
    txt50 LIKE anla-txt50, " Brief Description of Assets
    txa50 LIKE anla-txa50, " Further Description
    ktogr LIKE anla-ktogr, " Asset Class No.
    ktgrtx LIKE t095t-ktgrtx, " Asset Class Name
    sernr LIKE anla-sernr, " Serial Number
    invnr LIKE anla-invnr, " Assets Identification No
    menge LIKE anla-menge, " Qty
    meins LIKE anla-meins, " UOM
    raumn LIKE anlz-raumn, " Location
    lifnr LIKE anla-lifnr, " Vendor
    liefe LIKE anla-liefe, " Capitalisation Date
    aktiv LIKE anla-aktiv, " Date put to use
    g_kansw LIKE anlc-kansw, " Opening Gross Block
    b_kansw LIKE anlc-kansw, " Additions during the period
    b_answl LIKE anlc-answl," Deductions/ Adjustmentsduring d period
    g_total LIKE bsis-dmbtr, " Closing Gross Block
    d_open LIKE anlb-afabg, " Dep on opening block
    d_sold LIKE anlb-afabg, " Dep on assets sold/written off
    d_add LIKE anlb-afabg, " dep on additions during the period
    afabg LIKE anlb-afabg, " Total dep for the period
    cd_sold LIKE bsis-dmbtr, " *** Dep on assets sold
    cd_asst LIKE bsis-dmbtr, " *** Dep on assets written off
    cd_dep LIKE bsis-dmbtr, " Total *** dep on deductions
    ccd_dep LIKE bsis-dmbtr, " Closing Acc Dep
    a LIKE bsis-dmbtr, " WDV of assets sold
    b LIKE bsis-dmbtr, " Selling Price
    c LIKE bsis-dmbtr, " Profit / (Loss) on sale
    d LIKE bsis-dmbtr, " Loss on write off
    e LIKE bsis-dmbtr, " Opening WDV
    f LIKE bsis-dmbtr, " Closing WDV
    END OF i_final.

  • Smartform name from spool number

    Hi guys .İ have to learn the Smartform or Sapscript name of a alreasy printed document.So i use the transaction SP02 .There is not any information about the program or Smartform in spool transaction .How can i know SMARTFORM name from the spool number.
    I have seen thiş thread but it doesnt seem a healthy solution .
    smartform name from spool number

    Hi,
    1.Goto sp01 and give your spool request number.
    2.Double click on the spool request number.
    3.In the screen,click on the TemSe attributes tab.
    4.In that tab you can find the object name field.Double click on the Objectname(spool number).It will take you to the TemSe:List of Objects Screen
    5.Check the checkbox and press the CONTENTS tab in the application toolbar.
    6.It will show the TemSe:Contents of Object screen.You can find the SMARTFORM Name in the Second line of the display.
    7.If you need to find the Program name use table TNAPR.
    Jshree

  • Output message type External send - Suppress spool number in SOST title

    Dear all,
    Using an external send output type, we send order confirmation from by mail.
    Depending of printer we use, we have different behaviors :
    With a normal printer, the mail title we get in SOST is exactly the content of field <NAST-TDTITLE>.
    This field can be changed in the print program, so we can set exactly the title we want.
    With a PDF2MAIL printer (printer defined in SPAD with property host spool access method : M (Email to Receiver/Owner), the mail title we get in SOST is the following : <SystemID><Spool Number><NAST-TDCOVTITLE>.
    Do you know whether it is possible to suppress standard information <SystemID><Spool Number>
    and therefore have only <NAST-TDCOVTITLE>.
    Setting both fields <NAST-TDCOVTITLE> and <NAST-TDTITLE> using print program, the goal is to have allways same title in SOST ...
    Can you help me ?
    J.C.

    Hi,
    I am not got your reuirement clearly, but i feel your reuirement is close to this thread:
    RLB_INVOICE program for sending mail to muliple mail's Id's
    I have used the Cl_BCS class to send mail to muliplte vendor mail id's
    If needed code will be send.
    Hope this will help.

  • Same spool number for same job on mutilple days

    Hi all,
    We have daily Batch job which runs at 9:00 PM for a 1 variant and with 2 variant after first job is done.
    On 11/05 we have got one spool number 845411 for the spool  and on the 11/09 for the same job we got the same spool number for 2 jobs , and the data is also showing as 11/05 only and the spool creation date is showing as 11/05 and modified on 11/10...
    This is happening for only 1  batch job, we have checked the other  jobs all are fine with different spool #, we have checked spool number range and every thing is fine.
    Please suggest   what can be the reason for this scenario...
    Thanks,
    Subhash.G

    Hi Subhash,
    Check the print parametes of the job, can be seen under steps --> double click on program --> print properties. There we have option to select new spool number.
    So every time the job runs it will have a new spool number. Hope this helps.
    Regards
    Sushant

  • Problem in getting spool number of a background job.

    Hi all,
    In a Z program I am calling a standard program to run as background job. I need to get the report o/p of the standard program. For this I need the spool no of the background job. Now I am querying on table tbtcp by giving jobname. Program name and run date and getting the spool no. but the cache is that the table is not getting updated with the spool no as soon as the job finishes. It is taking some time to update the table ( The time depends on the no of background jobs scheduled. ). So of we query on the table immediately after the background job finishes we are getting spool no as 0. so I am unable to read the spool into Internal tables. Even the table tsp01 is also behaving in the same way. ( it is taking time to update ) .
    Any pointers to this will be appreciated .
    Regards,
    Shiva....

    This is some prototype that I put together from separate pieces, so it looks funky, but might be helpful. The first step is to SUBMIT the program with EXPORTING LIST TO MEMORY. The next FM reads the list from memory and the next one (optional) converts it to a text format. You might want to search for other FMs in SE37 by 'LIST*'.
    DATA list_tab TYPE TABLE OF abaplist.
    SUBMIT RPR_TRIP_HEADER_DATA
    USING SELECTION-SET 'OLD_LIST'
    EXPORTING LIST TO MEMORY
                  AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = list_tab
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    types : t_txt(1000) type c.
    DATA: i_txt2 type table of t_txt,
    i_txt type list_string_table.
    call function 'LIST_TO_ASCI'
    EXPORTING
    *   LIST_INDEX               = -1
       WITH_LINE_BREAK          = 'X'
    IMPORTING
       LIST_STRING_ASCII        = i_txt
    *   LIST_DYN_ASCII           =
    TABLES
       LISTASCI                 =  i_txt2
       LISTOBJECT               = list_tab
    EXCEPTIONS
       EMPTY_LIST               = 1
       LIST_INDEX_INVALID       = 2
       OTHERS                   = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Also check this links:
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/spool-number-of-previously-printed-abap-list-635173#

Maybe you are looking for

  • Moving to UK from Canada: Will format 1 DVDs work on Macbook from UK store?

    Hello, I am going to be moving to London, and I understand that the DVDs there are a different format than the ones in North America. I was just wondering if anyone knows whether my old DVDs will work on a Macbook purchased from the UK Apple store. I

  • IMac 27" for Web Designers/Developers?

    Hello, I am considering making a switch from PC to Apple once again. I would like to see some good feedback from web designers/developers on the new 27" iMac. My main concern is screen size and normal font size being too small (after seeing it briefl

  • Capture streaming MP3 to file

    Is there a way to open an MP3 stream and write it to a file? A java based way to record internet radio for later listens?

  • I am getting error code -43 when trying to back up and download ios 5 any ideas?

    When launching my ipod it is asking to update and back up.  In backing up it gives me error cod -43 and tells me I will lose everything on my ipod if I continue.  It is trying to load operating system i501.  What should i do to correct and get the do

  • JavaHelp server side search engine

    I'm trying to use a server side search engine with JavaHelp 1.1.3. In the Moment all Helpsets are located on a Server. The viewer like a bowser and on server side a selfmade servlet answered the request. Now the searchengine should used like written