Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to send the mail to multiple recepients

Former Member
0 Kudos

Hi experts,

I am working on sending mail to more than one recepients in one of our requirement.

I am using function module so_document_send_api1.

In the tables parameter i am doing like this

LOOP AT itab_email INTO wa_email.

t_receivers-receiver = wa_email-zusermail.

t_receivers-rec_type = 'U'.

t_receivers-com_type = 'INT'.

t_receivers-notif_del = 'X'.

t_receivers-notif_ndel = 'X'.

APPEND t_receivers.

ENDLOOP.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = w_doc_data

put_in_outbox = 'X'

sender_address = ld_sender_address

sender_address_type = ld_sender_address_type

commit_work = 'X'

IMPORTING

sent_to_all = w_sent_all

TABLES

packing_list = t_packing_list

contents_bin = t_attachment

contents_txt = it_message

receivers = t_receivers ( It has 2 recepients )

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.

COMMIT WORK.

Do i need to do any other settings.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi guys,

Thanks alot.

Actually i didnt add my mail id in SCOT .So i felt like it is not needed for every one else. Now i could send to multiple recepients.

Thanks Karuna and others.

I am getting one problem here.

I am not able to get the filename.

I have given filename in packaging_list-obj_nam.

Any inputs

8 REPLIES 8

Former Member
0 Kudos

Hi,

Please refer the bellow for your requirement.

http://www.sapnet.ru/viewtopic.php?t=3126

And also there are some settings need to be done from BASIS team for the recepients user ids the mail can be received to destination.

Regards,

Goutam Kolluru.

Former Member
0 Kudos

Hi,

Also pass the field t_receivers-express = 'X'.

It will work.

Regards,

Karuna N

Former Member
0 Kudos

Hi,

Also pass t_receivers-express = 'X'.

and the t_receivers-COM_TYPE = space. "means dont pass any thing to this field if you want send mail through SAP office internal.

please check the values allowed for COM_TYPE field.It should be space for email.

It will work.

ask your basis person to maintain the settings(port and host IP) and the recipient mail ids also have to be maintained in 'scot'.

If they dont maintain also not a problem.The system wont allow the mails go out of the system but you can check in SOST Tcode.

Regards,

Karuna

chundru_ravindra
Participant
0 Kudos

Hi Ravi,

use this Link: http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage it will help u

Regards,

Ravindra.

Former Member
0 Kudos

Hi guys,

Thanks alot.

Actually i didnt add my mail id in SCOT .So i felt like it is not needed for every one else. Now i could send to multiple recepients.

Thanks Karuna and others.

I am getting one problem here.

I am not able to get the filename.

I have given filename in packaging_list-obj_nam.

Any inputs

0 Kudos

Hi,

If the attachement has been sent successfully then in SOST you can see the attached file...select the mail and then click on display.there you can find the attached file.

If it failed to attach the file then check your code with below.


DESCRIBE TABLE it_message LINES len.
  p_item-body_start = 1.
  p_item-body_num = len.
  p_item-doc_type = 'RAW'.
  APPEND p_item TO packing_list.

  DESCRIBE TABLE it_attach LINES len.
  p_item-transf_bin = 'X'.
  p_item-head_num   = 1.
  p_item-head_start = 1.
  p_item-body_start = 1.
  p_item-body_num = len.
  p_item-doc_type   =  'XLS'.
  p_item-obj_descr  =  'Employee attendance details'.
  p_item-obj_name   =  'Emp details'.
  p_item-doc_size   =  len * 255.
  APPEND p_item TO packing_list.

Former Member
0 Kudos

Solved the problem.

used different function module so_new_document_att_send_api1

For file obj_head = 'Required fiilename '

Thanks all for the help

Former Member
0 Kudos

Hi,

*-- Set sender

l_sender = cl_sapuser_bcs=>create( sy-uname ).

CALL METHOD l_send_request->set_sender

EXPORTING

i_sender = l_sender.

gs_mail-e_mail = 'Mail ID1'.

APPEND gs_mail TO gt_mail.

CLEAR gs_mail.

gs_mail-e_mail = 'mail ID2'.

APPEND gs_mail TO gt_mail.

CLEAR gs_mail.

gs_mail-e_mail = 'mail ID3'.

APPEND gs_mail TO gt_mail.

CLEAR gs_mail.

loop at gt_mail into gs_mail.

try.

l_recipient = cl_cam_address_bcs=>create_internet_address(

gs_mail-e_mail ).

catch cx_address_bcs.

endtry.

CALL METHOD l_send_request->add_recipient

EXPORTING

i_recipient = l_recipient

  • i_express = 'X'

i_copy = 'X'.

endloop.

*-- Send Email

CALL METHOD l_send_request->send(

EXPORTING

i_with_error_screen = 'X'

RECEIVING

result = l_result ).

CATCH cx_bcs INTO l_bcs_exception.

ENDTRY.

COMMIT WORK.

Thanks

Shabareesh

Edited by: palluruu on Feb 10, 2012 1:42 PM