hiii,
i have posted a problem in the following thread.
at some extent Surpreet is able to solve the problem, but now we r stuck to this that email is coming with attachment but not the exact that i am attching and trying to send the mail.
can any one check this code and rectify if any error is there.
REPORT YBALTEST. DATA: gd_cnt TYPE i, gd_sent_all(1) TYPE c, gd_doc_data LIKE sodocchgi1, gd_error TYPE sy-subrc. DATA: it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE, it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE, it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE. * Binary store for PDF DATA: BEGIN OF it_pdf_output OCCURS 0, row(255). DATA: END OF it_pdf_output. START-OF-SELECTION. perform send_email_message . *&---------------------------------------------------------------------* *& Form SEND_EMAIL_MESSAGE *&---------------------------------------------------------------------* * Send email message *----------------------------------------------------------------------* FORM send_email_message. DATA: tab_lines LIKE SY-TABIX. CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = 'C:test.pdf' filetype = 'BIN' TABLES data_tab = it_pdf_output . * Populate the subject/generic message attributes concatenate 'Attached is the ' ' are waiting for.' into it_message. append it_message. DESCRIBE TABLE it_message LINES tab_lines. READ TABLE it_message INDEX tab_lines. gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ). gd_doc_data-obj_langu = sy-langu. gd_doc_data-obj_name = 'SENDFILE'. gd_doc_data-obj_descr = 'Attachement'. gd_doc_data-sensitivty = 'O'. describe table it_pdf_output lines tab_lines. * Describe the body of the message CLEAR it_packing_list-transf_bin. it_packing_list-head_start = 1. it_packing_list-head_num = 0. it_packing_list-body_start = 1. it_packing_list-doc_type = 'RAW'. it_packing_list-body_num = tab_lines. APPEND it_packing_list. describe table it_pdf_output lines tab_lines. CLEAR it_packing_list. it_packing_list-transf_bin = 'X'. it_packing_list-head_start = 1. it_packing_list-head_num = 1. it_packing_list-body_start = 1. it_packing_list-doc_type = 'RAW'. it_packing_list-body_num = tab_lines. it_packing_list-doc_size = tab_lines * 255. it_packing_list-OBJ_DESCR = ' object '. it_packing_list-obj_name = 'MAIL'. APPEND it_packing_list. it_receivers-receiver = 'sbal@.com'. it_receivers-rec_type = 'U'. it_receivers-com_type = 'INT'. APPEND it_receivers . * Call the FM to post the message to SAPMAIL CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = gd_doc_data * put_in_outbox = 'X' commit_work = 'X' * IMPORTING * sent_to_all = gd_sent_all TABLES packing_list = it_packing_list contents_txt = it_message contents_bin = it_pdf_output receivers = it_receivers 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. ENDFORM. " SEND_EMAIL_MESSAGE
thanx
abhishek suppal