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.

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

  • 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

  • Getting the messages after SUBMIT report

    Hi,
    I have a requirement, wherein I'll SUBMIT a report(Report A) through a background job. I also have a custom table, which will have the job information (JOBNAME, JOBCOUNT).
    Now, I want to have a separate control report(Report B) which will read the custom table for the job information and will output the results of the report A submitted through the job. How can this be achieved?
    Also Is there any way, through which I can get the messages raised by the report A using the job information in report B?
    Thanks in advance.
    Sujit.

    Hi,
    I have a requirement, wherein I'll SUBMIT a report(Report A) through a background job. I also have a custom table, which will have the job information (JOBNAME, JOBCOUNT).
    Now, I want to have a separate control report(Report B) which will read the custom table for the job information and will output the results of the report A submitted through the job. How can this be achieved?
    Also Is there any way, through which I can get the messages raised by the report A using the job information in report B?
    Thanks in advance.
    Sujit.

  • SUBMIT REPORT statement issue in abap

    Hi Experts,
    I am facing issue while doing SUBMIT REPORT statement.
    Below are the details for the Issue:
    1. We want to execute another report ZTEST2 from one report , so we have written code in report ZTEST1 as below:
                          SUBMIT ZTEST2 AND RETURN.
    2. It goes to ZTEST2 successfully but when we execute ZTEST2 and click on BACK buttton , it directly goes to ZTEST1 selection screen.
    Instead we want to go ZTEST2 program's selection screen. As this back button is standard ALV button is there any way we can handle this without creating new PF-STATUS.
    Regards,
    Sanjana

    That's very limiting.
    It depends, there are some things you can do if you ztest2 does something that is traceable.
    Without any more info I suggest to check time-lapse between submit calls. If it's inferior to 2 seconds I'd suppose user want's to leave.
    mind you the syntax is wrong:
    do.
    g_initial = get time.
    SUBMIT ZTEST2 AND RETURN.
    g_final = get time.
    if g_final - g_initial <= 2.
         exit.
    endif.
    enddo.
    For the user is in most cases transparent, only if he remains a lot of time in selection screen he'll remain there.
    regards,
    Edgar

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

  • Get plan number after calling IP01 using BDC

    Hi,
    I am using IP01 by BDC to create maintenance plan.
    Is there any mthode to get  plan number after the call instead of  reading the message table  within call statment.?
    Thanks.

    One possible way is find an implicit enhancement point and fill up the plan number to memory id and in your bdc call program import the same from memory id

  • 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

  • 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

  • Message after submit report

    Hello all,
    I have a program that submits a report. This report sends the output to the spool. When the process executes the submit command I get the following message:
    Spool request (number &) created without immediate output.
    I need the spool request number for further processing. Does anybody know how to get the message and the spool request number at runtime? Kind of like the messages we get with a call transaction into the message table. By the way, the message is NOT available in the system structure SY(SYST).

    Here is what I've done in the past. 
    1) in the submitted program,  export the sy-spono to a memory id.  This should be the very last statement of the program.
    2) in the calling program,  after the SUBMIT statment, import the spool number into memory id.
    3) do what ever you need to do with the sy-spono.
    Regards,
    Rich Heilman

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

  • How to Get Spool ID after PO release. (To send PDF for ext E-mail)

    Hi Experts,
    I am new to Email sending from SAP.
    I am facing a big problem from many days. I am in a new support project.
    I have a issue that when ever a PO is released from ME23N or ME28 it should send a mail to vendor.
    This is working fine in Development including delivery report or failed report back to approver...
    I dont know where is PRD and who is doing that,
    But my support manager says that only some PO's are sent to vendors not all...
    everytime they approve only some emails sent to vendors...!
    But every PO is same and for same vendor's...
    Even failure & delivery messages are missing for (sent failed email's)
    But after all I observed only one thing that we have a select statement....
      DATA:  GS_RESULT TYPE ITCPP.  
      DATA : L_DATE(9).
      DATA : BEGIN OF LT_TSP01 OCCURS 0,
              RQIDENT LIKE TSP01-RQIDENT,
              RQCRETIME  LIKE TSP01-RQCRETIME,
              DATE(8),
              TIME(8) TYPE N,
              END OF LT_TSP01.
      SELECT  RQIDENT RQCRETIME  FROM TSP01 INTO CORRESPONDING FIELDS OF
                           TABLE  LT_TSP01  WHERE RQCRETIME LIKE L_DATE
                                            AND   RQIDENT EQ GS_RESULT-TDSPOOLID.
      IF SY-SUBRC =  0.
    (All Email sending code)(including delivery & failure delivery)
    Endif.
    So I suspect it is not picking up the Spool request from this Table TSP01 or may be not updated to this table.
    I have searched in SCN, I have seen may E-mail Codings
    But every one says to get Spool- ID & Convert to PDF,,,
    My Question is How to get Spool ID correctly and tell me how it is updated. when a PO released by ME23N or ME28.
    please any one clear my doubt as I am completely helpless here.
    Thanks in advance,
    Dunlop.

    Hi,
      Is it a SMart form.....
    If it is a smartform, then Smartfom interface itself has a spool id parameter....
    you can directly het that from this parameter...
        CALL FUNCTION "FMa Name'
          EXPORTING
            control_parameters = wsl_control
            output_options     = wsl_outpt
            user_settings      = ''
            wtg_itemdetails    = tl_itemdet
             wtg_vttp              = l_vttp
          IMPORTING
            job_output_info    = sl_spooldet
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
        IF sy-subrc <> 0.
        ENDIF.
    The inporting parameter sl_spolldet will have the Spool id.
    and you fetch by, using the below mentioned way..........
        READ TABLE wsl_spooldet-spoolids INTO wsl_wa_spool INDEX 1.
          IF sy-subrc = 0.
              Convert it into PDF using 'CONVERT_OTFSPOOLJOB_2_PDF'
              then attach it and send a mail.....with all properties set such as Delivery report....
          endif.
    If you have any issues, please let me know........
    Thanks & Regards,
    Vamsi

  • Regarding SUBMIT (report) statement.

    Hi experts,
      Inside an RFC I am calling a custom report which gives the  output in the form of ALV grid. I have used SUBMIT (report) in the RFC for a given set of inputs.
    it_sel is an internal table with the selection screen parameters and values.
    This is my code.
      SUBMIT zmmrep03_r3ent WITH SELECTION-TABLE it_sel
      EXPORTING LIST TO MEMORY AND RETURN.
    Doing so, I am encountering a problem. When I run the RFC in test frame I am viewing the output which should not happen since i am using  <b>Exporting List to Memeory And Return</b>. After that I am getting a runtime exception <b>"NOT FOUND"</b>.
    How to resolve this problem.
    Regards,
    Arul Jothi.

    Arul,
    1. ALV does not export the list to memory.
    2. You cannot call a RFC that writes data to the screen.
    You need to find a differen way of doing this in your case.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • 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

  • 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

Maybe you are looking for

  • Optimizing JOIN

    In the process of looking into an application's performance issues with large data sets I found the primary culprit to be a single SQL query in a PL/SQL package. The call CALL MY_PKG.MY_FUNCTION(7) contains the following select statement that takes ~

  • TS1538 restore itunes? after getting a new ipod

    My 6th generation iPod broke, had to get a new one.  Now I am trying to restore. Am afraid I will lose all my music although it is backed up on my computer. Any pointers or ideas before I proceed?

  • Issue while passing Target URL dynamically in SOAP Receiver Adapter

    Experts, I am stuck with an issue while passing the Target URL dynamically. The UDF required for this works just fine. I can see the Target URL in Dynamic Configuration header(The Key is TServerLocation) in SXMB_MONI but the request that I am sending

  • Adobe Flash Player Plugin Problem (Not listed)

    Installed latest Adobe Flash Player, continually have to enable and disable if for YouTube I have tried uninstalling and re-installing and Firefox itself too, got all the updates. When going to full screen viewing I get a blank white screen..This I h

  • Ensure HA for servers on stacked Cisco 3750g Switches?

    Please bear with me. I'm fairly new to the sys admin world. Though I have a grasp on Cisco Switch technology, the grasp is certainly not solid. I've been tasked by my IT director with finding a device-level redundancy plan for our critical systems. W