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

Get PDF from Spool

Former Member
0 Likes
4,718

Hi everyone,

We are going to use some standard transactios that build PDF files and put it in the spool. How can I get this PDF files from the spool?, I need to build a FM for get this files.

Regards

Eduardo Campos.

11 REPLIES 11
Read only

Former Member
0 Likes
2,988

You need FM CONVERT_OTFSPOOLJOB_2_PDF

Just pass the spool number to convert it to PDF...

To get the spool number...use this...


    SELECT RQIDENT
    INTO (T_TSP01-RQIDENT)
    FROM TSP01
    WHERE RQOWNER EQ SY-UNAME
      AND RQCLIENT EQ SY-MANDT.
    APPEND T_TSP01.
    ENDSELECT.

    SORT T_TSP01 DESCENDING.

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
         EXPORTING
              SRC_SPOOLID              = T_TSP01-RQIDENT
              NO_DIALOG                = ''
         IMPORTING
              PDF_BYTECOUNT            = NUMBYTES
              PDF_SPOOLID              = PDFSPOOLID
              BTC_JOBNAME              = JOBNAME
              BTC_JOBCOUNT             = JOBCOUNT
         TABLES
              PDF                      = PDF
         EXCEPTIONS
              ERR_NO_OTF_SPOOLJOB      = 1
              ERR_NO_SPOOLJOB          = 2
              ERR_NO_PERMISSION        = 3
              ERR_CONV_NOT_POSSIBLE    = 4
              ERR_BAD_DSTDEVICE        = 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.

Greetings,

Blag.

Read only

0 Likes
2,988

Hi Alvaro,

But I don´t need to convert to PDF, the file in the spool is a PDF, I only need to get de PDF.

Regards.

Read only

0 Likes
2,988

Use this FM RSPO_IRETURN_RAW_DATA to read the spool -:)

Greetings,

Blag.

Read only

0 Likes
2,988

Thanks Alvaro,

I Execute the function RSPO_IRETURN_RAW_DATA, but where returns the data?

If I only pass the RQIDENT, I got an exception, but if put another parameters:

RQIDENT 5.258

RQCLIENT 100

RQ0NAME SCRIPT

RQ1NAME CM00

RQ2NAME 001

RQO1NAME SPOOL0000005258

This run, but I don't see any data, only the tables line buffer returns this

LINE_BUFFER

DATA_LEN 00065

PRECOL

DATA_LINE SPOOL0000005258_00001 0000000000 20080307

And page Index returns 1

Regards

Read only

0 Likes
2,988

You need to pass the following data from TSPO1

In IMPORT parameter RQ:

RQIDENT

RQCLIENT

RQ0NAME

RQ1NAME

RQ2NAME

RQOWNER

RQCRETIME

RQO1NAME

RQDOCTYPE

The content of the spool is on LINE_BUFFER table...

Greetings,

Blag.

Read only

0 Likes
2,988

Hi Alvaro,

I put this values in RQ, but when i execute the function, the table LINE_BUFFER only returns one record with this values:

DATA_ P DATA_LINE

00065 SPOOL0000005258_00001 0000000000 20080307202511 0000000001 X

Any idea why doesn't returns any more?

Regards.

Read only

0 Likes
2,988

Hi everyone,

I resolve this using the function:

FPCOMP_CREATE_PDF_FROM_SPOOL

Regards

Read only

Former Member
0 Likes
2,988

try FM CONVERT_ABAPSPOOLJOB_2_PDF.

regards,

G@urav

Read only

0 Likes
2,988

Hi Gaurav,

I don´t need to convert to PDF, the content of the spool is a PDF right now, I need to read the PDF of the spool.

Regards.

Read only

0 Likes
2,988

RSPO_RETURN_ABAP_SPOOLJOB will work for u.

I tried one scenario..

PERFORM get_spool_number USING SY-REPID

sy-uname

CHANGING lv_rqident.

IF NOT lv_rqident IS INITIAL.

REFRESH it_buffer[].

CLEAR it_buffer.

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = lv_rqident

TABLES

buffer = it_buffer

EXCEPTIONS

no_such_job = 1

not_abap_list = 2

job_contains_no_data = 3

selection_empty = 4

no_permission = 5

can_not_access = 6

read_error = 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.

----


  • FORM get_spool_number *

----


  • Get the most recent spool created by user/report *

----


  • --> F_REPID *

  • --> F_UNAME *

  • --> F_RQIDENT *

----


FORM get_spool_number USING f_repid

f_uname

CHANGING f_rqident.

DATA:

lc_rq2name LIKE tsp01-rq2name.

CONCATENATE f_repid+0(8)

f_uname+0(3)

INTO lc_rq2name SEPARATED BY '0'.

SELECT * FROM tsp01 WHERE rq2name = lc_rq2name

ORDER BY rqcretime DESCENDING.

f_rqident = tsp01-rqident.

EXIT.

ENDSELECT.

IF sy-subrc NE 0.

CLEAR f_rqident.

ENDIF.

ENDFORM.

Read only

TuncayKaraca
Active Contributor
0 Likes
2,988

@Eduardo Campos

Look at the program RSTXPDFT4. It simply gets the spool number and converts to PDF and downloads.

The program is using these function modules:

RSTS_GET_ATTRIBUTES
CONVERT_OTFSPOOLJOB_2_PDF
CONVERT_ABAPSPOOLJOB_2_PDF