‎2010 Jul 26 11:46 PM
I have searched the forum and found several examples and threads about function module SO_NEW_DOCUMENT_ATT_SEND_API1.
I have used it before but am now having a specific problem and cannot find a solution.
The RECEIVERS table is being populated with multiple addresses. The intent is to send one single email to all the recipients listed. Instead, the email is being sent once per recipient.
The code below shows two addresses. It should send one email with a TO: and CC: address. Instead it sends it twice (with TO: and CC: populated in each email). "test1" and "test2" are incomplete email addresses for this example.
I assumed it was a simple coding error on my part. Anyone see it? This is on an ECC 6.0 system.
CLEAR it_mailtxt-line.
it_mailtxt-line = 'testing email with multiple recipients.'.
APPEND it_mailtxt.
DESCRIBE TABLE it_mailtxt LINES mailtxt_size.
it_doc_att-obj_descr = 'Test email'.
it_doc_att-sensitivty = 'F'.
it_doc_att-doc_size = mailtxt_size * 255.
CLEAR it_mailpack-transf_bin.
it_mailpack-head_start = 1.
it_mailpack-head_num = 0.
it_mailpack-body_start = 1.
it_mailpack-body_num = mailtxt_size.
it_mailpack-doc_type = 'RAW'.
APPEND it_mailpack.
REFRESH it_reclist.
CLEAR it_reclist.
it_reclist-receiver = 'test1'.
it_reclist-express = 'X'.
it_reclist-rec_type = 'U'.
it_reclist-com_type = 'INT'.
APPEND it_reclist.
CLEAR it_reclist.
it_reclist-copy = 'X'.
it_reclist-receiver = 'test2'.
it_reclist-express = 'X'.
it_reclist-rec_type = 'U'.
it_reclist-com_type = 'INT'.
APPEND it_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = it_doc_att
COMMIT_WORK = 'X'
TABLES
packing_list = it_mailpack
object_header = it_mailhead
contents_txt = it_mailtxt
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorizationfiltered = 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.
‎2010 Jul 27 12:30 AM
‎2010 Jul 27 12:30 AM
‎2010 Jul 27 12:51 AM
Yes, so I pulled out the section of code above (and the DATA declarations) and pasted it in a separate program. Same result.
Thought I might be missing a parameter in one of the structures.
‎2010 Jul 27 2:58 AM
No answer for your issue with the function module, but suggest you have a look at the class based email solution CL_BCS - it is well documented and provides a lot of additional functionality.
Andrew
‎2010 Jul 27 7:20 AM
Hi,
Can you please check any OSS NOTE on SAP service market place ?
There are 32 notes with this FM .. may be any one can give you any idea..
‎2010 Jul 27 8:53 AM
Hi,
you should create a distribution list via SBWP > Distribution List.
Then check the function module documentation in order to find how to fill the RECEIVERS[ ] table parameter with the created distribution list.
Regards,
Andrea
‎2010 Jul 27 2:18 PM
Sorry folks. My error. Some of the target recipients were test accounts with mail forwarding. There was some looping going on that looked like duplicate emails. My apologies.