2009 May 07 12:24 PM
Hi experts,
I'm trying to send an HTML eMail by using function module 'SO_NEW_DOCUMENT_SEND_API1'.
Without success! When I debug the code, the format os switched from HTM to RAW and I have no clue why.
Here's my code:
data objpack like sopcklsti1 occurs 2 with header line.
data objhead like solisti1 occurs 1 with header line.
data objbin like solisti1 occurs 10 with header line.
data objtxt like solisti1 occurs 10 with header line.
DATA ls_doc_send TYPE sodocchgi1.
ls_doc_send-obj_name = 'Exp.Auth. Notif.'.
ls_doc_send-obj_descr = 'Expiring Authentication Notification'.
ls_doc_send-sensitivty = 'O'.
ls_doc_send-obj_langu = 'E'.
DESCRIBE TABLE i_mailtext LINES lv_int_send.
READ TABLE i_mailtext into lv_last_line INDEX lv_int_send.
ls_doc_send-doc_size = ( lv_int_send - 1 ) * 255 + STRLEN( lv_last_line ).
CLEAR objpack-transf_bin.
* objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
DESCRIBE TABLE i_mailtext LINES tab_lines.
objpack-body_num = tab_lines.
objpack-doc_type = 'HTM'.
objpack-doc_size = ls_doc_send-doc_size.
APPEND objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_doc_send
document_type = 'HTM'
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
object_header = objhead
object_content = i_mailtext
* CONTENTS_HEX = i_mailtext
* OBJECT_PARA =
* OBJECT_PARB =
receivers = i_receiver
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.The parameter i_Mailtext is the prepared HTML document. Do oyu know which HTML elements/tags are mandatory?
objhead and objbin are not set, should I?
Thanks and regards,
Steffen
2009 May 07 12:28 PM
Hello,
check this program to find how to use the FM
This Fm 'SO_NEW_DOCUMENT_SEND_API1' is used all in this program please check it.
RADMSJOB Call Mass Dictionary Checks (Friday-Sunday Only)
RFASSIGNAR Assignment of Open Items
RHMAIL10 Submit Report for MAIL Processing
RHPMDYNMASS Dynamic personnel action for HR Funds and Position Managemen
RKSCMAMAIL Send Mail to User
RPLFDAF0PBSMOD
RSCMST CMS: Test programs
RSSOAUTH SAPoffice: Internal subroutine: Adjust folder authorization
RSSOOT01 Program for object type SOFM: Office document
RSSOQUMS Send mail because of quota
RSSOQURE Evaluation of quota data at distribution list level
RSSOQUTA Calculation of the quota
RSSOUSCO Consistency check of user tables
RSSXRAWGEN Send a RAW/RAW Test Document in the SAPoffice Inbox
SAPF070 Reconcile Documents and Account Transaction Figures
Hello,
check this program to find how to use the FM
This Fm 'SO_NEW_DOCUMENT_SEND_API1' is used all in this program please check it.
RADMSJOB Call Mass Dictionary Checks (Friday-Sunday Only)
RFASSIGNAR Assignment of Open Items
RHMAIL10 Submit Report for MAIL Processing
RHPMDYNMASS Dynamic personnel action for HR Funds and Position Managemen
RKSCMAMAIL Send Mail to User
RPLFDAF0PBSMOD
RSCMST CMS: Test programs
RSSOAUTH SAPoffice: Internal subroutine: Adjust folder authorization
RSSOOT01 Program for object type SOFM: Office document
RSSOQUMS Send mail because of quota
RSSOQURE Evaluation of quota data at distribution list level
RSSOQUTA Calculation of the quota
RSSOUSCO Consistency check of user tables
RSSXRAWGEN Send a RAW/RAW Test Document in the SAPoffice Inbox
SAPF070 Reconcile Documents and Account Transaction Figures
2009 May 07 12:28 PM
Hello,
check this program to find how to use the FM
This Fm 'SO_NEW_DOCUMENT_SEND_API1' is used all in this program please check it.
RADMSJOB Call Mass Dictionary Checks (Friday-Sunday Only)
RFASSIGNAR Assignment of Open Items
RHMAIL10 Submit Report for MAIL Processing
RHPMDYNMASS Dynamic personnel action for HR Funds and Position Managemen
RKSCMAMAIL Send Mail to User
RPLFDAF0PBSMOD
RSCMST CMS: Test programs
RSSOAUTH SAPoffice: Internal subroutine: Adjust folder authorization
RSSOOT01 Program for object type SOFM: Office document
RSSOQUMS Send mail because of quota
RSSOQURE Evaluation of quota data at distribution list level
RSSOQUTA Calculation of the quota
RSSOUSCO Consistency check of user tables
RSSXRAWGEN Send a RAW/RAW Test Document in the SAPoffice Inbox
SAPF070 Reconcile Documents and Account Transaction Figures
2009 May 07 12:46 PM
Hi,
try This u ill get some idea ..
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
submit ztestalv02 and return.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
if sy-subrc = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards...
if not let me know.
2009 May 07 1:18 PM
Hi jinku,
thanks for your answer.
But also with your code I get a return code 2 = document_not_sent.
I have created the mail text like this:
mailtxt = '<body>test</body>'.
APPEND mailtxt.Anything I miss?
During debugging, I found out that the doucment type is always reset to RAW in form "format_prepare_for_insert" in lines as l_file_type is initial:
case l_object_type.
when 'INT' or 'HTM' or 'TXT' or 'ICS'.
if l_file_format = bin.
set_type ext object_type.
else.
set_type raw object_type.
endif.Regards, Steffen
Edited by: Steffen Weber on May 7, 2009 2:45 PM
Edited by: Steffen Weber on May 7, 2009 3:02 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |