08-11-2009 11:48 AM
Hi Gurus,
I have added a 'Download to PDF' button in my report output. I am able to save the report output in PDF format in local system,
but I am unable to open it, it shows some error while opening the report.
Currently, I am using CALL FUNCTION 'GUI_DOWNLOAD' to save the report in PDF format.
Can anyone please help me in opening the saved PDF file ?
Thanks,
Chandan
08-11-2009 11:55 AM
Hi,
What is the file type you are mentioning in the GUI_DOWNLOAD FM? Did u try with
filetype = 'BIN'
Regards,
Vik
08-11-2009 12:22 PM
No I am using file type like rlgrap-filetype VALUE 'ASC'.
Please suggest more on this.
08-11-2009 12:33 PM
Hi,
Then try setting the file type as 'BIN' in GUI_DOWNLOAD and check. Also what is the FM you are using to convert the report output to PDF?
- For ABAP LIST use : CONVERT_ABAPSPOOLJOB_2_PDF.
- For Sapscript and smartforms use: CONVERT_OTFSPOOLJOB_2_PDF.
If you are using CONVERT_OTFSPOOLJOB_2_PDF, you have to convert OTF to PDF with the below FM
CALL FUNCTION "CONVERT_OTF"
EXPORTING FORMAT = "PDF"
IMPORTING BIN_FILESIZE = FILE_LEN
TABLES OTF = OTFDATA
LINES = PDFDATA
Regards,
Vik
08-11-2009 12:36 PM
Using BIN is slowing down the processing. Taking long time. Can not afford that.
I am not using any of the FMs that you mentioned.
I just did the below:
DATA: filename TYPE string,
ftype LIKE rlgrap-filetype VALUE 'BIN',
filetype TYPE char10.
* fix problem with gui_download
filename = 'C:\SPD_Analys2_Report.PDF'.
filetype = ftype.
w_act_filename = filename.
**ctf 12768 replaced ws_download with GUi_download
CLEAR w_filecopy_ok.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = filetype
write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* IMPORTING
* FILELENGTH =
TABLES
data_tab = t_download
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
Can you please describe in details.....
which FM to use first and then which one next...
Edited by: chandan sinha on Aug 11, 2009 1:45 PM
08-11-2009 12:52 PM
Hi,
Well before using GUI_DOWNLOAD you have to use the FM CONVERT_OTF to convert the internal table to PDF and then use it in GUI_DOWNLOAD.
Check this for your reference.
DATA: pdftab type standard TABLE OF tline.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = BINFILE
TABLES
otf = t_download
lines = pdftab
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = binfile
filename = 'D:\MYFILE.PDF' //give the address where u want output.
FILETYPE = 'BIN'.
Regards,
Vik
08-11-2009 1:06 PM
Vik,
This is what I did....I am getting an exception " RAISE ERR_CONV_NOT_POSSIBLE" , hence a short dump.
DATA: filename TYPE string,
ftype LIKE rlgrap-filetype VALUE 'BIN',
filetype TYPE char10,
binfile type i,
pdftab type standard table of tline.
* fix problem with gui_download
filename = 'C:\SPD_Analys2_Report.PDF'.
filetype = ftype.
w_act_filename = filename.
**--> PDF FM Used
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = binfile
TABLES
otf = t_download
lines = pdftab.
**ctf 12768 replaced ws_download with GUi_download
CLEAR w_filecopy_ok.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = binfile
filename = filename
filetype = filetype
write_field_separator = 'X'
Please help yaar....
08-11-2009 1:48 PM
08-11-2009 1:52 PM
This seems a long and hectic process.
Can you tell me any easy and faster process ???
08-11-2009 2:07 PM
Hi,
I dont think its possible to convert a internal table to pdf without using the spool concept. So i dont think there is any other way to do this.
Regards,
Vik
08-11-2009 2:17 PM
Even Spool is not working, it is converting into some garbage data.
Please suggest some accurate ways.....
08-11-2009 5:13 PM
Hi,
Check this wiki. Its clear and self descriptive.
[https://wiki.sdn.sap.com/wiki/display/ABAP/PDFDownlaodByCreatingSpool+Request]
Regards,
Vik
08-12-2009 6:21 AM
Hi Frn ,
Please refer the given below link
u2022 NAME / TITLE OF WIKI : Spool request program for pdf
u2022 URL OF THE WIKI POSTED : https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/pdfDownlaodByCreatingSpool+Request
Thanks and Regards ..
Priyank dixit
08-12-2009 7:01 AM
08-12-2009 7:10 AM
Hello Frn ,
i had already given an example in the above mentioned wikki ....Please read and use that code ..
Thanks and Regards ..
Priyank
08-12-2009 7:11 AM
Hello
I consider that you has received it is enough information for decision of your problem. SDN - not that place where someone will do your work for you.
08-13-2009 8:32 AM
08-29-2009 8:55 PM