Application Development 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: 

Several Spools -> One PDF File

Former Member
0 Kudos
258

Hello,

I have already created a program to convert spool requests into PDFs and afterwards send them by mail.

1 spool request is converted in 1 PDF file with function CONVERT_OTFSPOOLJOB_2_PDF.

Now I need a different thing several spool requests in 1 PDF file.

Do you all have any ideas?

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos
144

Hi

the fm CONVERT_OTFSPOOLJOB_2_PDF return your pdf file in a internal table, so you can try to use this fm for each your spool and append every result in a big internal table you'll transfer to fm to down_load.

Max

4 REPLIES 4

Former Member
0 Kudos
145

Hi

the fm CONVERT_OTFSPOOLJOB_2_PDF return your pdf file in a internal table, so you can try to use this fm for each your spool and append every result in a big internal table you'll transfer to fm to down_load.

Max

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
144

Did you already try append the PDF data to a internal table for each spool.

Loop at spools.

Call function 'CONVERT_OTFSPOOLJOB_2_PDF'
          tables
              PDF = iPDF.

loop at iPDF.
move-corresponding ipdf to multiple_spool_Pdf.
append multiple_spool_Pdf.
endloop.

ENDloop.

I don't think that this will work, but its worth a shot.

Regards,

Rich Heilman

Former Member
0 Kudos
144

Rui Pinto-

One idea is couple all the spools in to one single spool and then covert this spool in to a PDF document.

Here is a sample code.

  • Get all your spools in an internal table

SELECT * FROM TSP01 INTO TABLE I_TSP01

WHERE (.....)

  • Loop in to each spool request and use function module * RSPO_DISPLAY_SPOOLJOB to merge the spools

LOOP AT I_TSP01 INTO WA_TSP01.

CALL FUNCTION 'RSPO_DISPLAY_SPOOLJOB'

EXPORTING

RQIDENT = WA_TSP01-RQIDENT

EXCEPTIONS

NO_SUCH_JOB = 1

JOB_CONTAINS_NO_DATA = 2

SELECTION_EMPTY = 3

NO_PERMISSION = 4

CAN_NOT_ACCESS = 5

READ_ERROR = 6

OTHERS = 7.

IF SY-SUBRC <> 0.

ENDIF.

ENDLOOP.

-


Please note that when this code is run in background, it will create a new spool request with all the spools merged.

-


  • Then you can delete all your old spool requests by using the function module below.

LOOP AT I_TSP01 INTO WA_TSP01.

V_DELSPID = WA_TSP01-RQIDENT.

CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'

EXPORTING

SPOOLID = V_DELSPID

IMPORTING

RC = RC

STATUS = STATUS.

ENDLOOP.

COMMIT WORK AND WAIT.

Now you have one single spool request instead of multiple request. You may convert this spool in to a PDF as may be required. Again, this is more efficient to run this code in background only.

KK

0 Kudos
144

Hi

In the above message, you were telling that, we will get the new spool request ID after the loop. how can we capture that new spool req.?

Thanks

Ratan