Reading spools

Hi,
How can we read the data in the spool using ABAP program? I am already aware of the function module "RSPO_RETURN_ABAP_SPOOLJOB" using which we can get the data in the spool into an internal table. But here we can't read the internal table for specific records.
Please let me know if there is any other way for reading the spool for specific data.
Regards,
Vinod.

Hi Vinod,
TSP01 is the table which stores all the spool numbers.
Use the spool no to get the spool data using FM RSPO_DOWNLOAD_SPOOLJOB it’ll download the spool to PC using the spool number.
To display the spool you can use...
RSPO_DISPLAY_ABAP_SPOOLJOB
RSPO_DISPLAY_SPOOLJOB
Regards,
KK

Similar Messages

  • Reading Spool files from AS400 through JAVA Applications

    Hi,
    i am trying to read spool fiels through my java application with the help of jt400.jar files,which is developed by IBM.When i try to display the content of the spool file the result is look like this and give some ideas to come out from these
    problems.
    thanks in advance
    selvin
    --- 4- 4++++�+-+@z 4++-_��++_� 4+3@+@+@_���������@M_�����?�] 4+
    s+-�+@z 4+@@@@� � 4+__++@+-@z 4+___ 4+++++++ 4+s--�+@z 4+z_a_�a___� � 4+:-
    ?��@z 4+B__a_�a___� 4+s�+++@z 4+|��z_�z_� � 4+:-�?���@z 4+C__� 4+G` 4+I___ �� 4+
    -�?��� 4+-�?��� 4+B���?�@+�M�] 4+T@@���?� 4+j���?�@_?��� � 4+@+��� 4+@+?�� 4
    B��@����� 4+T+�?����� 4+k��@_�?��� � 4+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~ � 4+__� 4+
    ---++ 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+___ 4+
    ---_++++--+ 4+B@@@@_ 4+Q@@@@@_�k___ 4+j@@@@@@@@@@@@_�k_�_K__ � � 4+___ 4+
    ---++++� 4+B@@@@� 4+Q@@@@@�k___ 4+j@@@@@@@@@@@@__k___K__ � � 4+___ 4+
    ----- 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+@@@@@@@@@@@@@@@@@@
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ � 4+'�+--@��-+@z 4+C@@@@_ 4+R@@@@@�_k___ 4+
    k@@@@@@@@@@@@��k��_K__ � 4+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If you were expecting the spool file to be translated to ASCII with carriage returns, line feeds, and form feeds, here is the magical piece of code:
    SpooledFile splf = new SpooledFile(sys, splfName, splfNum, jobName, jobUser, jobNum);
    PrintParameterList pl = new PrintParameterList();
    pl.setParameter(SpooledFile.ATTR_MFGTYPE, "*WSCST");
    pl.setParameter(SpooledFile.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPDEFAULT.WSCST");
    InputStream in = splf.getTransformedInputStream(pl);
    For reasons not immediately clear to me, the first character in the file appears to be a null byte (hex 0). I also believe that CRs and LFs only appear as needed to return to the beginning of the line (CR) and the feed one line (LF). It is permissible for example to have <data><CR><LF><LF><LF> (i.e. feed three lines). I also assume that <data><CR><data><CR><LF> would result in overprinting (missing line feed). I have even seen <data><CR><CR>, and I assume the second CR should be ignored.
    I have not exhaustively tested these scenarios, but from some of the problems we've had, the above description seems like a reasonable way to think about the data stream

  • Schedule Job and Read Spool

    Hi Guru's,
    my requirement is
    1.I need to run one standard program 3 times with 3 diffrent selection's.
    2.the resultant 3 diffrent ouput will be displayed in only ONE output.
    ( the prgram should have the capalibilty to ceate 3 diffrent jobs simulatenously I.e submitting  the job in background once submit dont wait for the result sicne this should be stored in spool and then submit the secound and thrid)
    after scheduling this 3 prgram program need to wait until all this 3 jobs beein scheduled which were running in paralled to complete. then read ther respective spool and output one result .

    Hi,
    You can check if FM: 'SUBST_SCHEDULE_BATCHJOB' is available on your system ,
    There u can pass the following parameters
    IMPORT
    REPNAME = "Name of the Report"
    LANGUAGE = 'Language in which job should run"
    SDLSTRTDT = "Start date"
    SDLSTRTTM = "Start time"
    STRTIMMED = 'X' = Immediate start
    TABLES
    SELTAB = "to fill selection screen"
    use this FM 3 times with different selections
    Get the Spool Numbers & Read them
    Regards,
    Gaurav

  • Create spool in a program and read spool in same program

    hi all,
    i have a requirement like i have to create a spool in a program and should read that spool and send a email in same program.
    i m done with creating spool and sending email but the problem is when i execute a program the spool is created only after total program execution, is there a way to create a compleate spool before finishing the report execution.
    thanks,

    Solution:
    call function 'GET_PRINT_PARAMETERS'
          exporting
            destination    = 'LP01'
            copies         = count
            list_name      = 'ZTEST'
            list_text      = 'ZTESTSPOOL'
            immediately    = ' '
            release        = 'X'
            new_list_id    = 'X'
            expiration     = days
            line_size      = 90
            line_count     = 65
            layout         = 'X_PAPER'
            sap_cover_page = 'X'
            receiver       = 'SAP*'
            department     = 'System'
            no_dialog      = 'X'
          importing
            out_parameters = params
            valid          = valid.
        new-page print on parameters params no dialog.
    write : hi this is the test for spool.
    new-page print off.
        commit work.
    write : / sy-spono.   "system variable for spool no
    solved thanks
    anupama.

  • Read spool of a program and sent the content in a email

    Hi Guys,
    I have a problem while executing a Report program in background.if i run the prg in foreground the content of the report is fully populated in the lotus Email.But when i run the same prg in background.....the email is populated with only  last three lines  of the report.I am extrating all the content of the report in to an internal table and passing to the function..'SO_NEW_DOCUMENT_SEND_API1'.
    please help me out to over come this issue....is there that i need to do  specify spool recepients list...while scheduling a background job...or....can i read the spool of the prog and read the spool content into an internal table and pass it to the above function module....in the same prg....
    Please help me....
    Full points will be awarded...
    Thanks,
    Radha

    hi Radha,
    try out this way......
    1) when u r writing to the spool (r simply writing in background), u try out this way,
    loop at itab.
    write itab.
    endloop.
    new-page.
    commit work.
    new-page print off.
    2) then call fm "get_job_runtime_info" to get the jobname, jobcount and stepcount.
    3) select listident(Spoolnumber) from table "tbtcp" for the above values with listident ne 0.
    4) read the spool into a table using any std sap fm.......
    Pls reply if this works.... i assume that u didnt send the contents in mail as any attachments right?
    (Note  = u can only c the spool contents in SP01, after the prog executed)
    (Also u can try this in debugging in background using SM50, creating an infinite loop in the code).......

  • Read spool - convert to PDF - FTP transfer

    Hi,
    How can I read a particular spool then convert it to PDF and transfer the PDF file to another system using FTP?
    Can anybody give me sample code or tutorial how to do this.
    thank you very much!!!
    james

    Hi,
    Make use of the following functions to do the required job.
    1. CONVERT_ABAPSPOOLJOB_2_PDF - Converts the spool to pdf file
    2. FTP_CONNECT - connects to the FTP server
    3. FTP_COPY - copies the file from source to the destination
    4. FTP_DISCONNECT - terminates the connection
    Regards,
    Vadi

  • Read spool data and send it through e-mail as .txt or .xls attachment

    Hi All,
    I have to read the spool data and send it via e-mail as .txt or .xls attachment. I have used FMs LIST_TO_ASCI, RSPO_RETURN_SPOOLJOB and SO_SOLITAB_TO_SOLIXTAB. I am using FM SO_DOCUMENT_SEND_API1 to send e-mail.
    My problem is, the text file being sent is not showing entire data. It's getting truncated after 255 characters. Is this a standard? If yes, then is there any work around for it?
    Alternatively, I can send the file as excel attachment. How can this be done?
    Thanks,
    Ashwini

    You will have to convert string to Xstring and then to binary to acheive this.
    Check this wiki to send a mail attachment with more than 255 characters.
    [https://wiki.sdn.sap.com/wiki/display/Snippets/Tosendamailattachmentwithmorethan255charactersinaline]
    Vikranth

  • How to read spool file and get the spool file number

    Hey everyone.
    I created a program ztemp that is calling another program ztemp2 within, ztemp2 creates a spool file. Now the requirement is I need to write a code within ztemp to download that spool request and then convert it to the pdf file. I know I can use program rstxpdft4 to convert the spool file to the PDF but for this I need to give the spool number, so can you please tell me how can I get the spool number and then fetch it to the program rstxpdft4 .
    Thank you.
    Rhul goel

    Hi,
       Please check the [link|Convert ABAP List to PDF and display without downloading first; (Rich's reply) and get the spool similarly.
    Or read from table TSP01 to get the latest spool using sy-uname.
    Regards,
    Srini.

  • Reading spool data

    Hello experts,
    I have been given an assignment to read an output from the spool file.
    I am asked to run report MB51 give materialno,posting date and run report
    for movement types 551,701.
    Then download the spool and read the records and identify them and
    do computations later on.
    I haven't worked on such a task before.If someone can give me such a coding
    snippet,i will be higly obliged.
    Points will be awarded for sure.

    Hi pick ur part from the below code
    *&u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *& Report  ZSPOOLTOPDF                                                 *
    *&u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& u2014u2014u2014                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    *&u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
    DEFAULT u2018abap at sapdev.co.uku2019,
    p_sender LIKE somlreci1-receiver
    DEFAULT u2018abap at sapdev.co.uku2019,
    p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    * Spool IDs
    TYPES: BEGIN OF t_tbtcp.
    INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
    wa_tbtcp TYPE t_tbtcp.
    * Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
    gd_eventparm LIKE tbtcm-eventparm,
    gd_external_program_active LIKE tbtcm-xpgactive,
    gd_jobcount LIKE tbtcm-jobcount,
    gd_jobname LIKE tbtcm-jobname,
    gd_stepcount LIKE tbtcm-stepcount,
    gd_error    TYPE sy-subrc,
    gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
    it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    gd_sender_type     LIKE soextreci1-adr_typ,
    gd_attachment_desc TYPE so_obj_nam,
    gd_attachment_name TYPE so_obj_des.
    * Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
    gd_destination LIKE rlgrap-filename,
    gd_bytecount LIKE tst01-dsize,
    gd_buffer TYPE string.
    * Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
    INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE u2018DEVu2019,
    c_no(1)     TYPE c   VALUE u2018 u2018,
    c_device(4) TYPE c   VALUE u2018LOCLu2019.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * Write statement to represent report output. Spool request is created
    * if write statement is executed in background. This could also be an
    * ALV grid which would be converted to PDF without any extra effort
    WRITE u2018Hello Worldu2019.
    new-page.
    commit work.
    new-page print off.
    IF sy-batch EQ u2018Xu2019.
    PERFORM get_job_details.
    PERFORM obtain_spool_id.
    *** Alternative way could be to submit another program and store spool
    *** id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
    *        to sap-spool
    *        spool parameters   %_print
    *        archive parameters %_print
    *        without spool dynpro
    *        and return.
    * Get spool id from program called above
    *  IMPORT w_spool_nr FROM MEMORY ID u2018SPOOLTOPDFu2019.
    PERFORM convert_spool_to_pdf.
    PERFORM process_email.
    if p_delspl EQ u2018Xu2019.
    PERFORM delete_spool.
    endif.
    IF sy-sysid = c_dev.
    wait up to 5 seconds.
    SUBMIT rsconn01 WITH mode   = u2018INTu2019
    WITH output = u2018Xu2019
    AND RETURN.
    ENDIF.
    ELSE.
    SKIP.
    WRITE:/ u2018Program must be executed in background in-order for spoolu2019,
    u2018request to be created.u2019.
    ENDIF.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM obtain_spool_id                                          *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM obtain_spool_id.
    CHECK NOT ( gd_jobname IS INITIAL ).
    CHECK NOT ( gd_jobcount IS INITIAL ).
    SELECT * FROM  tbtcp
    INTO TABLE it_tbtcp
    WHERE      jobname     = gd_jobname
    AND        jobcount    = gd_jobcount
    AND        stepcount   = gd_stepcount
    AND        listident   <> u20180000000000u2032
    ORDER BY   jobname
    jobcount
    stepcount.
    READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
    IF sy-subrc = 0.
    message s004(zdd) with gd_spool_nr.
    gd_spool_nr = wa_tbtcp-listident.
    MESSAGE s004(zdd) WITH gd_spool_nr.
    ELSE.
    MESSAGE s005(zdd).
    ENDIF.
    ENDFORM.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM get_job_details                                          *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM get_job_details.
    * Get current job details
    CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
    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.
    ENDFORM.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM convert_spool_to_pdf                                     *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM convert_spool_to_pdf.
    CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
    EXPORTING
    src_spoolid              = gd_spool_nr
    no_dialog                = c_no
    dst_device               = c_device
    IMPORTING
    pdf_bytecount            = gd_bytecount
    TABLES
    pdf                      = it_pdf_output
    EXCEPTIONS
    err_no_abap_spooljob     = 1
    err_no_spooljob          = 2
    err_no_permission        = 3
    err_conv_not_possible    = 4
    err_bad_destdevice       = 5
    user_cancelled           = 6
    err_spoolerror           = 7
    err_temseerror           = 8
    err_btcjob_open_failed   = 9
    err_btcjob_submit_failed = 10
    err_btcjob_close_failed  = 11
    OTHERS                   = 12.
    CHECK sy-subrc = 0.
    * Transfer the 132-long strings to 255-long strings
    LOOP AT it_pdf_output.
    TRANSLATE it_pdf_output USING u2018 ~u2019.
    CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
    ENDLOOP.
    TRANSLATE gd_buffer USING u2018~ u2018.
    DO.
    it_mess_att = gd_buffer.
    APPEND it_mess_att.
    SHIFT gd_buffer LEFT BY 255 PLACES.
    IF gd_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    ENDFORM.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM process_email                                            *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM process_email.
    DESCRIBE TABLE it_mess_att LINES gd_recsize.
    CHECK gd_recsize > 0.
    PERFORM send_email USING p_email1.
    *  perform send_email using p_email2.
    ENDFORM.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM send_email                                               *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *  u2013>  p_email                                                       *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM send_email USING p_email.
    CHECK NOT ( p_email IS INITIAL ).
    REFRESH it_mess_bod.
    * Default subject matter
    gd_subject         = u2018Subjectu2019.
    gd_attachment_desc = u2018Attachnameu2019.
    *  CONCATENATE u2018attach_nameu2019 u2018 u2018 INTO gd_attachment_name.
    it_mess_bod        = u2018Message Body text, line 1u2032.
    APPEND it_mess_bod.
    it_mess_bod        = u2018Message Body text, line 2u2026u2019.
    APPEND it_mess_bod.
    * If no sender specified - default blank
    IF p_sender EQ space.
    gd_sender_type  = space.
    ELSE.
    gd_sender_type  = u2018INTu2019.
    ENDIF.
    * Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
    tables it_mess_bod
    it_mess_att
    using p_email
    u2018Example .xls documnet attachmentu2019
    u2018PDFu2019
    gd_attachment_name
    gd_attachment_desc
    p_sender
    gd_sender_type
    changing gd_error
    gd_reciever.
    ENDFORM.
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       FORM delete_spool                                             *
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    FORM delete_spool.
    DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
    ld_spool_nr = gd_spool_nr.
    CHECK p_delspl <> c_no.
    CALL FUNCTION u2018RSPO_R_RDELETE_SPOOLREQu2019
    EXPORTING
    spoolid = ld_spool_nr.
    ENDFORM.
    *&u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *&u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014*
    *       Send email
    *u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-*
    FORM send_file_as_email_attachment tables it_message
    it_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    DATA: ld_error    TYPE sy-subrc,
    ld_reciever TYPE sy-subrc,
    ld_mtitle LIKE sodocchgi1-obj_descr,
    ld_email LIKE  somlreci1-receiver,
    ld_format TYPE  so_obj_tp ,
    ld_attdescription TYPE  so_obj_nam ,
    ld_attfilename TYPE  so_obj_des ,
    ld_sender_address LIKE  soextreci1-receiver,
    ld_sender_address_type LIKE  soextreci1-adr_typ,
    ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
    t_contents like solisti1 occurs 0 with header line,
    t_receivers like somlreci1 occurs 0 with header line,
    t_attachment like solisti1 occurs 0 with header line,
    t_object_header like solisti1 occurs 0 with header line,
    w_cnt type i,
    w_sent_all(1) type c,
    w_doc_data like sodocchgi1.
    ld_email   = p_email.
    ld_mtitle = p_mtitle.
    ld_format              = p_format.
    ld_attdescription      = p_attdescription.
    ld_attfilename         = p_filename.
    ld_sender_address      = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    * Fill the document data.
    w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name  = u2018SAPRPTu2019.
    w_doc_data-obj_descr = ld_mtitle .
    w_doc_data-sensitivty = u2018Fu2019.
    * Fill the document data and get size of attachment
    CLEAR w_doc_data.
    READ TABLE it_attach INDEX w_cnt.
    w_doc_data-doc_size =
    ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
    w_doc_data-obj_langu  = sy-langu.
    w_doc_data-obj_name   = u2018SAPRPTu2019.
    w_doc_data-obj_descr  = ld_mtitle.
    w_doc_data-sensitivty = u2018Fu2019.
    CLEAR t_attachment.
    REFRESH t_attachment.
    t_attachment[] = it_attach[].
    * Describe the body of the message
    CLEAR t_packing_list.
    REFRESH t_packing_list.
    t_packing_list-transf_bin = space.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 0.
    t_packing_list-body_start = 1.
    DESCRIBE TABLE it_message LINES t_packing_list-body_num.
    t_packing_list-doc_type = u2018RAWu2019.
    APPEND t_packing_list.
    * Create attachment notification
    t_packing_list-transf_bin = u2018Xu2019.
    t_packing_list-head_start = 1.
    t_packing_list-head_num   = 1.
    t_packing_list-body_start = 1.
    DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    t_packing_list-doc_type   =  ld_format.
    t_packing_list-obj_descr  =  ld_attdescription.
    t_packing_list-obj_name   =  ld_attfilename.
    t_packing_list-doc_size   =  t_packing_list-body_num * 255.
    APPEND t_packing_list.
    * Add the recipients email address
    CLEAR t_receivers.
    REFRESH t_receivers.
    t_receivers-receiver = ld_email.
    t_receivers-rec_type = u2018Uu2019.
    t_receivers-com_type = u2018INTu2019.
    t_receivers-notif_del = u2018Xu2019.
    t_receivers-notif_ndel = u2018Xu2019.
    APPEND t_receivers.
    CALL FUNCTION u2018SO_DOCUMENT_SEND_API1u2032
    EXPORTING
    document_data              = w_doc_data
    put_in_outbox              = u2018Xu2019
    sender_address             = ld_sender_address
    sender_address_type        = ld_sender_address_type
    commit_work                = u2018Xu2019
    IMPORTING
    sent_to_all                = w_sent_all
    TABLES
    packing_list               = t_packing_list
    contents_bin               = t_attachment
    contents_txt               = it_message
    receivers                  = t_receivers
    EXCEPTIONS
    too_many_receivers         = 1
    document_not_sent          = 2
    document_type_not_exist    = 3
    operation_no_authorization = 4
    parameter_error            = 5
    x_error                    = 6
    enqueue_error              = 7
    OTHERS                     = 8.
    * Populate zerror return code
    ld_error = sy-subrc.
    * Populate zreceiver return code
    LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
    ENDFORM.

  • Spool read data (sapscript output value)

    Hi Gurus,
    I need to read spool data. I tried following program ;
    DATA : mem_tab LIKE abaplist OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
      data(2000),
    END OF itab.
    SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
      WITH rqident = '158593'
      WITH first = '1'.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = mem_tab."( TABLE LIKE TABLE OF abaplist ).
    break xkbahar.
    IF NOT mem_tab[] IS INITIAL.
      CALL FUNCTION 'LIST_TO_ASCI'
        EXPORTING
          list_index = -1
        TABLES
          listasci   = itab
          listobject = mem_tab." (LIKE TABLE OF abaplist)
    ENDIF.
    and   [converting spool contents into internal table;
    but doesn't help me. Because i want to read sapscript output value in spool. 
    anybody have idea ? how do i read my sapscript output data in spool?  Any function any program?
    Please help me with the solution.
    Regards
    Emre.

    Hi,
    By selecting print icon of your form output ur able to generate spool of the document.
    Ex: va03->provide orden no ->frm menu -> Sales Document -> issue output to-> select output type-> click on print icon(ctrl+p).
    Spool of the form will be creatted for u, Check the same in SPO1 transaction.
    For further details you can debug the same after selecting print icon.
    If you need further details, Provide me the exact business requirement.
    Regards,
    Bysani.

  • How to merge multiple spools in one PDF

    hi all,
    i have a requirement to merge multiple spools into one PDF.
    I have the code to merge 2 spools into one PDF but acc to my requirement this number can be any( say 100). hence i need  help to merge N number of spools in one PDF.
    Regards
    geeta gupta

    Take the data of all spools into a internal table then create a new spool with this data then downlad this data into pdf format.
    By this method you can download any number of spools into a single pdf file. Please see the below code
    Fetch spool number
    Select rqident from tsp01 into table g_t_data
    where...............
    Read sool data and take this data into a internal table
    Loop at g_t_data.
               Call program to read spool as follows
          SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
          WITH rqident = g_t_data-rqident
          WITH first = '1'
          Read memory where spool data is stored
          CALL FUNCTION 'LIST_FROM_MEMORY'
               TABLES
                    listobject = mem_tab
          Convert spool data to Ascii
          IF NOT mem_tab[] IS INITIAL.
            CALL FUNCTION 'LIST_TO_ASCI'
                 EXPORTING
                      list_index         = -1
                 TABLES
                      listasci           = g_t_text1(table type c length 10000)
                      listobject         = mem_tab(LIKE TABLE OF abaplist)
            APPEND LINES OF g_t_text1 TO g_t_text.
          ENDIF.
    ENDLOOP.
    Create new spool with internal table data
      NEW-PAGE PRINT ON
      KEEP IN SPOOL  l_keep(variable type c default u2018Xu2019)
      LINE-SIZE      300  
      LIST NAME      l_list (variable(30) TYPE c default 'combined_pdf')
      NO DIALOG.
      LOOP AT g_t_text.
        WRITE: g_t_text-data.
      ENDLOOP.
      NEW-PAGE PRINT OFF.
      COMMIT WORK.
    Fetch this spool number from TSP01
    SELECT rqident rqcretime FROM tsp01 INTO TABLE l_t_pdf(internal table having two fields rqident LIKE tsp01-rqident and rqcretime LIKE tsp01-rqcretime)
      WHERE   rqowner = sy-uname AND
                     rq2name = 'COMBINED_PDF'.
    Download spool data into pdf format
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid   = l_t_pdf-rqident
           IMPORTING
                pdf_bytecount = l_size(variable type i)
           TABLES
                pdf           = g_pdf(table like table of tline)
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                bin_filesize = l_size  "size
                filename     = l_data
                filetype     = 'BIN'
           TABLES
                data_tab     = g_pdf.
    Hope this will help you.

  • PDF Printing Issue (Converting to Spool and back to PDF)

    Hi,
    I have a document which has minimum of 25 pages. This document is designed using BSP. When i print this document in DEV this is printed without any issue, but when we print in QA this doesn't print and keeps going on and on and finally we get session time out.
    And now we got some information that this issue occurs because of Memory Management. So now we have to convert the data first to spool and from the spool we have to convert the same to PDF and then try to print.
    I have no idea about the spool. So could someone help me regarding this.
    Thanks in advance.

    Try building your code with FM " CALL FUNCTION 'GET_PRINT_PARAMETERS'
    you will have to submit your program and then
    Read spool from table tsp01.
    refer to the SAP help demo code 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.
    Regards,
    Nikhil

  • Converting spool request into multiple pdf formated documents

    Hi Guys,
                 I am designing a report with several pages of output and running it in background.
    Is there a possibility to convert each page into an separate pdf format document ?
    If I use ALV report as output, if its more than page, do I face any issue with pdf conversion.
    Thanks

    Check the Following code, This might be helpful:
    form rstxpdft4 using filename.
    * Read spool job contents (OTF or ABAP list) and convert
    * to PDF, download PDF
      data: download  value 'X'.
      data: lv_filename like rlgrap-filename.
      lv_filename = filename.
      data otf like itcoo occurs 100 with header line.
      data cancel.
      data pdf like tline occurs 100 with header line.
      data doctab like docs occurs 1 with header line.
      data: numbytes type i,
            arc_idx like toa_dara,
            pdfspoolid like tsp01-rqident,
            jobname like tbtcjob-jobname,
            jobcount like tbtcjob-jobcount,
            is_otf.
      data: client like tst01-dclient,
            name like tst01-dname,
            objtype like rststype-type,
            type like rststype-type.
      select single * from tsp01 where rqident = gt_rq-rqident.
      if sy-subrc <> 0.
        write: / 'Spool request does not exist', gt_rq-rqident
                color col_negative.
        exit.
      endif.
      client = tsp01-rqclient.
      name   = tsp01-rqo1name.
      call function 'RSTS_GET_ATTRIBUTES'
           exporting
                authority     = 'SP01'
                client        = client
                name          = name
                part          = 1
           importing
                type          = type
                objtype       = objtype
           exceptions
                fb_error      = 1
                fb_rsts_other = 2
                no_object     = 3
                no_permission = 4.
      if objtype(3) = 'OTF'.
        is_otf = 'X'.
      else.
        is_otf = space.
      endif.
      if is_otf = 'X'.
        call function 'CONVERT_OTFSPOOLJOB_2_PDF'
             exporting
                  src_spoolid              = gt_rq-rqident
                  no_dialog                = ' '
             importing
                  pdf_bytecount            = numbytes
                  pdf_spoolid              = pdfspoolid
                  btc_jobname              = jobname
                  btc_jobcount             = jobcount
             tables
                  pdf                      = pdf  .
      else.
        call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
             exporting
                  src_spoolid              = gt_rq-rqident
                  no_dialog                = ' '
             importing
                  pdf_bytecount            = numbytes
                  pdf_spoolid              = pdfspoolid
                  btc_jobname              = jobname
                  btc_jobcount             = jobcount
             tables
                  pdf                      = pdf
    *************** download PDF file ***********
    v_filename = lv_filename.
    *  call function 'WS_DOWNLOAD'
    *       exporting
    *            bin_filesize            = numbytes
    *            filename                = lv_filename
    *            filetype                = 'BIN'
    *       tables
    *            data_tab                = pdf
    *       exceptions
    *            file_open_error         = 1
    *            file_write_error        = 2
    *            invalid_filesize        = 3
    *            invalid_type            = 4
    *            no_batch                = 5
    *            unknown_error           = 6
    *            invalid_table_width     = 7
    *            gui_refuse_filetransfer = 8
    *            customer_error          = 9
    *            others                  = 10.
    *  if sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  else.
    *    gv_count = gv_count + 1.
    *  endif.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE                    = numbytes
        FILENAME                        = v_filename
        FILETYPE                        = 'BIN'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    *   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *   SHOW_TRANSFER_STATUS            = ABAP_TRUE
    * IMPORTING
    *   FILELENGTH                      =
      TABLES
        DATA_TAB                        = pdf .
    *   FIELDNAMES                      =
    Thanks.

  • Error in converting Spool to HTML format.

    Hi Gurus,
    I am reading SPool and converting that into HTML formt. Please do find below code for the same.
    Submit report to convert the spool to HTML format
      SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
      WITH rqident = p_spoolno.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = gt_listobj
        EXCEPTIONS
          not_found  = 1
          OTHERS     = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Convert the spool to HTML format
      CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
       EXPORTING
       REPORT_NAME         =
         template_name       = 'WEBREPORTING_REPORT'
        TABLES
          html                = p_html_tab
          listobject          = gt_listobj.
    >>>>>>>>>>>>>>>>>>>
    And i send p_html_tab as attachement to email.
    When I opened the attachement, i can view only half page in htm.
    How can i get the full page in htm.

    First convert the spool to internal table by using FM
    RSPO_RETURN_ABAP_SPOOLJOB
    Next from internal table to HTML....
    Link: /people/rammanohar.tiwari/blog/2006/01/29/abap-utility-print-screen-to-html
    or try the following
    Please try the follwoing:
    1. define HTML internal table with ref to type W3HTML
    2. download it as BIN type and give total lenght of the strings as a parameter in the down load.
    See the code extract below:
    describe table html lines entries.
    read table html into w_html index entries.
    size = ( entries - 1 ) * 255 + strlen( w_html ).
    concatenate p_path file into file.
    call function 'WS_DOWNLOAD'
    exporting
    bin_filesize = size
    filename = file
    filetype = 'BIN'
    tables
    data_tab = html

  • Convert spool in the text format and send mail

    Hi All
    Can anyone tell me
    how to convert the spool into the text format and send that in email as an attachment..
    Points will be rewarded
    URGENT

    Hi,
    Read spool using FM  RSPO_RETURN_ABAP_SPOOLJOB
    CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
        EXPORTING
          rqident                  = v_rqident   "Spool Number
      FIRST_LINE                 = 1
      LAST_LINE                  =
        TABLES
          buffer                     = i_spool "Internal table output
    You will get spool in internal table and then its your game, play the way you want.
    Regards,
    Mandeep

Maybe you are looking for