04-06-2006 10:39 AM
Hi all,
I need to know how to convert a form to PDF format
Points will be awarded
04-06-2006 10:40 AM
HI
USE PROGRAM RSTXPDFT4.
CHECK THIS THREAD
http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/frameset.htm
THANKS,
PRIYA
Message was edited by: Priya
Message was edited by: Priya
04-06-2006 10:40 AM
Use the FM,
CONVERT_OTFSPOOLJOB_2_PDF
or
CONVERT_ABAPSPOOLJOB_2_PDF
REgards,
Ravi
04-06-2006 10:42 AM
Hi,
smartform to PDF.
http://www.sap4.com/wiki/index.php/Genera_PDF_a_partir_de_Smartforms
Regards
vijay
04-06-2006 10:47 AM
Hi,
Refer this thread:
Refer this code:
report zsform166 .
data: itab like ztab occurs 0 with header line.
select * from ztab into table itab.
data: cntl_stru type ssfctrlop.
data: e_output_options type ssfcompop.
data: otfitab type tsfotf.
data: pdfitab like tline occurs 1000 with header line.
data: i_job_output_info type ssfcrescl.
data: length type i.
* For Generating OTF
cntl_stru-no_dialog = 'X'.
cntl_stru-getotf = 'X'.
call function '/1BCDWB/SF00000095'
exporting
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = cntl_stru
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = e_output_options
* USER_SETTINGS = 'X'
importing
* DOCUMENT_OUTPUT_INFO =
job_output_info = i_job_output_info
* JOB_OUTPUT_OPTIONS =
tables
itab = itab
* 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.
otfitab = i_job_output_info-otfdata.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
importing
bin_filesize = length
tables
otf = otfitab
lines = pdfitab
* EXCEPTIONS
* ERR_MAX_LINEWIDTH = 1
* ERR_FORMAT = 2
* ERR_CONV_NOT_POSSIBLE = 3
* OTHERS = 4
.
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: pdfbuffer type string.
* for Mail/Attachment
*****************************
data: listobject like abaplist occurs 10.
data: tab_lines type i.
data: doc_chng like sodocchgi1.
data: objhead like solisti1 occurs 1 with header line,
objpack like sopcklsti1 occurs 1 with header line,
objtxt like solisti1 occurs 10 with header line,
objbin like solisti1 occurs 10 with header line,
reclist like somlreci1 occurs 1 with header line.
* Mailing initilization
* Receivers
reclist-receiver = 'rahul.krishnan@wipro.com'.
reclist-rec_type = 'U'.
append reclist.
reclist-receiver = sy-uname.
reclist-rec_type = 'B'.
append reclist.
doc_chng-obj_name = 'SFORM'.
doc_chng-obj_descr = 'Smart Form: Short Description'.
*MAIN TEXT.
objtxt = 'Line One of ObjTxt'.
append objtxt.
objtxt = 'Convert SForm to PDF'.
append objtxt.
objtxt = 'Created by Rahul'.
append objtxt.
*WRITING PACKING LIST.
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
clear objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'BIN'.
append objpack.
***
loop at pdfitab. "MYLINE.
* CONCATENATE MYLINE-TDFORMAT MYLINE-TDLINE INTO OBJBIN-LINE.
translate pdfitab using ' ~'.
concatenate pdfbuffer pdfitab into pdfbuffer.
endloop.
translate pdfbuffer using '~ '.
length = strlen( pdfbuffer ).
do.
objbin = pdfbuffer.
append objbin.
shift pdfbuffer left by 255 places.
if pdfbuffer is initial.
exit.
endif.
enddo.
***
describe table objbin lines tab_lines.
read table objbin index tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + strlen( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'SFORM'.
objpack-obj_descr = 'ATTACHED DOCUMENT'.
append objpack.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = reclist
* EXCEPTIONS
* TOO_MANY_RECEIVERS = 1
* DOCUMENT_NOT_SENT = 2
* DOCUMENT_TYPE_NOT_EXIST = 3
* OPERATION_NO_AUTHORIZATION = 4
* PARAMETER_ERROR = 5
* X_ERROR = 6
* ENQUEUE_ERROR = 7
* OTHERS = 8
.
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 'WS_DOWNLOAD'
exporting
bin_filesize = length
* CODEPAGE = ' '
filename = 'c:tea1.PDF'
filetype = 'BIN'
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = objbin
* FIELDNAMES =
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards,
Gayathri
Message was edited by: Gayathri Hariharan
04-06-2006 10:50 AM
Hi Jaya,
First form output to OTF and use the function module
CONVERT_OTF_2_PDF.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = gc_false
IMPORTING
bin_filesize = gv_filesize
TABLES
otf = gt_otfdata
doctab_archive = lt_doctab
lines = gt_pdfdata
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING conversion_error.
ENDIF.
Thanks&Regrads,
Siri.
04-06-2006 12:00 PM
Hi,
Here is a sample code for converting smartforms to pdf.
Regards,
Anjali