05-16-2006 8:26 AM
Hi everyone!
Does someone know a solution to send e-Mails with attached MIME-Objects from MIME-Repository?
At the moment I'm using the class CL_BCS to send mail with works fine. Now I just want to attach (or even better embed!) for example one or more icons from the MIME-Repository to this mail.
Thanks in advance!
Message was edited by: Marc Glässer
05-16-2006 8:47 AM
Welcome to SDN
if you just want it as a image in the body of the mail, just send the image link as a html content in the body of the mail. (this has other problem, when openning the mail the system would require authentication into WAS system)
to send it as a attachment
1. read the mime
DATA: binary_content TYPE solix_tab.
data: o_mr_api type ref to if_mr_api.
if o_mr_api is initial.
o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).
endif.
call method o_mr_api->get
exporting
i_url = l_url
importing
e_is_folder = is_folder
e_content = l_current
e_loio = l_loio
exceptions
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
others = 5.
l_current will hold the image in a XSTRING var
convert the xstring to binary table
REFRESH binary_content .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_current
TABLES
binary_tab = binary_content.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'GIF' " pass the right mime type
i_attachment_subject = atta_sub
i_att_content_hex = binary_content.
Hope this helps.
Regards
Raja
05-16-2006 8:47 AM
Welcome to SDN
if you just want it as a image in the body of the mail, just send the image link as a html content in the body of the mail. (this has other problem, when openning the mail the system would require authentication into WAS system)
to send it as a attachment
1. read the mime
DATA: binary_content TYPE solix_tab.
data: o_mr_api type ref to if_mr_api.
if o_mr_api is initial.
o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).
endif.
call method o_mr_api->get
exporting
i_url = l_url
importing
e_is_folder = is_folder
e_content = l_current
e_loio = l_loio
exceptions
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
others = 5.
l_current will hold the image in a XSTRING var
convert the xstring to binary table
REFRESH binary_content .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_current
TABLES
binary_tab = binary_content.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'GIF' " pass the right mime type
i_attachment_subject = atta_sub
i_att_content_hex = binary_content.
Hope this helps.
Regards
Raja
05-16-2006 9:16 AM
Hi Raja,
thanks for the fast response and the welcome greets.
The solution with sending a link as a html content in the body of the mail is out of the question because of the authentication issue).
I'm not so familiar with the MIME-Repository and it's programming interfaces. So could you please somehow explain me how to attach for example a GIF-File from MIME-Repository with the filename "s_s_keyi.gif", logical ID "6B1679466E47604D82A22F06C8953F7D" and physical ID "412181A9DBF65915E10000000A1145AB"?
Your example showed a possibility with attaching the document by URL. What is the URL of the above "s_s_keyi.gif"?
05-16-2006 9:38 AM
no need for the logical id or the physical id.
(how did you get them?)
can you get the path of the image s_s_keyi.gif from transaction SE80?
Regards
Raja
assigning points to helpful answers by choosing the appropriate radiobuttons in the answers in the SDN way of saying thanks.
05-16-2006 9:47 AM
you can get the logical and physical id if you right click with the mouse in transaction SE80 on the filename and select "Properties".
The is no path in SE80 in the MIME-Repository showed. It's somehow organized in folders. Here the files lies in \SAP\PUBLIC\BC\Icons\s_s_keyi.gif. But I don't thinks it's the path or the url of the GIF-file.
05-16-2006 10:17 AM