10-26-2007 9:04 AM
Hi All
i had designed a smartform and the output is coming perfect, now that i got a requirement to download that smartform output to a file (PDF).. can any body explain me how to do that.
10-26-2007 9:33 AM
10-26-2007 9:15 AM
Hi
When u run the program select a printer and give print,
Go to transaction SP01 copy the spool id and execute program RSTXPDFT4 give the spool id there and download it to local machine.
Regards,
Hemant
10-26-2007 9:17 AM
Hi Hemanth,
i want that output of that form to be stored as a PDF file in my local drive. i hope i am clear now.
10-26-2007 9:20 AM
Hi Ram
The program RSTXPDFT4 will download ur form into a pdf u jst hv to give the spool id and path where u want to download it on ur machine.
Regards,
Hemant
10-26-2007 9:21 AM
But cant i write any F.M in my print program so that i need not go for that standard program
10-26-2007 9:26 AM
You need not write any print/driver program as u hv standard program to run the form , whenever u run the form u get option whether to print or to see print preview , Select PRINT there a spool request will be generated in SP01 copy that spool id in SP01 and execute RSTXPDFT4 in SE38 give tat spool id as input n path where u need to save the PDF format of ur smartform .
Message was edited by:
Hemant K
Message was edited by:
Hemant K
10-26-2007 9:16 AM
Hi,
There is a way to download smartform in PDF format.
Please do the following:
1. Print the smartform to the spool.
2. Note the spool number.
3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the
noted spool number.
Regards,
Bhaskar
10-26-2007 9:32 AM
Hi Ram,
Execute the program RSTXPDFT2 and download as PDF file.
<b>Reward points for helpful answers</b>
Satish
10-26-2007 9:33 AM
10-26-2007 9:43 AM
Hi Ram,
You can convert the smartform output to PDF format using the function module 'CONVERT_OTF_2_PDF'.
You can then download the PDF data to a desired location in your desktop using the function module 'GUI_DOWNLOAD'.
Thanks,
Subathra
10-26-2007 10:25 AM
Hi ram.
I understood your problem.You are geeting your form correctly right.
After the final internal table do this code:
DATA: cparam TYPE ssfctrlop,
outop TYPE ssfcompop,
fm_name TYPE rs38l_fnam.
DATA : tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
file_name TYPE string,
file_path TYPE string,
full_path TYPE string.
DATA : p_file LIKE rlgrap-filename VALUE 'C:\Documents and Settings\sg0888\Desktop\TEST.PDF'. .
DATA : file TYPE string.
file = p_file.
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = space.
cparam-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSF_EXPLORE'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = outop
user_settings = space
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = tab_otf_data
JOB_OUTPUT_OPTIONS =
TABLES
<b>it_zpur_details = it_final</b>* EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
tab_otf_final[] = tab_otf_data-otfdata.
DATA : i_tline TYPE TABLE OF tline WITH HEADER LINE,
v_len_in LIKE sood-objlen.
*DATA : p_file LIKE rlgrap-filename VALUE 'C:\Documents and Settings\sg0888\Desktop\TEST.PDF'.
*DATA : file TYPE string.
*file = p_file.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
bin_filesize = bin_filesize "bin_filesize
BIN_FILE =
TABLES
otf = tab_otf_final[]
lines = i_tline[] "i_tline[]
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5
.
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 : wf_len_in1 LIKE LINE OF it_final.
wf_len_in1 = it_final.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize "bin_filesize "wf_len_in1
filename = 'C:\Documents and Settings\sg0888\Desktop\TEST.PDF'
filetype = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
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 = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = file_size
TABLES
data_tab = i_tline[] "i_tline
FIELDNAMES =
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
.
IF sy-subrc EQ 0.
WRITE : 'successfully downloaded'.
ELSE.
WRITE : 'error in downloading'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Let me know where you are getting difficulties after run this code.
Reward if it is useful.
Thank you.