cancel
Showing results for 
Search instead for 
Did you mean: 

Getting URL of an image uploaded in mime repository for HTML tag

ultimate_kapoor
Explorer
0 Kudos

I am using the FM SO_DOCUMENT_SEND_API1 to send an email with an excel file attachment.
I need the body of the email to contain an image that I have uploaded in mime repository in se80.

I have tried retrieving the URL of the image using FM 'WWW_GET_MIME_OBJECT' and 'DP_CREATE_URL'
and then entering the URL in html tag while populating the text body of the mail as shown below.
assuming that the URL received is "url_link"

<img src = "url_link" align = "right";width = 150>

This approach is not working. The FM 'WWW_GET_MIME_OBJECT' is failing.

However, if I replace the url_link with actual url from the internet of an image. The image is getting embedded as expected in the mail body.


How do I ensure that instead of getting the image from outside, I can get it internally once uploaded in SAP System?

Accepted Solutions (0)

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor

DP_CREATE_URL is for SAP GUI, not for emails.

To send an image embedded in an HTML email, via <img src="..." ...>, you have 2 possibilities for src:

  • <img src="cid:anycontentidyouwant" ...> : you must create a multipart email, one part being the HTML, other parts are whatever you want, like an image with header field "Content-Id: anycontentidyouwant". You use CL_GBT_MULTIRELATED_SERVICE to build the multipart email. There are examples in the forum. You link it to BCS via the method CREATE_FROM_MULTIRELATED of class CL_DOCUMENT_BCS.
  • <img src="data:themimetypeofimage/base64:thebase64ofimage" ...>. It's usually not recommended and not supported by some email clients.