on 07-01-2011 6:35 AM
Hi experts,
I have a requirement like if I click a button in a view i need ti generate a PDF through smart form.
Is this possible. If so please tell me the way..
Thanks & Regards
Hi Sharma,
Create Interactive form in your view, create one node say PDF_SOURCE under this one attribute PDF_SOURCE of type XSTRING.
Bind this to IF form Datasource and pdfsource.
in your button action write code to call your smartform
using SSF_FUNCTION_MODULE_NAME
using FM CONVERT_OTF and attach_file_to_response
*convert to pdf
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_bytecount
TABLES
otf = ls_job_output_info-otfdata
lines = lt_lines
EXCEPTIONS
err_conv_not_possible = 1
err_bad_otf = 2.
loop at lt_lines into ls_line.
lv_string = ls_line.
export mydata = lv_string to data buffer lv_buffer.
import mydata to l_xline from data buffer lv_buffer in char-to-hex
mode.
concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
endloop.
call method cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'ZWTY_PACKINGSLIP'
i_content = l_pdfstring
i_mime_type = 'BIN'
i_in_new_window = abap_false
i_inplace = abap_false.
also check this..
http://abapcodexperiments.wordpress.com/2011/03/20/smartform-pdf-webdynpro-abap/
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kris
i have done the same thing.
i have tried doing it in the wd component on click of a button.
when the method call function module of the smartform is being executed i couldn find the values getting into the table which we pass into method convert_otf.
when i do the same thing in se38 then i m able to find the table being filled and the output is visible.
why is this diffrence occuring.
I am very new to wd so please explain in a elobrated manner.
Reply is greatly appreciated.
Regards,
Shravan.
Hi,
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = l_size
bin_file = l_xfile
TABLES
otf = job_outp_inf-otfdata
lines = lt_pre_pdf.
I have set the attribute PDF_SOURCE to bin_file (i.e l_xfile).
Earlier I dindn get the values into the table job_outp_inf but later i created another applicaton where i was able to see the values in the table.
There might be some minor code mistake in my earlier application.
Regards,
Shravan
Hi,
Please search SCN on the same as there many threads already answered.
Please find the below link -
http://www.sdn.sap.com/irj/scn/elearn?rid=/webcontent/uuid/90937715-aae8-2a10-a0b9-cb86e80b084d [original link is broken]
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.