Hi all,
I need generate a txt file, compress it into a zip file and send e-mail attachment, but gmail does not recognize the file extension, and if I download the zip file from hotmail, the txt file is not formatted in columns.
This is the correct column format
This is the incorrect column format
This is file in gmail and downloaded
This is program
CALL FUNCTION 'LIST_TO_ASCI' TABLES listasci = ascilist listobject = listtab EXCEPTIONS empty_list = 1 list_index_invalid = 2 OTHERS = 3. data lc_newline type c value cl_abap_char_utilities=>cr_lf. clear lv_strmsg. loop at ascilist. " into wa_text. concatenate lv_strmsg ascilist-line lc_newline into lv_strmsg. endloop. clear: lv_xstrmsg, lv_encoding. lv_encoding = '4130'. " I try with 1160, 4110, 4120, also without this parameter CALL FUNCTION 'SCMS_STRING_TO_XSTRING' EXPORTING TEXT = lv_strmsg ENCODING = lv_encoding IMPORTING BUFFER = lv_xstrmsg. TRY. send_request = cl_bcs=>create_persistent( ). lv_subject = 'subject'. lv_name_str = 'name_file.txt'. create object zipper. zipper->add( name = lv_name_str content = lv_xstrmsg ). lv_zipfilehex = zipper->save( ). refresh binary_content. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING BUFFER = lv_zipfilehex IMPORTING OUTPUT_LENGTH = lv_size TABLES BINARY_TAB = binary_content. PERFORM body_mail CHANGING main_text . document = cl_document_bcs=>create_document( i_type = 'HTM' i_text = main_text i_subject = lv_subject ). size = lv_size. document->add_attachment( i_attachment_type = 'zip' i_attachment_subject = lv_name i_attachment_size = size i_att_content_hex = binary_content ). send_request->set_document( document ). email = 'mail@gmail.com'. recipient = cl_cam_address_bcs=>create_internet_address( email ). send_request->add_recipient( recipient ). CALL METHOD send_request->set_status_attributes EXPORTING i_requested_status = 'E'. sent_to_all = send_request->send( i_with_error_screen = 'X' ). COMMIT WORK. IF sent_to_all IS INITIAL.A size = lv_size. document->add_attachment( i_attachment_type = 'zip' i_attachment_subject = lv_name i_attachment_size = size i_att_content_hex = binary_content ). send_request->set_document( document ). email = 'mail@gmail.com'. recipient = cl_cam_address_bcs=>create_internet_address( email ). send_request->add_recipient( recipient ). CALL METHOD send_request->set_status_attributes EXPORTING i_requested_status = 'E'. sent_to_all = send_request->send( i_with_error_screen = 'X' ). COMMIT WORK. GE s022(so). CALL METHOD send_request->set_status_attributes EXPORTING i_requested_status = 'E'. sent_to_all = send_request->sen d( i_ sent_to_all = send_request->send( i_with_error_screen = 'X' ). COMMIT WORK. with_error_screen = 'X' ). COMMIT WORK.
Best regards,
Robert