Skip to Content
0
Former Member
Jul 11, 2007 at 08:12 AM

help to send mail more then one person

16 Views

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.