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

Converting sapscript to PDF, store it on application server

Former Member
0 Likes
467

I have gone through this entire forum a couple of times, and I cannot seem to find a solution for my problem.

Firstly, I am using SAP version 46C. Most solutions proposed use syntax or FM not available in 46C!!

I am using function module CONVERT_OTFSPOOLJOB_2_PDF to convert sapscript to PDF.

Based on all your help so far, I have managed the space problem and converted length 134 to 255.

I then download teh information using the open dataset <> for output in binary mode command.

I think what is needed is to convert the character sting to a binary string? But the FM proposed in previous threads does not exist in our version.

I will give away a million to get this solved!

function z_create_pdf_file.

*"----


""Local interface:

*" IMPORTING

*" VALUE(RQIDENT) LIKE TSP01-RQIDENT

*" TABLES

*" PDF STRUCTURE TLINE

*"----


call function 'CONVERT_OTFSPOOLJOB_2_PDF'

exporting

src_spoolid = rqident

no_dialog = c_no

  • dst_device = c_device

  • PDF_DESTINATION =

importing

pdf_bytecount = bin_filesize

  • PDF_SPOOLID =

  • OTF_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_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

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

data: itab type tline,

output type string,

outputx type string,

pdf2(255) occurs 0 with header line.

*Make sure spaces is not dropped.

loop at pdf into itab.

translate itab using ' ~'.

concatenate output itab into output.

endloop.

translate output using '~ '.

*Transfer 134 spaces into 255 spaces

do.

pdf2 = output.

append pdf2.

shift output left by 255 places.

if output is initial.

exit.

endif.

enddo.

data: outfile(40) value '/TMP/ABAP4/TRY1.PDF'.

open dataset outfile for output in binary mode.

loop at pdf2.

transfer pdf2 to outfile.

endloop.

close dataset outfile.

2 REPLIES 2
Read only

Former Member
0 Likes
421

Hi,

Check the following link:

http://www.sapbrain.com

Regards,

Bhaskar

Read only

Former Member
0 Likes
421

Hello Bhaskar

Thank you for your reply.

I have not used this website before, it's not really user friendly. I tried to search for PDF, but found no hits? How do I search? Is there somewhere specific where I must look?

Thank you