‎2010 Mar 29 7:59 AM
Dear all,
I'm using FM 'EFG_GEN_SEND_EMAIL' to send an Email, for a single user its working fine, but I want to know is it possible sending the same mail to multiple users with the same FM, I searched the forum for the same & ended up finding no satisfying results. Using FM ''SO_NEW_DOCUMENT_ATT_SEND_API1' we can attain this but I want to know if it is possible with the former FM.
Thanks & Regards
Ajai
‎2010 Mar 29 8:40 AM
Hi,
It is not possible to send mail to multiple users using FM 'FG_GEN_SEND_EMAIL' . Please use FM ''SO_NEW_DOCUMENT_ATT_SEND_API1' to send mail.
Thanks & Regards
Rocky Agarwal
<personal contact information removed>
Edited by: Thomas Zloch on Mar 29, 2010 11:41 AM
‎2010 Mar 29 8:40 AM
Hi,
It is not possible to send mail to multiple users using FM 'FG_GEN_SEND_EMAIL' . Please use FM ''SO_NEW_DOCUMENT_ATT_SEND_API1' to send mail.
Thanks & Regards
Rocky Agarwal
<personal contact information removed>
Edited by: Thomas Zloch on Mar 29, 2010 11:41 AM
‎2010 Mar 29 9:04 AM
Dear Rocky Agarwal,
I tried using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' but was not sent to the ID's..is there any additional settings to be done for using this particular FM??
‎2010 Mar 29 10:56 AM
Hi,
PFB the code that i have used to send mail. In case you need any additional clarification, please feel free to ask..Hope it will help you:
*To fill the content message
REFRESH i_message.
wa_message = l_subject. "Production Error Log Details for Error Code &
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = ' '.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_system.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_sdate.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_message.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_description.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_count.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = ' '.
APPEND wa_message TO i_message.
CLEAR wa_message.
wa_message = l_message2.
APPEND wa_message TO i_message.
CLEAR wa_message.
* To populate the subject/generic message attributes
wa_doc_data-obj_langu = sy-langu.
wa_doc_data-obj_name = c_objname.
wa_doc_data-obj_descr = text-t20. "Production Error Log Details
wa_doc_data-sensitivty = c_r.
* Fill receipient information
CLEAR wa_receivers.
REFRESH i_receivers.
LOOP AT i_emailid INTO wa_emailid.
IF wa_emailid-email_id CA c_attherate. "@
wa_receivers-receiver = wa_emailid-email_id.
wa_receivers-rec_type = c_u. "U
ELSE.
TRANSLATE wa_emailid-email_id TO UPPER CASE.
wa_receivers-receiver = wa_emailid-email_id.
wa_receivers-rec_type = c_c. "C
ENDIF.
wa_receivers-com_type = c_int.
wa_receivers-notif_del = c_x.
wa_receivers-notif_ndel = c_x.
APPEND wa_receivers TO i_receivers.
CLEAR wa_receivers.
ENDLOOP.
* Call the Function Module to send the e-mail alongwith the attachments if any
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = c_x
commit_work = c_x
IMPORTING
sent_to_all = wa_sent_all
TABLES
contents_txt = i_message
receivers = i_receivers
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 EQ 0.
MESSAGE text-t08 TYPE 'S'."Mail(s) Send Successfully
ELSE.
MESSAGE text-t09 TYPE 'E'."Error in Sending Mail
ENDIF.
REFRESH:
i_message[],
i_receivers[].
‎2010 Mar 29 11:11 AM
Rocky thanks a lot..it helped..but I'm getting a warning message in sost Waiting for Communications Service.
And the mail is not delivered. What could be the problem? Any idea?
‎2010 Mar 29 11:20 AM
Ajay,
Have you received msg no 637. If so, then the SAPconnect, transaction SCOT needs to be configured.
Ask your basics team to do the necessary configurations.
Thanks.
‎2010 Mar 29 11:28 AM
Hi Ajay,
Its not an error. Jst select those mails in sost and click on 'Start send proc. for selection'. Your mail will be send.
Thanks & Regards
Rocky Agarwal
‎2010 Mar 29 11:32 AM
@ Viji, Message number is 672, Manually wen sent from there it is getting delivered to that address.
@ Rocky, Ya I did try that way & it was successful but this program will run in background so nothing manual has to be there in it Rocky..Any idea how to get rid of this warning??
‎2010 Mar 29 11:34 AM
Hi Ajay,
All mails will be delivered after some time. Don't worry. It is waiting for communications service to process all mail.
Thanks & Regards
Rocky Agarwal
‎2010 Mar 29 11:35 AM
Ajay,
Have you sent the mail successfully? If so then it was a time issue.
No need to do any manual actions. Just wait for some more time & it will be send automatically.
Thanks.
‎2010 Mar 29 11:54 AM
Dear Rocky & Viji,
Thanks a lot both of you!
I have executed the code again will check it after sometime. Hope it resolves..
Awarded points for yo'll
Thanks & Regards
Ajay
‎2010 Mar 29 8:51 AM
‎2010 Mar 29 8:57 AM
Dear Abapuser,
I_TAB_RECIPIENTS parameter in which FM you meant to say??
‎2010 Mar 29 9:02 AM
‎2010 Mar 29 9:08 AM
Dear Abapuser,
It is I_TAB_LINES that is there inside the Tables parameter which is for forming the body of the Email & not for the Address of recipients if I'm not wrong please check.
‎2010 Mar 29 9:11 AM
im not talking about i_tab_lines .im suggesting the second Tables parameter which is I_TAB_RECIPIENTS.if you cant see it in your code go to se37 and check Tables interface.Its there as optional Parameter.
CALL FUNCTION 'EFG_GEN_SEND_EMAIL'
EXPORTING
i_title = 'test'
I_SENDER = SY-UNAME
i_recipient = 'ABAP'
I_FLG_COMMIT = 'X'
I_FLG_SEND_IMMEDIATELY = 'X'
I_FLG_SENDER_IS_UNAME =
tables
i_tab_lines = i_tab_lines
I_TAB_RECIPIENTS = rece......................>check this
EXCEPTIONS
NOT_QUALIFIED = 1
FAILED = 2
OTHERS = 3
.
Edited by: abapuser on Mar 29, 2010 10:11 AM
‎2010 Mar 29 9:18 AM
EFG_GEN_SEND_EMAIL does not have a table parameter i_tab_recipients. EFG_GEN_SEND_EMAIL can not send to multiple recipients.
But this FM is just a wrapper for a call of several BCS classes. As there is not business logocal behind its easy to write an own Fm or even mothod which is doing exactly the same and is able to send to multiple recipients.
As you can see there is no logic with the recipient string:
l_smtp_addr = i_recipient.
l_rcl_recipient =
cl_cam_address_bcs=>create_internet_address( l_smtp_addr ).
* add recipient with its respective attributes to send request
l_rcl_send_req->add_recipient( l_rcl_recipient ).So even recipients divided by semicolon are not taken into effect.
I would write my own stuff for that.
‎2010 Mar 29 10:32 AM
There's nothing like a I_TAB_RECIPIENTS in this FM,
I think I should go with the other FM.
Is there any other possibilities people??
‎2010 Mar 29 10:35 AM
Hi Ajay,
For your requirement, plz use SO_NEW_DOCUMENT_ATT_SEND_API1.
GO to SE37 and enter this FM, already a sample code is available at FM documentation.
Copy it to your program, and test with multiple mail ID's. It will work.
Thanks.
‎2010 Mar 29 10:36 AM
Hi Ajay,
Normally if a mail needs sent to multiple people, it is better to have a Distribution list created and use this distribution list to send an email out. This also helps in maintainability of the list in case new people need added later.
Regards,
Chen
‎2010 Mar 29 8:59 AM
‎2010 Mar 29 9:26 AM
hi,
use below code to send mail to more than one
*For To Address
i_reclist-receiver = '1stmailid'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
*For Copy Address
i_reclist-receiver = '2ndmailid.com'.
i_reclist-rec_type = 'U'.
i_reclist-copy = 1.
APPEND i_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_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.
IF sy-subrc <> 0.
ENDIF.
Regards
Nausal
‎2010 Mar 30 6:33 AM
‎2010 Mar 30 6:35 AM
Dear Viji & Rocky,
I had kept those mails in the inbox & even after a day the status is still the same, they show waiting status only.
What can possibly be the problem?
Kindly help resolve the issue.
‎2010 Mar 30 10:27 AM
Hi Ajay,
Try using the below code after the fm to send mail it would work.
submit rsconn01 with mode = 'INT'
with output = ' '
and return.
Regards,
Neela
‎2010 Mar 30 2:20 PM
To avoid manual interaction to finally release the email in SOST a periodically job needs to be stup by yoiur basis team releasing the email. Contact your basic guys if this job is scheduled on a regular basis and ask them for the period this job is running. We are running this job every 5 minutes, so we have to wait 2,2 min in average until the mail is released and sent.
‎2010 Mar 31 10:20 AM
Dear all,
I solved the issue after going through this link..It has a very useful demonstrated program.
http://www.sapdev.co.uk/reporting/email/attach_xlsmod.htm
Thanks for all responses
Regards
Ajay