02-13-2008 6:35 AM
Hi ,
I got a requirement that converting smartform into pdf file and sending into application server, And uploading the that pdf file into presentation server once a day am geting error when uploading into pdf format from application server .
Error : There was an error while tryinging to parse an image.
Please help me out its urgent.
Thanks in advance
Regards
krishna
Edited by: krishna rao on Feb 13, 2008 12:05 PM
02-13-2008 6:58 AM
U can use this code
Reward if useful
REPORT ZMN_PDF_UPLOAD.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '\usr\sap\DEV\DVEBMGS00\work\testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
*Or
*
*Use the TCode
*CG3Z or CG3Y
*for downloading to Application Server.
02-13-2008 6:58 AM
U can use this code
Reward if useful
REPORT ZMN_PDF_UPLOAD.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '\usr\sap\DEV\DVEBMGS00\work\testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
*Or
*
*Use the TCode
*CG3Z or CG3Y
*for downloading to Application Server.
02-13-2008 7:00 AM
Try using Binary mode with OPEN DATASET while writing or reading file from application server.
ex:
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
OPEN DATASET FPATH FOR OUTPUT IN BINARY MODE.