08-26-2009 1:00 PM
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
08-26-2009 1:32 PM
HI Geeta,
Have a lock on FM RSPO_RETURN_ABAP_SPOOLJOB, FM RSPO_SR_OPEN and FM RSPO_SR_WRITE.
The first one extracts lines from a spool request. The second one creates a new spool request. The last one write lines into a spool request.
these will split up huge request into several small requests .
And after merging your spool requests into one you can convert it to PDF..
regards,
Archana
08-26-2009 1:39 PM
Hello
Try to SEARCH SCN before posting. If you used searching for that has found link:
08-26-2009 1:40 PM
hi,
Convert the spool to otf using the function module,
call the function module in loop and append the otf data table every time
and finally download the otf table.
Regards,
R K.
08-26-2009 1:47 PM
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.