07-03-2006 7:10 AM
Hi experts,
Can any one tell me how to create PDF format using my smartforms output?
Iam working on invice smartforms using <b>VF02>Billing document>Issue output to</b>...
Since i do not have any print program is it possible to create PDF form??
Reward guaranteed
thanks
kaki
07-03-2006 7:13 AM
Hi,
Send the print request to spool, and from spool convert the output to PDF using fm CONVERT_ABAPSPOOLJOB_2_PDF,
Rgds,
07-03-2006 7:14 AM
Hi Kaki,
Use these FM's
"CONVERT_OTF_2_PDF" or "SX_OBJECT_CONVERT_OTF_PDF" .
Kind Regards
Mukesh KUmar
07-03-2006 7:18 AM
Hi Sailatha & Mukesh,
Can u elaborate more...
vf02->billingdoc->issue outputto--> here iam using message type ZRD3 and Print preview.How can i go to spool request from here?I do not have any print program to call the function module...!!!
07-03-2006 7:18 AM
Hi Kaki,
please check the below code it may helpful for u
All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
s_control_parameters-no_dialog = 'X'.
s_control_parameters-getotf = 'X'.
CALL FUNCTION v_func_name "call your smartform
EXPORTING
output_options = s_output_options
control_parameters = s_control_parameters
IMPORTING
job_output_info = s_job_output_info
call function 'CONVERT_OTF_2_PDF'
tables
otf = s_job_output_info-otfdata
lines = t_pdf
07-03-2006 7:18 AM
Hi,
This has the print program. This fires the print program that is configured in the NACE transaction tied to the specific output. So, if you want a PDF you will have do the changes there.
Regards,
Ravi
07-03-2006 7:22 AM
Hai Kaki
Check the following Code
REPORT Z_ABAPOUTPUT_PDF_SREE_13424 .
data: w_ident like tsp01-rqident,
w_doctype like tsp01-rqdoctype,
w_bytecount type i.
data: itab_pdf like tline occurs 0 with header line.
parameter spoolnum like tsp01-rqident obligatory.
selection-screen begin of block a2 with frame.
parameters: to_pc radiobutton group a2 default 'X',
pcfile like rlgrap-filename lower case,
to_unix radiobutton group a2,
unixfile(255) lower case.
selection-screen end of block a2.
********************************
at selection-screen on block a2.
********************************
if to_pc = 'X' and pcfile is initial.
message e398(00) with 'Enter PC File Name.'.
elseif to_unix = 'X' and unixfile is initial.
message e398(00) with 'Enter Unix File Name.'.
endif.
*******************************
at selection-screen on spoolnum.
*******************************
select single rqident rqdoctype
into (w_ident, w_doctype)
from tsp01
where rqident = spoolnum.
if sy-subrc ne 0.
message e398(00) with 'Spool' spoolnum 'not found'.
endif.
************************************************
at selection-screen on value-request for pcfile.
************************************************
call function 'WS_FILENAME_GET'
exporting
mask = ',.,..'
importing
filename = pcfile
exceptions
others = 1.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*******************
start-of-selection.
*******************
if w_doctype = 'LIST'.
perform get_abap_spool_in_pdf.
elseif w_doctype = 'OTF'.
perform get_otf_spool_in_pdf.
endif.
if to_pc = 'X'.
perform write_pdf_spool_to_pc.
else.
perform write_pdf_spool_to_unix.
endif.
message i398(00) with 'Completed OK'.
************************************************************************
form get_abap_spool_in_pdf.
<b> refresh itab_pdf.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = w_ident
importing
pdf_bytecount = w_bytecount
tables
pdf = itab_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
if sy-subrc ne 0.
message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
endif.</b>
endform.
************************************************************************
form get_otf_spool_in_pdf.
<b> refresh itab_pdf.
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
exporting
src_spoolid = w_ident
importing
pdf_bytecount = w_bytecount
tables
pdf = itab_pdf
exceptions
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
if sy-subrc <> 0.
message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
endif.</b>
endform.
************************************************************************
form write_pdf_spool_to_unix.
open dataset unixfile for output in binary mode.
if sy-subrc ne 0 .
message e398(00) with 'Cannot open unix file for output:' unixfile.
endif.
loop at itab_pdf.
transfer itab_pdf to unixfile.
if sy-subrc ne 0 .
message e398(00) with 'Cannot write to unix file:' unixfile.
endif.
endloop.
close dataset unixfile.
endform.
************************************************************************
form write_pdf_spool_to_pc.
call function 'WS_DOWNLOAD'
exporting
bin_filesize = w_bytecount
filename = pcfile
filetype = 'BIN'
tables
data_tab = itab_pdf
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 e398(00) with 'Cannot download to PC. Error =' sy-subrc.
endif.
endform.
Thanks & regards
Sreeni