10-24-2006 11:28 PM
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
10-25-2006 2:27 AM
Hi.
Try demo programe "RSTXPDFT5", it download PDF file
to localPC and Server.
10-25-2006 7:13 AM
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
10-25-2006 7:18 AM
10-25-2006 7:23 AM
Hi Andreas,
RSTXPDFT4 only downloads to PC not application server....
Liam
12-08-2006 11:07 PM
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
12-08-2006 10:21 PM
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
05-17-2012 11:01 PM
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
05-18-2012 6:09 AM
04-25-2016 3:00 PM