How to show the attached document in email in inline mode
Hi, ABAP Community.
In our project there is a need to send a document to end-user e-mail account, in this specific case it is Microsoft Outlook. The sending is working, but I have a problem with the way it arrives the user mailbox. The HTM-file arrives as an attachment while I would like to see it in inline mode — straight in the message body.
Below, I post some code fragment to let you understand what exactly I'm doing. Suppose, my function has already the document in binary format (SOLIX_TAB), now in order to send the document the class CL_BCS is used and I have to follow the next steps:
- Create the document with CL_DOCUMENT_BCS:
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = im_text
i_length = txt_len
i_subject = im_subject ).
- Add the attachment:
- Add the document to the send request:
DATA: send_request TYPE REF TO cl_bcs.
CALL METHOD send_request->set_document( document ).
- Set instant sending:
CALL METHOD send_request->set_send_immediately( 'X' ).
- Set recipient:
DATA: recipient TYPE REF TO if_recipient_bcs.
CALL METHOD send_request->add_recipient
i_recipient = recipient
i_express = 'X'.
- Send the document:
CALL METHOD send_request->send(
i_with_error_screen = 'X'
result = sent_to_all ).
IF sent_to_all = 'X'.
As the result of this code execution, I got the blank email with two attachments: one with the HTM extension and one with the DOC. I would like that the content of the HTM-document (container with im_text, im_subject) will be displayed in the message body and the only DOC-file will be sent as an attachment. How can I get the desired result?