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

Spool Request into PDF Format

Former Member
0 Likes
597

Hi Group,

I am trying to convert a spool request of output of Purchase Order ( with company logo ) into PDF format.

The problem is as soon as I execute the program RSTXPDFT4 with that spool request it is giving me the error.

The description of error is " work process re-started, session terminated."

The program RSTXPDFT4 is working fine if i execute it with a spool request which doesnt have any graphics or logo.

I have gone through the service.sap.com also but didnt get the solution.

Pls help me to solve this problem

with regards,

Siddharth patel

4 REPLIES 4
Read only

Former Member
0 Likes
547
Read only

Former Member
0 Likes
547

Hi Siddharth,

Welcome to SDN.

Try this sample code using a function module to convert ur spool into PDF.

TABLES TSP01.

DATA: MTAB_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE,

MC_FILENAME LIKE RLGRAP-FILENAME.

DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS,

MC_VALID(1) TYPE C,

MI_BYTECOUNT TYPE I.

PARAMETERS: P_RQIDET LIKE TSP01-RQIDENT, "SPOOL TO CONVERT

P_PDFILE LIKE SY-REPID. " PDF FILENAME

START-OF-SELECTION.

CONCATENATE 'C:\' P_PDFILE '.PDF' INTO MC_FILENAME.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

COPIES = '1'

COVER_PAGE = SPACE

DESTINATION = SPACE

EXPIRATION = '1'

IMMEDIATELY = SPACE

LAYOUT = SPACE

MODE = SPACE

NEW_LIST_ID = 'X'

NO_DIALOG = 'X'

USER = SY-UNAME

IMPORTING

OUT_PARAMETERS = MSTR_PRINT_PARMS

VALID = MC_VALID

EXCEPTIONS

ARCHIVE_INFO_NOT_FOUND = 1

INVALID_PRINT_PARAMS = 2

INVALID_ARCHIVE_PARAMS = 3

OTHERS = 4.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = P_RQIDET

NO_DIALOG = SPACE

DST_DEVICE = MSTR_PRINT_PARMS-PDEST

IMPORTING

PDF_BYTECOUNT = MI_BYTECOUNT

TABLES

PDF = MTAB_PDF

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.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

BIN_FILESIZE = MI_BYTECOUNT

FILENAME = MC_FILENAME

FILETYPE = 'BIN'

IMPORTING

ACT_FILENAME = MC_FILENAME

TABLES

DATA_TAB = MTAB_PDF

EXCEPTIONS

INVALID_FILESIZE = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

CUSTOMER_ERROR = 7

OTHERS = 8.

IF SY-SUBRC EQ 0.

WRITE:/ MC_FILENAME, 'CONVERTED TO PDF AND DOWNLOADED'.

ELSE.

WRITE:/ 'PROBLEM WITH DOWNLOAD'.

ENDIF.

ELSE.

WRITE:/ 'PROBLEM WITH PDF CONVERSION'.

ENDIF.

ELSE.

WRITE:/ 'PROBLEM GETTING PRINT PARAMETERS'.

ENDIF.

Hope this will help you.

Cheers

Sunny

Rewrd points, if found helpful

Read only

Former Member
0 Likes
547

check this thread:

regards

Read only

Former Member
0 Likes
547

Dear Friends,

I m not facing any problem if spool request dont have any <b>graphic or logo</b>.

I have only problem when spool request contains a <b>logo</b>.

for e.g. output of purchase order with company logo

i hope so that u understand the problem.

with regards,

Siddharth Patel