Generating SP01 spool reports in background

Good morning BASIS Gurus
I have a quick question. I am required to generate a list of spool requests (SP01) every week, showing SP01 information for a selected group of printers. This is done for charge-backs (number of printouts for a specific unit).
The problem is three-fold:
1. I need to be able to run SP01 in the background.
2. I need to create a variant to allow for the dates and the list of printers. The list of printers does not change week to week, so this is not a big deal.
3. I need to be able to run the report and mail the resulting report to an SAP internal email. Once the report is generated I can do this part.
The first two steps are the source of my headache.
Any help/suggestions are greatly appreciated.
I run ECC6.
Thanks
Juan

Hola Juan,
I think you can query the TSP01 table for those details... a simple program will do this job, talk to your abaper
Regards
Juan

Similar Messages

  • Regarding running a report in background and generate spool

    Hi,
    I am developing a report [<b>REPORT1</b>].
    It is taking long to execute if data is more.
    Now i want to schedule this report in background and generate spool along with.
    So once i execute REPORT1 it should run in background & generate spool?
    Can anybody give inputs for the same!
    Thanks,
    Deep.

    Hi,
              to generate spool, use below code
    FORM create_spool .
    CONSTANTS : l_c_device(4) VALUE 'LOCL'.
    Create Spool Request
    NEW-PAGE PRINT ON
    LINE-SIZE 120
    DESTINATION l_c_device
    IMMEDIATELY ' '
    KEEP IN SPOOL 'X'
    NEW LIST IDENTIFICATION 'X'
    NO DIALOG.
    ENDFORM. " create_spool
    And after createing spool to get the spool number use below code,
    FORM obtain_spool_id .
    TYPES : BEGIN OF t_tsp01,
    rqident TYPE tsp01-rqident,
    rqowner TYPE tsp01-rqowner,
    END OF t_tsp01.
    DATA : it_tsp01 TYPE STANDARD TABLE OF t_tsp01,
    wa_tsp01 LIKE LINE OF it_tsp01.
    SELECT rqident
    rqowner
    FROM tsp01
    INTO TABLE it_tsp01
    WHERE rqowner = sy-uname.
    SORT it_tsp01 BY rqident DESCENDING.
    READ TABLE it_tsp01 INTO wa_tsp01 INDEX 1.
    IF sy-subrc = 0 .
    v_spool_nr = wa_tsp01-rqident.
    ENDIF.
    Capture the immediate spool created for this report
    v_spool_nr = sy-spono.
    ENDFORM. " obtain_spool_id
    <b>Reward points</b>
    Regards

  • ALV report display online and generate in spool

    Dear expert,
    I have created an ALV report. I want to run this report online. After executed, the report is displayed. After display this report, I also want to generate the output report in the spool. Is there any way to do this? Thank you.
    I have tried to use submit...to SAP Spool. in this way, it will generate the spool, but it will not display the report online. I want it both display online and generate a spool.

    well forget yout the new-page print on thingie, since you use ALV.
    if you had a write list this trick would be cool since you just could do following:
    Do 2 times.
      if sy-index GT 1.
        new page print on.
      endif.
      loop at itab into wa.
        write stuff....
      endloop.
      if sy-index GT 1.
        new page print off.
      endif.
    enddo.
    /edit arrrgh forgot to write further...
    with your ALV you could process a write list as well after displaying but you will have layout differences between your display and your spool then and i dont think that this is what you want/need.
    you could however after display process your programm a second time, in background task and give it a printer where to print to. Since ALV wont get executed in background task you will get a spool instead.
    Edited by: Florian Kemmer on Sep 15, 2010 2:40 PM

  • Not generating a spool output in the background job

    Hi Team,
    I have an alv report and If I schedule the program using SM36 transaction it is not generating the spool ouput.
    If I run the same program in background mode when we use se38 and select execute in background in program menu and it works successfully and generates alv grid list in the spool output.
    But, user wants to schedule the job in sm36 and check the same output in spool. Please advise why it is not generating.
    Note:I am using the cl_salv_table=>factory method to generate the output.
    Thanks in advance,
    Sunil Kumar.

    This is not really an ABAP question and you might want to ask your Basis admin for assistance. But I believe that spool will not be generated if you don't specify print parameters for a step. When you define the step in SM36, make sure to specify the print parameters.

  • Creating spool for ALV report in background

    Hi,
    Can we create a spool request if we run in background/forgorund? please help me..
    I am very much thankful for your quick responses.

    Yes we can create it. Execute the report in background using SM36 and then u can view the output using SM35 or the spool request number and tcode SP01.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Alv show in report but when see in spool (after run background job) there i

    my program have some error when i run result alv show in report but when see in spool (after run background job) there is no data, (other program can see result in spool)
    Please help
    here is some example of my program
    ********************************declare internal table*****************************
    internal table output for BDC
    data : begin of t_output occurs 0,
    bukrs type anla-bukrs,
    anln1 type anla-anln1,
    anln2 type anla-anln2,
    zugdt type anla-zugdt,
    result(70) type c,
    end of t_output.
    *****get data from loop********************************
      loop at t_anla.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  INPUT  = t_anla-anln1
             IMPORTING
                  OUTPUT = t_anla-anln1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  INPUT  = t_anla-anln2
             IMPORTING
                  OUTPUT = t_anla-anln2.
    check record is correct or not
        select single bukrs anln1 anln2 zugdt
        into w_output
        from anla
        where bukrs = t_anla-bukrs and
        anln1 = t_anla-anln1 and
        anln2 = t_anla-anln2
       zugdt = '00000000'
    if record is correct
        if sy-subrc = 0 and w_output-zugdt = '00000000'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Yes : this asset can delete'.
          append w_output to t_output.
    if record is not correct
        elseif sy-subrc = 0 and w_output-zugdt <> '00000000'.
    there is error record  this asset have value already
          v_have_error = 'X'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Error : this asset have value already'.
          append w_output to t_output.
        else.
    there is error record this asset donot exist in table anla
          v_have_error = 'X'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Error : this asset doest not exist'.
          append w_output to t_output.
        endif.
    *end of check record is correct or not
        clear w_output.
      endloop.
    ******************************show data in ALV***************************************************
    show data from file in ALV
      perform display_report_ALV.
    *&      Form  display_report_ALV
    form display_report_ALV.
      DATA: LT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
          LT_EVENTS TYPE SLIS_T_EVENT,
          LV_REPID LIKE SY-REPID.
      PERFORM ALV_DEFINE_FIELD_CAT USING LT_FIELD_CAT.
      PERFORM ALV_HEADER_BUILD USING T_LIST_TOP_OF_PAGE[].
      PERFORM ALV_EVENTTAB_BUILD USING LT_EVENTS[].
      LV_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = LV_REPID
                IT_FIELDCAT        = LT_FIELD_CAT
                I_SAVE             = 'A'
                IT_EVENTS          = LT_EVENTS[]
           TABLES
                T_OUTTAB           = t_output
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
      IF SY-SUBRC NE 0.
        WRITE: / 'Return Code : ', SY-SUBRC,
          'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
      ENDIF.
    endform.
    *&      Form  alv_define_field_cat
          text
         -->P_LT_FIELD_CAT  text
    FORM ALV_DEFINE_FIELD_CAT USING  TB_FCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA: WA_FIELDCAT LIKE LINE OF TB_FCAT,
        LV_COL_POS TYPE I.
      DEFINE FIELD_CAT.
        CLEAR WA_FIELDCAT.
        ADD 1 TO LV_COL_POS.
        WA_FIELDCAT-FIELDNAME = &1.
        WA_FIELDCAT-REF_TABNAME = &2.
        WA_FIELDCAT-COL_POS = LV_COL_POS.
        WA_FIELDCAT-KEY = &3.
        WA_FIELDCAT-NO_OUT = &4.
        WA_FIELDCAT-REF_FIELDNAME = &5.
        WA_FIELDCAT-DDICTXT = 'M'.
        IF NOT &6 IS INITIAL.
          WA_FIELDCAT-SELTEXT_L = &6.
          WA_FIELDCAT-SELTEXT_M = &6.
          WA_FIELDCAT-SELTEXT_S = &6.
        ENDIF.
        WA_FIELDCAT-DO_SUM = &7.
        WA_FIELDCAT-OUTPUTLEN = &8.
        APPEND WA_FIELDCAT TO TB_FCAT.
      END-OF-DEFINITION.
      FIELD_CAT  'BUKRS'  'ANLA'     'X' '' 'BUKRS' 'Company Code' '' ''.
      FIELD_CAT  'ANLN1'  'ANLA'     'X' '' 'ANLN1' 'Asset Number' '' ''.
      FIELD_CAT  'ANLN2'  'ANLA'     'X' '' 'ANLN2' 'Asset Sub Number' '' ''.
    FIELD_CAT  'ATEXT'   'T5EAE'     'X' '' 'ATEXT' 'Result' '' ''.
      FIELD_CAT  'RESULT'  ''     'X' '' 'RESULT' 'RESULT' '' ''.
    ENDFORM.                    " alv_define_field_cat

    Hi,
    Check this code..
    FORM display_report_alv.
      DATA: lt_field_cat TYPE slis_t_fieldcat_alv,
      lt_events TYPE slis_t_event,
      lv_repid LIKE sy-repid.
      PERFORM alv_define_field_cat USING lt_field_cat.
      PERFORM alv_header_build USING t_list_top_of_page[].
      PERFORM alv_eventtab_build USING lt_events[].
      lv_repid = sy-repid.
      IF sy-batch EQ 'X'.  ----> " System Field for Backgroud..if Background use list display
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = lv_repid
            it_fieldcat        = lt_field_cat
            i_save             = 'A'
            it_events          = lt_events[]
          TABLES
            t_outtab           = t_output
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = lv_repid
            it_fieldcat        = lt_field_cat
            i_save             = 'A'
            it_events          = lt_events[]
          TABLES
            t_outtab           = t_output
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ENDIF.
      IF sy-subrc NE 0.
        WRITE: / 'Return Code : ', sy-subrc,
        'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
      ENDIF.
    ENDFORM.                    "display_report_ALV

  • Report in background without spool list generation

    Hi everyone!
    I want to run a standard report RMMRP000 in backgroun, only I don't want it to generate a spool list. Fiddling with the output options, I was only able to make it generate a summarized list, instead of the mode datailed one that is currently being printed.
    My question is this:
    Is it possible, when we create the job, to disable spool list generation, even if the associated report always returns a list?
    Best Regards,
    Luís Andrade.

    one thing you could try: wirte a small program which SUBMITS RMMRP000 with the addition EXPORTING LIST TO MEMORY. I guess you need to replicate the selection screen of RMMRP000 into your own program, but you could avoid the spool this way.

  • Spool report line width in background jobs

    Hi All,
    I wrote a report and specified the line size in the report header:
    REPORT /sappssrm/option_handler
    NO STANDARD PAGE HEADING
    LINE-SIZE 185.
    I want to run this report as background job and get a spool list with results of the report. I expected the width of the spool output to be well defined and it works in one system. However, in another systen, the line / page width is much smaller, and the system inserts line breaks in the output splitting my lines into two which causes very ugly results.
    It seems that the LINE-SIZE specified in the report header doesn't affect the output width in every system.
    Can anyone advice?
    Regards
    Wolfgang

    Hi Siggi,
    thanks for your reply. Actually I changed that already yesterday...
    But I found out what it was:
    It seems, the background job keeps old versions of the program, even if you import a new program version. I created a new job with the same program and it worked.
    Thanks again and best regards
    Wolfgang

  • Generating WWI Report in Background by JOB in SM36

    Hello,
    I have got a requirement to generate WWI report for specification and save it to Desktop using Program which will be scheduled in Background.
    I have found some Standard Function module (C12H_WWI_DISPLAY_DIRECT) which generates and displays the report in foreground. When I use that FM in program and schedule that program in Background , it is not generating any report for specification.
    Please anyone has any suggestion of how to generate WWI report for specification in background.
    Thanks ,
    Sujit

    Dear Sujit
    topic has been discussed very often in EHS FORUm. As reference: Bulk MSDS Download
    C.B.
    PS: according to my knowlegde: C12H_WWI_DISPLAY_DIRECT is used to get a WWI report for "client"; the document is not stored in SAP DMS etc.; therefore: this is no "real" report. EHS knows a functionality to show onclient level (SAP GUI) the WWI report. But the content is not "verified" by an expert.
    In any case may be these threads might be of interest:
    Invoke WWI from WebDynpro Application
    RFC to display MSDS reports
    Problem while generating the WWI Reports from Portal

  • Generate spool smartforms in background

    Dear friends,
    How to generate direct spool in background without showing any popups
    Regards,
    Praveen Lobo

    Hi
    DO like this as per sample code:
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT Yreport
                          WITH s_kunnr IN s_kunnr                     
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              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
              invalid_target       = 8
              OTHERS               = 9.
          IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
    Regards
    Anji

  • A spool should be generated with the report screen which can be later used

    There is a transaction ZJPVOM301, After I execute this transaction for the program, it generates a report of the sales order and gives the details like Document, Date and processing status. Now the requirement is:
    REQUIREMENT:
    A spool should be generated with the report screen which can be later used for tracking purpose i.e,
    Transfer programs SAPMZJPV301 and ZJPVOM327 need to be fixed so that the result of processing is stored in a spool, to be printed out at any time.  Currently, if there is a problem in processing, a report is displayed at the end of the program run, but it is not saved anywhere.  If the user does not save a screen shot, it is very difficult to trace problem areas in this program. Plz. kindly give me the reply as early as possible.

    Hi,
    Use FM : <b>RSPO_SX_OUTPUT_TEXTDATA</b> to create spool , if report output data is available in internal table.
    Regards
    Appana

  • Running ALV REPORT in background

    Hi Experts ,
    Before writing this query , i went through all the threads related to ALV report in background . But found none of them satisfactory .
    I am running a alv report in background . I am not using OO ALV . I am using " REUSE_ALV_GRID_DISPLAY" .
    This report is schedules through a background job . It is creating a spool .
    But I am getting a error message : *" FRONT END NOT AVIALABLE "*
    What i have found so far :
    I am planning to use sy-batch variable to check whether it is running in background or not , Then I am planning to read  the spool and if the spool is created , i will display the ALV .
    Is this the correct approach or some other way to generate the ALV REPORT .
    Also by this way will the error message *" FRONT END NOT AVIALABLE "* go .
    Please advice .
    Regards,
    Abhishek

    Hello Everyone ,
    Thanks for your replies .
    I have the spool generated . But it is waiting status .
    The issue here is how I am going to say that the spool is in " Completed " status . Because only after when my spool is in completed status , I want to display the status .
    Is there way for this ?
    Regards ,
    Abhishek

  • Problem in spool report

    Hi All,
    I have executed one report(Z report) in Production by Background, that has generated Spool report.
    My problem is some fields are cut-off(missing) from that spool report.
    Please provide the solution ASP.
    Regards,
    DSK.

    Hi DS
    Do one thing: Configure your text editor as follws:
    Go to Utilities->Settings->Downwards-Compatible Line Length(72) .
    Hope you can away from the spool request now.
    Have a look on the OSS note:
    <b>
    https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=534487&nlang=EN&smpsrv=https%3a%2f%2fwebsmp201%2esap-ag%2ede</b>
    Summary
    Symptom
    A list that includes more than 255 columns in the background is supposed to be issued. Instead of broad list lines being distributed on several printed lines for every 255 columns, only a single truncated printed line appears.
    Other terms
    Lists, print, 255 columns
    Reason and Prerequisites
    A Support Package which allows the printing of broad lists was imported. This creates a broad line of print with more than 255 columns in the spool. Generally, this is desired.However, the problem occurs if no corresponding format is defined because the default format X_65_255 truncates the line correspondingly at the print output.
    Solution
    1.) Define a format which can output the required number of printing columns.
    2.) Using the attached correction, the number of columns in the print dialog can be changed in this special case.If a column figure of 255 is now entered, the old behavior is active again.The correction is only effective if you imported note 501826 beforehand.
    Header Data
    Release Status: Released for Customer
    Released on: 13.06.2003  07:44:06
    Priority: Correction with medium priority
    Category: Program error
    Primary Component: BC-ABA-LI List Processing
    Releases
    Software
    Component Release From
    Release To
    Release And
    subsequent
    SAP_BASIS 46 46B 46B  
    SAP_BASIS 46C 46C 46D  
    Highest Implemented Support Package
    Support
    Packages Release Package
    Name
    SAP_BASIS 46B SAPKB46B44
    SAP_BASIS 46B SAPKB46B48
    SAP_BASIS 46C SAPKB46C36
    SAP_BASIS 46C SAPKB46C40
    Related Notes
    586914 - Workaround for printing signature data via CJ00 or DSAL
    Print Selected Notes (PDF) 
    Regards,
    Sree
    Message was edited by:
            sree ram

  • Executing Report in Background

    Dear All,
    I have a report with more than 400 characters in width. If it is executed in foreground the report is properly displayed but if the report is executed in background, the generated spool only displays upto 255 characters.
    Is there a way to execute the report in background and make sure that the spool is generated with required width?
    Regards,
    Anosh

    Hi Sharabh,
    I have tried printing it after unchecking the "spool request max 255 characters width" option. Still the generated report does not show the report upto 400 characters.
    Can you please suggest some other solution or maybe provide a way to define our own printing format?
    Regards,
    Anosh

  • Scheduling of ALV Reports in Background

    I have schedule a Report in the Back ground and also entered the spool list so that the mail can be sent to the said users but when the Report is recvd in the mail box it is recvd as html and there are many columnns in my report that are not visible.
    can i schedule the report and send the report as an excel attchement in the background processing if so then how can i do that
    you early reponse will be appreciated
    abhishek

    Hi,
    Once you schedule the ALV report in background you will not get the entire list as it is. The output lenght of the ist generated in the background is set to 255 characters and generally data exceeding this lenght will be turncated.
    You cannot download a report in excel in background. The FM's GUI_download will not work in backgorund. You will have to write the data on the application server and then write an additional program to read that data or alternatively use some of the std tcodes to fetch that data to the presentation system.
    CHeers
    VJ

Maybe you are looking for