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: 

Download spool to PDF document on application server

Former Member
0 Kudos

Hi,

I am using function CONVERT_OTFSPOOLJOB_2_PDF to convert a sapscript spool and then downloading the internal table provided to a pdf file on the application server. The sapscript form contains company logos.

After transferring the file from the application server to PC and then opening the pdf document I get the following message:

"There was an error while trying to parse an image."

The PDF doc contains everything except the company logo.

I noticed that this works (i.e. company logo is present in the downloaded file) when I transfer the internal table that contains the PDF contents onto my PC using GUI_DOWNLOAD using mode 'BIN'. However, when I transfer the contents of the same internal

table to a file on the application server using abap statement:

'Open Dataset <filename> FOR OUTPUT IN BINARY MODE'

I get the problem described above.

I noticed that SAP has provided standard program RSTXPDFT4 to convert a spool and download it into a PC file. However is there a similar program that downloads a spool onto the application server? Perhaps there is a 'special' way in downloading PDF documents onto the application server?

I don't this problem with sapscripts that do not have a company logo.

Is there a certain restriction on 'Open Dataset'with transfering logos in PDF documents?

Any help would be greatly appreciated in the form of reward points.

Thanks

Liam

9 REPLIES 9

Former Member
0 Kudos

Hi.

Try demo programe "RSTXPDFT5", it download PDF file

to localPC and Server.

0 Kudos

Hi,

Unfortunately RSTXPDFT5 does not perform a PDF conversion. It only downloads a spool (abap list) to app server or PC.

Anyone else please?

POINTS WILL BE REWARDED

Thanks

Liam

0 Kudos

hi,

try <b>RSTXPDFT4</b>

A.

0 Kudos

Hi Andreas,

RSTXPDFT4 only downloads to PC not application server....

Liam

0 Kudos

The error might be because of empty chars in last line of pdf itab when writing the file to appserver..

Use the following code when writing the pdf file to appserver:

data: file(20) type c value '/tmp/tpdf.pdf'.

data: v_lines type sy-tabix,
      v_length type i.
describe table t_pdftab lines v_lines.

open dataset file for output in binary mode.
v_length = 134.
loop at t_pdftab.
  if sy-tabix eq v_lines.
    v_length = strlen( t_pdftab ).
  endif.
  transfer t_pdftab to file length v_length..
endloop.
close dataset file.

Another reason for the error, may be you are using ASCII mode when FTPing the file from appserver to PC.

If you are using ftp, change the mode to binary.

Regards

Sridhar

Message was edited by:

Sridhar K

Former Member
0 Kudos

Hi,

We convert some of our spools to pdf and store them on the app server using following high level process.

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = p_spool

no_dialog = 'X'

dst_device = 'LOCL'

TABLES

pdf = lt_pdf

EXCEPTIONS

OTHERS = 0.

  • Write PDF file

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_32 = l_guid.

CONCATENATE '/your_path_goes_here/'

l_guid

INTO l_filename.

CONCATENATE l_filename '.pdf' INTO l_filename.

  • Store

OPEN DATASET l_filename IN TEXT MODE.

IF NOT sy-subrc IS INITIAL. " only write pdf if new

LOOP AT lt_pdf.

TRANSFER lt_pdf TO l_filename.

ENDLOOP.

ENDIF.

CLOSE DATASET l_filename.

If it doesn't work, I would 1st try and play with image type. I'm wondering if it's tripping on image conversion. Perhaps revert to 1st principles and try monochrome bitmap and a few variations thereof. I stand by my code above. Definitely works. HTH, Dave

former_member644562
Participant
0 Kudos

Hi Liam,

I am facing exactly the same problem . I am struggling with this from quite a long time.

I do understand that its been too long you had this problem but would really appreciate if you help me with the solution.

Thanks

thokane
Explorer
0 Kudos

Hi,

the following link may solve your problem

http://scn.sap.com/thread/3177954

Former Member
0 Kudos

There are a solution for this problem in another thread. Check:

Run program RSTXPDF3 and activate option FLATE_COMPR_OFF.

Hope it helps another one.