The steps to implement the solution are:
1. Create the distribution list
2. Use the distribution list wherever required
The
below screenshots briefly show how to create distribution list.
Additional information on this is available at multiple places SCN and
SAP help.
Use transaction SO23 / SBWP=> Distribution List to create a distribution list.
Add recipients. Many options are available for adding recipients.
Use the following code to send the email to a distribution list.
Assumptions:
All business users are maintained in the system with correct email addresses.
SCOT configuration is complete and set up to send emails.
1. Create the distribution list
2. Use the distribution list wherever required
- **********************************************************************
- * FORM : send_notification
- *********************************************************************
- FORM send_notification .
- DATA: wa_maildata TYPE sodocchgi1,
- it_reclist TYPE TABLE OF somlreci1,
- wa_reclist TYPE somlreci1.
- wa_maildata-obj_name = 'TESTOBJ'.
- wa_maildata-obj_descr = text-030.
- wa_maildata-sensitivty = 'P'.
- wa_reclist-receiver = 'ZNR_I0001'.
- wa_reclist-rec_type = 'C'.
- APPEND wa_reclist TO it_reclist.
- CLEAR wa_reclist.
- wa_mailtxt = 'Do not reply to this system generated email'(032).
- append wa_mailtxt to it_mailtxt.
- CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
- EXPORTING
- document_data = wa_maildata
- document_type = 'RAW'
- put_in_outbox = 'X'
- commit_work = 'X'
- TABLES
- object_content = it_mailtxt
- receivers = it_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.
- sy-subrc = 0.
- ENDIF.
- ENDFORM. "send_notification
All business users are maintained in the system with correct email addresses.
SCOT configuration is complete and set up to send emails.
No comments:
Post a Comment