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#

Similar Messages

  • 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

  • Get spool number

    hello experts,
    how will i get the spool number of an output in transaction VT03N? i have to get the spool number because i will use it in the print program configured in the transaction's output.
    please help me with this.
    thank you.

    hi march,
    first goto se38 then any prg execute(F8).
    find print (List in menubar)
    click print then u can get spool number with last four numbers. u remember the number.
    then goto se38 pgm name is RSTXPDFT4. its executed.
    u put spool number(last four numbers) only.
    its executes then save as extension with pdf in ur system.
    Reward if useful,
    Regards,
    S.Suresh.

  • Urgent : Want to know table stores spools created by a background job

    Actually background job executed by me creates 2 spool requests
    table - tbtcpv holds only the 1 spool
    Can any one tell me the table which stores all the spool created by the background job ?
    Need urgent help.....

    Guru,
    Try with below tables
    TBTCO
    TBTCO
    TBTCP
    TBTCR
    TBTCS
    TBTCJSTEP
    TBTCO
    TBTCP
    Pls. reward if useful..

  • 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

  • Get spool number for delivery output.

    Hi,
    Is it possible to get the spool number for a print output type generated for a delivery? I use the Tcode VL02N to view the output types generated for a delivery. I want to use this spool number to generate a PDF file.

    Hi,
    The below mentioned link shows how to get the Spool Request Number for the Output type and convert it to PDF and download. It uses mainly NAST and CMFP table.
    Link: http://wiki.sdn.sap.com/wiki/display/ABAP/GettingSpoolRequestNumberfortheOutput+type

  • Get Spool number for Smartform

    Hi All,
    I have created a smartform to print the POs created through ME21n. I have changed the config to use this smartform when a PO is changed/created. Everything is working fine. All I need is the spool number for each of the PO this is being printed. Can you please let me know how I can achieve this through the FM for smartform?
    I AM USING 4.6C.
    This is how I am using the function module
      CALL FUNCTION FM_NAME
           EXPORTING
                CONTROL_PARAMETERS = CONTROL
                OUTPUT_OPTIONS     = OUTPUT
                USER_SETTINGS      = ' '
                EKKO               = L_DOC-XEKKO
                PEKKO              = L_DOC-XPEKKO
                DRUVO              = L_DRUVO
           IMPORTING
                JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
           TABLES
                EKPO               = L_DOC-XEKPO
                PEKPO              = L_DOC-XPEKPO
                XAEND              = IT_XAEND
           EXCEPTIONS
                FORMATTING_ERROR   = 1
                INTERNAL_ERROR     = 2
                SEND_ERROR         = 3
                USER_CANCELED      = 4
                OTHERS             = 5.
    All your inputs are greatly appreciated.
    Thanks!
    Sandeep

    Hi,
    JOB_OUTPUT_OPTIONS is of type SSFCRESOP, which does not have a SPOOLIDS field/table.
    I knwo that the function module SSF_CLOSE returns the spool id in a table. But, I am not sure how to use SSF_OPEN and SSF_CLOSE. Can you please throw some light on how I can use these to get the spool numbers?
    This is what I have right now.
      JOB_OUTPUT_OPTIONS-TDDEST = ITCPO-TDDEST.
      JOB_OUTPUT_OPTIONS-TDNEWID = 'X'.
      L_FORMNAME = TNAPR-FONAM.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                 FORMNAME           = TNAPR-SFORM
                FORMNAME           = L_FORMNAME
           IMPORTING
                FM_NAME            = FM_NAME
           EXCEPTIONS
                NO_FORM            = 1
                NO_FUNCTION_MODULE = 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.
      CALL FUNCTION FM_NAME
           EXPORTING
                CONTROL_PARAMETERS = CONTROL
                OUTPUT_OPTIONS     = OUTPUT
                USER_SETTINGS      = ' '
                EKKO               = L_DOC-XEKKO
                PEKKO              = L_DOC-XPEKKO
                DRUVO              = L_DRUVO
           IMPORTING
                JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
           TABLES
                EKPO               = L_DOC-XEKPO
                PEKPO              = L_DOC-XPEKPO
                XAEND              = IT_XAEND
           EXCEPTIONS
                FORMATTING_ERROR   = 1
                INTERNAL_ERROR     = 2
                SEND_ERROR         = 3
                USER_CANCELED      = 4
                OTHERS             = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        SELECT RQIDENT RQOWNER RQCRETIME FROM TSP01 INTO TABLE IT_TSP01
        WHERE RQOWNER = SY-UNAME.
        IF SY-SUBRC = 0.
          SORT IT_TSP01 BY RQCRETIME DESCENDING.
          READ TABLE IT_TSP01 INDEX 1.
          SPOOLID = IT_TSP01-RQIDENT.
          PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.
        ENDIF.
      ENDIF.
    The SELECT part is wrong, I need to replace this code to get the correct spool numbers.
    Thanks in advance.
    Sandeep

  • Problems with getting the number of hits in the document.

    I need to get the number of hits in the document.
    I use the query template for this porpose as:
    SELECT d.id, score(1)
    FROM document d
    WHERE contains(d.content,'<query>
    <textquery>SEARCHWORD</textquery>
    <score datatype="INTEGER" algorithm="COUNT"/></query>',1)>0
    AND d.id=1
    problems:
    1. If I have some synonyms associated with SEARCHWORD in OracleThesaurus and in case if document contains these synonyms they are not counted.
    2. could you explain the following results returned by query above:
    search query: word1 - numberOfHits=10
    search query: word2 - numberOfHits=8
    search query: word1 OR word2 - numberOfHits=10
    i suppose that numberOhHits=18 for a query: word1 OR word2

    Hi.<br><br>
    1.Synonyms (and generally thesaurus query extensions) cannot automatically uses in queries. You MUST expand you query using SYN function yourself. Query you write just applicable for only KEYWORD search.<br><br>
    2. Ask yourself. I'm not seen your data. ;)<br>
    Rgrds, Yuri.<br><br>
    PS. Just read Oracle Text Reference - you can find many answers here. ;)

  • GET spool  number  according  to Message type (nast-kschl)

    hi all ,
    i want  to  get  the  oldest spool  number  for  a message type and PO number via  abap  program
    thinks in advancs.
    karim .

    hi,
    field dsnam of the table nast can give spool request name..
    may be this field can help u in solving ur issue ..
    regards,
    prashanti

  • 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

  • Invalid redemption code problem to get serial number

    Bought adobe premiere elements 13.  Got to retrieve serial number by entering redemption code.  24 letters and numbers.  I did every way, case sensitive and not, and even the 0 with a line through it, an O or number 0?  Tried both.  Still all ways "invalid."   What now? 

    Hello Scotty,
    did you use the steps from there? >>> Redemption Code Help
    Another way, If you purchased your product from these firms like Amazon, you get this code with which you can request a serial number from Adobe. Please have a look at http://helpx.adobe.com/x-productkb/global/find-serial-number.html. (Start here: How did you purchase your product?)
    The following part, so I just see at least, ceased to exist on my Adobe website, everything takes place in the link from above. I leave it as an info yet, it might still fit for you. For this purpose, please click your way through to your Adobe Store and find the button "Get Serial Number". Fill in the form and after a while you will get the real serial number.
    Hans-Günter

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

  • Spool not generated in BAckground Job

    Hi,
    I am trying to schedule RSNAST00 in a background job. My problem is that when the job gets finished i cannot see a spool for the output, any pointers to this issue will be appreciated.
    Regards,
    Sharadendu

    Go to transaction SM37 and check job log.
    It is possible that something is going wrong in your program. I would suggest you to debugg background job.
    To debugg just select job in SM37 and in command window(Where we type T codes) type JDBG and press enter. This will open debugger. Press F7 for approx 4-5 times. Now your program will be opened in debugg and you check why spool is not generated.
    let me know ig this helps.
    Regards,
    Jigar Thakkar.

  • How to get spool no created when a job is created

    Hi,
    I am creating a Job using Job_Open,Job_Submit and Job_Close FM's
    The job created will have a spool associated.
    How can i programmatically find out spool number created ?
    Pls Help!!
    Answers will be rewarded.
    Rohan

    hi,
    use the below fm
    GET_JOB_RUNTIME_INFO Get the current job number from a program. Also returns other useful info about the current job.
    regards,
    pavan t

  • Spool file of a background job

    Hello Friends,
    In an SAP system, there is a background job which creates a spool file.
    If there is no printer configuration done on the SAP server, how to find the location of this file in the filesystem?
    Thanks & Regards,
    Kunal Patel.

    Hi,
    Thanks for your reply.
    I was able to locate the file in the filesystem.
    Actually I changed a setting in the printer LOCL so that the spool is stored in Global directory.
    But now there is a new problem.
    The spool file in the filesystem is in a very different format as below:
    Could you let me know how to change the format of the spool?
    Command executed:       more : /usr/sap/DHS/SYS/global/100SPOOL/00010000026674 :
    Target host:            unix0006
    COL0N COL0H05.03.2008
    4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    5
    5      5Lene
    5      5Gitte
    5      5Orla Bech
    5      5Janni                                    5We
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 -  P                                              COL0N COL0H05.03.2008
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4
    4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    5 ú    5
    5 ú    5
    5 ú    5
    Rgds,
    Kunal.

