Hey Guys,
Finally got an answer to my Question. What a coincidence... I was searching for how to use graphs in email (The case of sending mail with graphs .) and from there i came accross this solution for images too.
Everthing is same just instead of attaching the image as an attachment i am using CL_GBT_MULTIRELATED_SERVICE class to add the image as a binary part using method add_binary_part.
Previous Code(not working on mobile):
Attaching image to the mail
WHILE l_img1 IS NOT INITIAL.
ls_hex-line = l_img1.
APPEND ls_hex TO lt_hex1.
SHIFT l_img1 LEFT BY 255 PLACES IN BYTE MODE.
ENDWHILE.
*Findthe Size of the image
DESCRIBE TABLE lt_hex1 LINES lv_img1_size.
lv_img1_size = lv_img1_size * 255.
*--------------------------------------------------------------------*
*Attach Images
*--------------------------------------------------------------------*
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'jpg' " Document Class for Attachment
i_attachment_subject = 'dh' " Attachment Title
i_attachment_size = lv_img1_size " Size of Document Content
i_att_content_hex = lt_hex1 " Content (Binary)
).
CLEAR: ls_hex,lv_img1_size.
REFRESH lt_hex1.
New Code (Working on mobile)
CALL METHOD cl_bcs_convert=>xstring_to_solix // converting xstring to solix table type format
EXPORTING
iv_xstring = content
RECEIVING
et_solix = it_solix.
DATA: description TYPE so_obj_des .
DATA: obj_len TYPE so_obj_len .
obj_len = XSTRLEN( content ).
CONCATENATE lv_image_src '.jpg' INTO lv_image_src.
CALL METHOD ob_gbt_multirelated_service->add_binary_part // Adding image to the mail
EXPORTING
content = it_solix
filename = lv_image_src
extension = 'JPG'
description = description
content_type = 'image/jpg'
length = obj_len
content_id = lv_image_src.