2008 Jan 09 9:24 PM
Hi Experts,
We have an issue with a custom program that sends HTML email notifications. I am using function module SO_DOCUMENT_SEND_API1. The CONTENTS table will have HTML tags. The issue here is that the content or body of certain emails are blank. Not all emails generated from this program has this issue. When i look at these blank emails in SOST, i could see the contents. Only thing is when the user receives this email in his external email address, the contents are missing and he can see only the subject of the email. Has anyone faced this issue before? Is there any desktop settings that needs to be changed inorder to view HTML email? Let me know ASAP. Points will be rewarded for sure.
Below is my code to send HTML emails.
packing_list-head_start = 1.
packing_list-head_num = 1.
packing_list-body_start = 1.
packing_list-body_num = count.
packing_list-doc_type = 'HTML'.
packing_list-obj_descr = 'Notification'.
packing_list-obj_name = 'Notification.htm'.
packing_list-doc_size = ( count - 1 ) * 255 +
STRLEN( contents-line ).
APPEND packing_list.
CLEAR packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
commit_work = 'X'
TABLES
packing_list = packing_list
contents_bin =
contents_txt = contents
receivers = real_recipients
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.
Regards,
Maria.
2008 Jan 15 1:17 PM
Hi Maria,
I have the same problem, did you already find any solution?
Thanks in advance.
Best regards.
Ana Carolina Ramalho
Fertilizantes Heringer - Brazil
2008 Feb 22 3:05 PM
Hi guys,
I am working on this topic as well, but I am facing some major problems.
We are running 4.6C at the moment (yes, I know, its old ) and I am not able to send any HTML email.
You are using the document_type = 'HTM'. Unfortunately, it is not available in 4.6C.
The document_type refers to the truth table TSOTD which does not contain HTM.
I add HTM manually but its still not working. Which System are you using?
2008 Feb 28 9:26 PM
Maria,
Did you ever figure out how to get html into the body of an email?
-Ken
2008 Feb 28 9:35 PM
Ken,
Check this
submit yattr0001 exporting list to memory
with p_docno = xdocno
and return.
call function 'LIST_FROM_MEMORY'
tables
listobject = report_list
exceptions
not_found = 1
others = 2.
call function 'WWW_HTML_FROM_LISTOBJECT'
exporting
template_name = 'WEBREPORTING_REPORT'
tables
html = report_html
listobject = report_list.
loop at report_html.
move report_html to objtxt.
append objtxt.
endloop.
objpack-doc_type = 'HTM'.
describe table objtxt lines tab_lines.
objpack-body_start = v_lines.
objpack-body_num = tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-obj_descr = w_docno_temp.
append objpack.
clear objpack.
doc_chng-obj_name = w_docno_temp.
doc_chng-obj_descr = w_subject.
reclist-receiver = to_smtp_addr.
reclist-rec_type = 'U'.
reclist-express = 'X'.
append reclist.
v_unm = sy-uname.
move v_unm to v_saddress.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = doc_chng
sender_address = v_saddress
sender_address_type = 'U'
commit_work = 'X'
tables
packing_list = objpack
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
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.
a®
2008 Feb 28 10:35 PM
Dear ArS,
Thanks for the code. It fails to send anything in the e-mail body. It just has the subject filled.
Ideas why?
-Ken
2008 Apr 01 4:29 PM
2010 Apr 02 3:55 AM
Wow...ECC7.0....light years ahead of the rest of the SAP Universe.
2010 Apr 01 6:58 AM
I have the same issue.
I noticed that, document_data-doc_size info doesn't send correctly to the function. I suggest you to control this information, it solves my problem.
2010 Apr 01 9:53 AM
Hi,
I kindly suggest you to read thid blog by the great Thomas Jung:
[Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/789] [original link is broken] [original link is broken] [original link is broken];
Regards,
Andrea