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

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 get the displayID when using X-window to access solaris server?

    I want to get the displayID in my programme when use X-window to access solaris on the server,but i don't know which the API in java?Somebody can tell me?
    Thanks.

    Try deleting the Server.app and download it again from the App Store, restart.
    My Server is also using self signed certificates and is working with iOS device (Trust Profile needed first).

  • 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

  • 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 total number of plants, employees, jobs and respective tasks

    Hi Gurus,
    I have requirement where in I need to give client information about root object. Information being sought is on the total number of plants, employees, jobs and respective tasks performed by employees.
    Is there any standard report available to fetch this information? Or please let me know how to collect all this information?
    Thanks in Advance.
    Rupali

    Total number of employees S_AHR_61016369
    Jobs S_AHR_61016497
    Tasks S_AHR_61016522, S_AHR_61016523 & S_AHR_61016524

  • How to get SPOOL ID while using NEW-PAGE statement

    Hi Experts
    I am using "NEW-PAGE  PRINT ON......PRINT OFF" statement to write directly in to the spool.  while in this processing i want to get the SPOOL ID under which data is written. Is it possible? if yes, how ?
    Thanks in Advance
    Mukundhan

    Hi
    Check the system field
    <b>sy-spono</b>
    for Spool ID at that place of code
    Reward points if useful
    Regards
    Anji

  • How to get the return when use this function ----- getUsersInGroup()

    how do we assign list of nodes that getUsersInGroup() returns? And how do we get the result of the returns? And where is the groups and users config files? I am attempting notifications to all users in a group. Thank you!!

    Why do you want to do that, you cannot attach a VO which is not present in the AM. Can you elaborate on your requirement.

  • [Win VC++ 6.0 ]How to get the number of files count in a folder using VC++ 6.0?

    Hi all,
    Can any one tell how to get the number of files(.EPS) count inside a folder when the folder path is specified in VC++ 6.0?
    Thanks in Advance.
    Regards
    myriaz

    I'm a little confused by the question, but it sounds like you're asking how to count the number of files with a particular extension in a given directory? That's not really an AI SDK question, but it's a fairly easy one to find if you google it. If you're trying to use Illustrator to do it, AI doesn't have a general purpose file API. It has a few functions to do some things that Illustrator needs, but I don't think enumerating directories is one of them.

  • How can we get ADFSecurity work when used in OC4J, OID and OAM?

    I am getting error in http server log "mod_oc4j: Response status=499 and reason=Oracle SSO, but failed to get mod_osso global context."
    But I am not using Oracle SSO and my client doesn't want to use it either, I am using OAM SSO(CoreIDSSO) in my configuration. Please read the details below.
    I am using ADFSecurity in an app that is protected by OAM. To migrate ADFSecurity permissions from
    system-jazn-data.xml to OID, I used JAZNMigrationTool to populate OID with Grantees and Permissions. OAM gives login page, and authentication works fine.
    But ADFSecurity is not working. ADFComponent Delete button is enabled even for roles that dont have permissions for the iterator delete.
    - The app works fine when I use without OAM. ADF Security permissions work fine.
    - The app works fine when used with OAM, but with ADFSecurity disabled (enforce=false).
    - When I enforce ADFSecurity alongwith OAM, ADFSecurity is not working.
    In the doc "Oracle Containers for J2EE Security Guide b28957", there is a mention of use of CoreIDPrincipal for permissions. Our OID Permissions entries show
    LDAPRealmRole for attribute orcljaznprincipal. I am not sure if this could be the reason.
    We have configured AccessServerSDK for the SOA instance and have policy for the urls in the policy manager. We have entries in orion-application.xml, orion-web.xml and system-jazn-data.xml as per the documentations.
    How can we get ADFSecurity work when used with OID and OAM?

    Have you been able to successfully integrate OAS with OAM & OID? We have similar requriement and so far we have not been able to get it working.
    We have application specific roles which we map to OID roles using orion-application.xml.
    Any pointers to achieve this would be greatly appreciated.
    thanks,
    Dipal

  • I cannot see my Iphone 4 in my device window in the finder anymore.  It use to appear so I could copy the camera pictures off of it and transfer them to other folders.  Does anyone have and idea how to get it back when you plug it in initially.  Thanks

    I cannot see my Iphone 4 in my device window in the finder anymore.  It use to appear so I could copy the camera pictures off of it and transfer them to other folders.  Does anyone have and idea how to get it back when you plug it in initially.  Thanks

    You will want to open iPhoto, go to the iPhoto menu and select Preferences. Under the General tab, next to Connecting camera opens: select iPhoto. Close the preferences and quit iPhoto. Reconnect your iPhone 4. iPhoto should open automatically and offer to import your pictures. Import them and then do what you want with them.
    Best of luck.

  • How to get STPOV structure values using BOM number and Plant number

    hello All,
    could you please help me out
    'How to get  STPOV structure values using BOM number and Plant number'
    is there any function module where can i give input as bom and plant number .
    waiting for your response.
    regards
    srinivas

    I did a quick where-used lookup in SE11 on the structure STPOV in function module interfaces and came up with the following:
    Function Module                             Short Description                                          
    CK_F_TOTALCOST_COMPUTE                                                                      
    CS_ALT_SELECT_COUPLED_PRODUCT                                                               
    CS_WHERE_USED_CLA                Bills of material; class use                               
    CS_WHERE_USED_CLA_ANY        Bills of material; direct class use or via other class     
    CS_WHERE_USED_CLA_VIA_CLA        Bills of material; class use via classes                   
    CS_WHERE_USED_COP                                                                           
    CS_WHERE_USED_DOC                Bills of material; document use                            
    CS_WHERE_USED_DOC_ANY:Bills of material; direct and (indirectly) document use via
    CS_WHERE_USED_DOC_VIA_CLA        Bills of material; document use via classes                
    CS_WHERE_USED_KNO                Bills of material; use object dependency                   
    CS_WHERE_USED_MAT                Bills of material; where-used list                         
    CS_WHERE_USED_MAT_ANY:Bills of material; where-used list as article or class item
    CS_WHERE_USED_MAT_VIA_CLA        Bills of material; where-used list via classes             
    EXIT_SAPMC29M_001                BOM; Article Where-Used List   
    It appears that this structure is primarily used for where-used look-ups for components within the BOM.  I don't know if any of these are what you're in need of.
    Hope this helps,
    Mark Schwendinger

  • How to find Spool number for a 2 steps background job.

    Hi All,
    How to find spool number (and also the background job name ) for a 2 steps background job.
    in the table TBTCO i can see step numbers but i dont get the spool number. Is there any link between TBTCO and TSP01.
    Also after getting the spool number i need to drill down on ALV report. I hard coded the spool number and was able to drill down using BDC and call transaction but when i press back button it is not returning to the ALV report.
    Thanks,
    Shiva.

    Which one creates the spool? (first one I guess)
    What kind of spool? (WRITE, sapscript, smartform, pdf...)
    Do you use special statements like NEW-PAGE, or other things?
    Are you sure that the spools are generated by these jobs? (did you compare the spool generation times and job run dates to be sure...)

  • How to get spool along with e-mail or FAX

    Hi,
    I have a requirement where i have to produce a spool even i go for e-mail or FAX option when the script is triggered.
    I am using a standard program where it is coded to have either of the option. i.e. either we have to go for a printer or e-mail or FAX.
    Could any one suggest me how to get spool along with e-mail or FAX option.
    Thanks in advance.

    Hi,
    check this:-[http://help.sap.com/saphelp_nw04/helpdata/en/a5/28d3b9d26211d4b646006094192fe3/frameset.htm]
    hope u'll get some idea.
    Regards,
    Sneha.

  • 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

Maybe you are looking for

  • Crop mark issue when placing and PDF in Indesign

    I've just had this strange issue that I can't figure out and I'm not sure if anyone else has had it as well. I exported a PDF through InDesign with crop marks. I then placed the PDF in Indesign  and for some reason the bleed and the crop marks don't

  • SDM on 7600 series

    Hy, I have a 7609 and when logging with SDM v2.4 it says, it is an unsupported router. At: http://www.cisco.com/en/US/products/sw/secursw/ps5318/prod_installation_guide09186a00803e4727.html#wp37069 I can't see the model, though I was wondering isn't

  • Connecting an Extreme to coaxial cable?

    I have Time Warner cable and everything goes through coaxial cable with them. I have very few ethernet ports in the walls in my home, though I have coaxial cables ports in almost each room that they can make active so I could move my Airport Extreme

  • Istore keeps freezing my computer

    I just updated to the new itunes on my computer. Now, whenever I try to access the istore the page starts to load and then my whole computer freezes.  What should I do?

  • 10.8.4 (server) and windows file sharing problem

    Hello This is a clean install of 10.8.4 and server apps not and upgrade of 10.5.8 (This server had a working 10.5.8 server install.... sigh!) AFP, SMB and guest access enabled on all shares Guest sharing enabled in the User accounts in System prefenc