Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Pdf Currupted after unzipping it

PoojaThareja
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

JerryWang
Advisor
Advisor
0 Kudos

Hello friend,

What is the size of your zip file? I mean after you call

call function 'SCMS_XSTRING_TO_BINARY' exporting buffer = zip importing output_length = bytecount tables binary_tab = i_record, what is content of bytecount? Are you sure the zip operation is done successfully?

Best Regards,

Jerry

1 REPLY 1

JerryWang
Advisor
Advisor
0 Kudos

Hello friend,

What is the size of your zip file? I mean after you call

call function 'SCMS_XSTRING_TO_BINARY' exporting buffer = zip importing output_length = bytecount tables binary_tab = i_record, what is content of bytecount? Are you sure the zip operation is done successfully?

Best Regards,

Jerry