Maybe you are looking for

  • Creation of Production Orders(CO01) , its opeartion & Components in mass

    Hi Gurus I have to create the Production Orders in mass with Operation & Component alloacation & i want to use the BAPI BAPI_PRODORD_CREATE, whether i can create the Opeartions & components of Production Orders at the same time using this BAPI BAPI_P

  • I keep getting a js/phish virus detdection on my compute how can I get rid of it?

    My new windows8 computer came with norton 360 but I did not think it would get rid of virus' for me so I got AVG and now about once a day AVG tells me that I have a Js/phish virus and it says its from norton how do I get rid of norton to stop getting

  • Help me creating a procedure

    In this practice, create a procedure to monitor whether employees have exceeded their average salary limits. a.     Add a column to the EMPLOYEES table by executing the following command:            ALTER TABLE employees      ADD (sal_limit_indicate

  • Capturing Hosts,cluster,ad Resource information of hosts using SPF REST API

    Hi, We are using SCVMM 2012R2 to integrate Hyper-V VMM with java using SPF REST API.For this I am using tenant API.  I am able fetch all the entities in VMM using GET query in SPF URL,but I am unable to fetch hosts,cluster and resource information fo

  • PDP with classic scenario

    Hello, I am working with SRM 7.0 and ECC 6.0. 1) I would like to know how do you transfer PR to SRM in classic scenario?    Is it the same as for extended classic scenario (using program BBP_EXTREQ_TRANSFER)? 2) How do you create PO in backend for di