Skip to Content
0
May 25, 2010 at 05:40 AM

Pdf Currupted after unzipping it

25 Views

Hi everyone

My Problem is that i had created a smartform and convert it into pdf and then zip that pdf.

when i open the zip file the pdf in it is not there. I am using the following code. please help .

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZJSF_INVOICEEMAILCOPYNET3'

variant = ' '

importing

fm_name = w_form_name

exceptions

no_form = 1

no_function_module = 2

others = 3.

l_control_param-no_dialog = 'X'.

l_control_param-preview = 'X'.

l_control_param-getotf = 'X'.

l_output_options-tddest = 'LOCL'.

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 w_form_name

exporting

control_parameters = l_control_param

output_options = l_output_options

user_settings = 'X'

wa_invoice_comb_hdr = wa_invoice_comb_hdr

importing

job_output_info = l_job_info

tables

it_invoice_comb_itm_final = it_lstnew

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[] = l_job_info-otfdata[].

  • converting OTF data into pdf data**************************

call function 'CONVERT_OTF'

exporting

format = 'PDF'

importing

bin_filesize = v_len_in

  • bin_file =

tables

otf = i_otf

lines = i_tline[]

exceptions

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

others = 5.

call function 'SX_TABLE_LINE_WIDTH_CHANGE'

exporting

line_width_dst = '255'

tables

content_in = i_tline[]

content_out = file_tab[]

exceptions

err_line_width_src_too_long = 1

err_line_width_dst_too_long = 2

err_conv_failed = 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.

"create xstring from table

call function 'SCMS_BINARY_TO_XSTRING'

exporting

input_length = bytecount

importing

buffer = content_x

tables

binary_tab = file_tab.

"Add File to Zip.

lv_filename = wa_lstnew-vbeln.

g_zipper->add(

exporting

name = lv_filename

content = content_x ).

call method g_zipper->save

receiving

zip = zip.

call function 'SCMS_XSTRING_TO_BINARY'

exporting

buffer = zip

importing

output_length = bytecount

tables

binary_tab = i_record.

"Save the file

call function 'GUI_DOWNLOAD'

exporting

bin_filesize = bytecount

filename = file_path

filetype = 'BIN'

tables

data_tab = i_record.