Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to split the output spool

Former Member
0 Likes
3,223

Hi All,

im currently working on an issue that involves sending the spoolfile (in txt format) via email. the program generates the spool file and also saves it in UNIX as an excel file. The email program grabs the file from UNIX sends it as a text attachment to the email address. only 10 pages out of the 19 pages is sent. One solution was to let the BASIS team increase the spool from default 10 to 20 but this cannot be done due to memory.

Would splitting the report into 2 sections work? if so what would you recommend toward the idea?

Both programs are custom program which is run via 2 jobs.

any other ideas are welcome. If more info is needed pls let me know

thanks!

Ryan

my apologies for a newbie question

Message was edited by: Ryan Luna

Hi All,

im currently working on an issue that involves sending the spoolfile (in txt format) via email. the program generates the spool file and also saves it in UNIX as an excel file. The email program grabs the file from UNIX sends it as a text attachment to the email address. only 10 pages out of the 19 pages is sent. One solution was to let the BASIS team increase the spool from default 10 to 20 but this cannot be done due to memory.

Would splitting the report into 2 sections work? if so what would you recommend toward the idea?

Both programs are custom program which is run via 2 jobs.

any other ideas are welcome. If more info is needed pls let me know

thanks!

Ryan

my apologies for a newbie question

Message was edited by: Ryan Luna

5 REPLIES 5
Read only

Former Member
0 Likes
1,830

Hi,

The limititation of 10 pages is while displaying the spool from GUI , i dont think this will effect the data send as attachment.

Please check the attachment , i feel it will be sent in total.You can temporarily change the spool display setting by going to SP01 transaction.

Hope this helps.

Read only

sridhar_k1
Active Contributor
0 Likes
1,830

The program generates spool, reads the spool back into program and writes to unix file, is that what it's doing? How are you reading the spool?

Limit 10 pages is only for displaying spool in SP01, it should not influence the number of pages read into program using spool processing function modules.

Regards

Sridhar

Read only

0 Likes
1,830

Hi,

Wow such a quick replies

Ok, the way i check the spool was going to sm37 -> display the job -> click spool -> click on glasses to display the spool. This displays only 10 pages out of 19. then i run the job to send an email and i get a text file with 10 pages.

then i display the spool again -> click on settings -> change the display area "To Page" from 10 to 20 . Saved the settings and i did get a warning "Displaying 20 pages could cause a memory" so i continue. I then run the job to send and email and this time i receive a text file with 19 pages.

This finding made gave me an idea that the same change can be done to the non-dialog user (which is the user that is used by the batch job) But BASIS would not allow that change and told me to find another solution.

thanks,

Ryan

Read only

0 Likes
1,830

Hi,

You can follow the linl <b> which has some sample program also for sending mail from Spool request Or else give me your mail id i will forward you the program which sends email from Spool.

Regards.

Read only

dharmenda_kumar
Explorer
0 Likes
1,830

i have created a program using which you can create multiple pdf from a single spool number

first in the code below i have taken a spool number which has 2 pages in it.

second you must use the FM : RSPO_RETURN_SPOOLJOB  in the program to get the content of the spool .  while to perform analysis on how to build logic to split the spool otf/pdf user the FM RSPO_DISPLAY_SPOOLJOB, here by passing the spool number you will get the content in display mode and then based on the keyword you will build logic for e.g in my case i have to perform segregation based on material number so it can be used to decide how many pages are reserved by a specific material number.

another important point to kept in mind is that otf begins with "//"  and a page ends with "EP" and last page ends with  "//" along with "EP". It can be used to remove the number of lines to keep specific pages .

program layout as with proper documentation has been provided.

REPORT  zdk_spool_split.
**********************************************************************
* DATA DECLARATION.
TYPES : tbuf LIKE tline OCCURS 1.
FIELD-SYMBOLS: <buf> TYPE tbuf.
FIELD-SYMBOLS : <lit_otf> TYPE ANY TABLE.
DATA : lit_otf TYPE STANDARD TABLE OF itcoo.
DATA : objcont LIKE soli  OCCURS 0 WITH HEADER LINE.
DATA : format(5) TYPE c, dummy TYPE i.
DATA : buffer_pdf TYPE STANDARD TABLE OF tline.
DATA : p_file LIKE rlgrap-filename VALUE 'C:\temp\file1.pdf'. "#EC NOTEXT
DATA : numbytes TYPE i VALUE 255.
DATA : cancel.
DATA : otfcmd LIKE itcoo VALUE '//'.
DATA : pdfcnv_archive_index LIKE toa_dara.
DATA : bin_file TYPE xstring,
        pdf_username TYPE c.
**********************************************************************
* GET THE SPOOL NUMBER FROM THE USER.
PARAMETERS : p_sid TYPE tsp01-rqident OBLIGATORY.
**********************************************************************
* GET THE CONTENT OF THE SPOOL NUMBER
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
   EXPORTING
     rqident              = p_sid
   TABLES
     buffer               = objcont
   EXCEPTIONS
     no_such_job          = 1
     job_contains_no_data = 2
     selection_empty      = 3
     no_permission        = 4
     can_not_access       = 5
     read_error           = 6
     type_no_match        = 7
     OTHERS               = 8.
IF sy-subrc <> 0.
   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
**********************************************************************
* INCORPORATE YOUR LOGIC TO DELETE LINES WHICH ARE NOT REQUIRED.
* IN MY CASE I HAVE REMOVED LINES FROM 351 TO 715 TO REMOVE THE SECOND PAGE FROM MY SPOOL
* MY OBJCONT AFTER DELTED BEGINS WITH "//" AND ENDS WITH "EP" AND "//"
DELETE objcont[] FROM 351 TO 715.
* IT ONLY CONTAINS ONE PAGE OUT OF 2 PAGES FROM THE SPOOL NUMBER I HAVE PROVIDED.
**********************************************************************
* CONVERT OTF TO PDF
lit_otf = objcont[]. " GET THE OTF IN CORRECT OTF FORMAT
ASSIGN buffer_pdf TO <buf>.
format = 'PDF'. " CHOOSE THE CORRECT FORMAT IE PDF MUST FOR CONVERSION
CALL FUNCTION 'CONVERT_OTF'
   EXPORTING
     format                = format
   IMPORTING
     bin_filesize          = dummy
   TABLES
     otf                   = lit_otf
     lines                 = <buf>
   EXCEPTIONS
     err_max_linewidth     = 1
     err_format            = 2
     err_conv_not_possible = 3
     OTHERS                = 4.
IF sy-subrc IS NOT INITIAL.
   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
**********************************************************************
* GET THE NUMBYTES OF THE PDF CONTENT OBTAINED AFTER THE CONVERSION
* CORRECT NUMBYTE IS VERY IMPORTANT OTHERWISE IT WILL NOT GENERATE
* PDF IN CORRECT FORMAT.
PERFORM convert_otf2pdf_end(rstxcpdf) TABLES <buf>
                                       USING otfcmd
                                             numbytes
                                             pdfcnv_archive_index
                                             bin_file
                                             pdf_username.
**********************************************************************
* NOW DOWNLOAD THE PDF TO VIEW IN ACTUAL PDF AT DESIRED PATH
PERFORM download_w_ext(rstxpdft) TABLES <buf>
                                  USING p_file
                                        '.pdf'
                                        'BIN'
                                        numbytes
                                        cancel.