Hi,
I try to send file of type 'DAT' as attachment.
The problem is that I receive all the data in one line.
How can I fix it?
My code is:
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = i_app
out = lt_objbinc
EXCEPTIONS
compress_error = 1
OTHERS = 2
.
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 'TABLE_DECOMPRESS'
TABLES
in = lt_objbinc
out = lt_objbin
EXCEPTIONS
compress_error = 1
table_not_compressed = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
receiver_list-receiver = e_mail.
receiver_list-rec_type = 'U'.
receiver_list-com_type = 'INT'.
APPEND receiver_list.
mailhead = 'Applicants'.
APPEND mailhead.
lt_objtxt = 'list of applcants.'.
APPEND lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
CLEAR packing_list-transf_bin.
packing_list-head_start = 1.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = l_tab_lines.
packing_list-doc_type = 'RAW'.
APPEND packing_list.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
READ TABLE lt_objbin INDEX l_tab_lines.
packing_list-doc_size =
( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
packing_list-transf_bin = 'X'.
packing_list-head_start = 1.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = l_tab_lines.
packing_list-doc_type = 'DAT' . "'TXT'.
packing_list-obj_name = 'attachment'.
packing_list-obj_descr = 'description.txt'.
APPEND packing_list.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = packing_list
object_header = mailhead
contents_hex = lt_objbin
contents_txt = lt_objtxt
receivers = receiver_list
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Add a comment