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: 

help to send mail more then one person

Former Member
0 Kudos

Hallow

here I send maail to one person and ts working o.k. but the problem is when I wont to send To more then one person how can I do that?

send_request = cl_bcs=>create_persistent( ).

  • -------- Create And Set Document ( Mail Text)----------------

CONCATENATE text-003 wa_emp_tab-werks text-004 wa_emp_tab-btrtl

INTO p_line1 SEPARATED BY space.

APPEND p_line1 TO text.

p_line1 = text-013 .

APPEND p_line1 TO text.

p_line1 = '----


'.

APPEND p_line1 TO text.

LOOP AT descreption_tab INTO wa_descreption_tab.

CONCATENATE text-006 wa_descreption_tab-out_hagbla wa_descreption_tab-text_hagbla ' '

text-007 wa_descreption_tab-out_rama wa_descreption_tab-text_description

INTO p_line1 SEPARATED BY space.

APPEND p_line1 TO text.

ENDLOOP.

p_line1 = '----


'.

APPEND p_line1 TO text. "Text of mail table

<b> SELECT value

FROM yhr_parameters " Adress Table

INTO TABLE wa_mail_addr

WHERE title = 'YHR'

AND subtitle = 'MU'

AND name = 'SEND_MAIL'.</b>

document = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = text

i_length = '12'

i_subject = text-010 ). "Header Of Mail

  • Add document to send request

CALL METHOD send_request->set_document( document ).

  • Set sender

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

CALL METHOD send_request->set_sender

EXPORTING

i_sender = sender.

  • Add recipient (e-mail address)

recipient = cl_cam_address_bcs=>create_internet_address( wa_mail_addr ).

  • Add recipient with its respective attributes to send request

CALL METHOD send_request->add_recipient

EXPORTING

i_recipient = recipient

i_express = 'X'.

  • Send document

CALL METHOD send_request->send(

EXPORTING

i_with_error_screen = 'X'

RECEIVING

result = sent_to_all ).

COMMIT WORK.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Declare the recipient as a table.

* Add recipient (e-mail address)
recipient = cl_cam_address_bcs=>create_internet_address( wa_mail_addr ).
Append recipient.

Loop at recipient.
* Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
Endloop.

Regards

Sudheer

4 REPLIES 4

Former Member
0 Kudos

Hi,

Declare the recipient as a table.

* Add recipient (e-mail address)
recipient = cl_cam_address_bcs=>create_internet_address( wa_mail_addr ).
Append recipient.

Loop at recipient.
* Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
Endloop.

Regards

Sudheer

0 Kudos

hi Sudheer

thankes for your answer

i have 2 qustion.

1)how i declere it (which table) recipient .

2) in the select below i get all time one adress from table and i try

to do this select to table and doing loop and in the first employee its work good

but in second i have dump(loop after select endloop after commit work)

maybe i have to concatente the adress to one field and send it one time?

like in outlook when u wont to send to more then one person

Regards

SELECT single

FROM yhr_parameters " Adress Table

INTO TABLE wa_mail_addr

WHERE title = 'YHR'

AND subtitle = 'MU'

AND name = 'SEND_MAIL'.

0 Kudos

hi Sudheer Junnuthula

im sorry but the orignal select is!

<b>SELECT single

FROM yhr_parameters " Adress Table

INTO wa_mail_addr "one adress at time

WHERE title = 'YHR'

AND subtitle = 'MU'

AND name = 'SEND_MAIL'.</b>

0 Kudos

hi Junnuthula

i try like u told but

i get eroor like that

"RECIPIENT" is neither specified under "TABLES" nor defined as an internal table.

regards