‎2007 Sep 26 4:49 PM
Does anyone know how to send email to a distribution list using class ?
Below is code to send email to internet address recipient, but I want to send to a distribution list instead.
DATA: recipient TYPE REF TO if_recipient_bcs,
send_request TYPE REF TO cl_bcs.
recipient = cl_cam_address_bcs=>create_internet_address(
'xmy@zzz.com' ).
add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
WRITE 'Email successfully created and sent'.
ENDIF.
COMMIT WORK.
‎2007 Sep 27 5:28 AM
Hi,
Check this
*&---------------------------------------------------------------------*
* Form f_get_distributionList *
*&---------------------------------------------------------------------*
* For get users from distribution list *
*&---------------------------------------------------------------------*
form f_get_distribution_list.
data : v_flg1 type c.
refresh : i_selection_tab, i_return.
clear : i_selection_tab, i_return, wa_address, i_user.
if vshared eq 'X'.
v_flg1 = 'X'.
endif.
if not soid-objnam is initial.
call function 'SO_DLI_READ_API1'
exporting
dli_name = soid-objnam
shared_dli = 'X'
tables
dli_entries = i_distlist
exceptions
dli_not_exist = 1
operation_no_authorization = 2
parameter_error = 3
x_error = 4
others = 5.
if sy-subrc <> 0.
else.
loop at i_distlist.
if i_distlist-member_adr is initial.
move i_distlist-member_nam to i_user-bapibname.
call function 'BAPI_USER_GET_DETAIL'
exporting
username = i_user-bapibname
importing
address = wa_address
tables
return = i_return.
move wa_address-e_mail to wa_receiver-receiver.
append wa_receiver to i_receiver.
else.
move i_distlist-member_adr to wa_receiver-receiver.
append wa_receiver to i_receiver.
endif.
endloop.
endif.
endif.
endform. " F_get_distribution_list
a®
‎2007 Oct 04 6:51 PM
Thanks. It works. I can also use differenct class cl_distributionlist_bcs
recipient =
cl_distributionlist_bcs=>getu_persistent( i_dliname = dist_list
i_private = ' ').
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'
Now I have problem that how do I set the send date and time as a future date and time.
Thanks