02-09-2007 11:54 AM
Hi All,
Pls send me the source code for the conversion of smartform to pdf ,its urgent pls send ASAP.
Thanks & regards .
bharat
02-09-2007 11:58 AM
Hi bharath,
<b>SmartForms Output to PDF</b>
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.
1.Run the program RSTXPDFT4 in se38
2. Give the spool number and mention the directory and filename where to want to store the pdf file
3. press execute
( or )
If u want to convert OTF into pdf by using a program use,
CONVERT_OTF_2_PDF or SX_OBJECT_CONVERT_OTF_PDF function modules in u r program.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf_data
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
( or )
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'ASCIIPRI'
LEN_IN = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
TABLES
CONTENT_IN = OTF_TAB
CONTENT_OUT = ITAB2
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
02-09-2007 11:58 AM
Hi bharath,
<b>SmartForms Output to PDF</b>
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.
1.Run the program RSTXPDFT4 in se38
2. Give the spool number and mention the directory and filename where to want to store the pdf file
3. press execute
( or )
If u want to convert OTF into pdf by using a program use,
CONVERT_OTF_2_PDF or SX_OBJECT_CONVERT_OTF_PDF function modules in u r program.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf_data
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
( or )
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'ASCIIPRI'
LEN_IN = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
TABLES
CONTENT_IN = OTF_TAB
CONTENT_OUT = ITAB2
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
02-09-2007 11:59 AM
ex-
REPORT ZNEGI_SMARTFORMS .
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
* Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
* Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
* Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCOMPLETE_REFRENCE'
importing
fm_name = v_form_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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
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.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
* Fehlerhandling
if sy-subrc <> 0.
*
endif.
daTA : p_file LIKE rlgrap-filename VALUE 'C:test.pdf'.
data : file type string.
file = p_file.
data : wf_len_in1 type i.
wf_len_in1 = v_len_in.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = wf_len_in1
FILENAME = file
FILETYPE = 'BIN'
TABLES
DATA_TAB = i_tline.
02-09-2007 1:08 PM
Hi
sreekanth reddy,
Thanku very much for solving my problem . Once again thanks for explaining in detail .
thank u bye .
bharat
02-09-2007 12:00 PM
REPORT PROGRAM - RSTXPDFT4 ,
FIRST GENERATE SPOOL REQUEST THEN DOWNLOAD Smartform TO PDF FILE ON LOCAL PC via above program (report program)
amit
02-09-2007 12:01 PM
HI,
SAP have created a standard program <b>RSTXPDFT4</b> to convert the SPOOL to PDF, so get your Smartform SPOOL and download the same using the program
Please go through this link , hope you will get some useful stuff from this.
&----
*& Form f9100_save_to_pdf
&----
text
----
-->P_WS_FORMNAME text
----
FORM f9100_save_to_pdf using value(ws_formname).
data: i_lines TYPE tline OCCURS 0 WITH HEADER LINE.
data: ws_bin_size type i,
ws_filename type string.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = ws_bin_size
TABLES
otf = i_otf
lines = i_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
flg_exit = 'X'.
MESSAGE i050 WITH 'Error converting to PDF format'.
EXIT.
ENDIF.
Get the download path
PERFORM get_download_path CHANGING ws_filename.
if flg_exit = 'X'.
EXIT.
endif.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = ws_bin_size
filename = ws_filename
filetype = 'BIN'
TABLES
data_tab = i_lines
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 <> 0.
MESSAGE i050 WITH 'Error while File download'.
flg_exit = 'X'.
EXIT.
ELSE.
MESSAGE i050 WITH 'File downloaded successfully '.
flg_exit = 'X'.
EXIT.
ENDIF.
http://searchsap.techtarget.com/tip/1,289483,sid21_gci1121833,00.html
Regards
Sudheer