2009 Aug 10 8:34 AM
Hi,
Can you tell me which are all the function module available for sending mails to a distribution list.
Ezhil.
Hi,
Can you tell me which are all the function module available for sending mails to a distribution list.
Ezhil.
2009 Aug 10 8:37 AM
Hi ,
You can use the following FM
SO_NEW_DOCUMENT_ATT_SEND_API1
2009 Aug 10 8:38 AM
Hi Ezhil,
Below are the FM to send email.
SO_NEW_DOCUMENT_ATT_SEND_API1 - Send with attachment
SO_NEW_DOCUMENT_SEND_API1-
Regards,
Rahul
2009 Aug 10 8:39 AM
Hello Ezhil,
You can use the same FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send emails to Distr. Lists.
In the tables RECEIVERS (structure SOMLRECI1), you have the field REC_TYPE (recipient type) here you have to pass either P (Private distribution list) or C (Shared distribution list).
Hope this helps.
BR,
Suhas
2009 Aug 10 8:44 AM
Hi,
you can use the function module "SO_OBJECT_SEND" which is used for sending mails in SAP system.
Regards,
Pavan.
2009 Aug 10 8:50 AM
Hi,
Create a Distribution list using SO23 and add Users whom to recieve messages.
Use below function module to send the mail.
SO_NEW_DOCUMENT_SEND_API1
Or..
call the function to create the object in the outbox of the sender
SO_OBJECT_INSERT
call the function to send the already created email to the receivers
SO_OBJECT_SEND
Thanks,
2009 Aug 10 9:00 AM
Hi Ezhilhrh,
You can refer to the below code too
http://www.sapdev.co.uk/reporting/email/email_mbody.htm
Thanks
Alis
2009 Aug 10 9:25 AM
I would like to prefer the class CL_BCS to send an email. See reports BCS_EXAMPLE_* in your SAP for demonstration.
Regards,
Florian
2009 Aug 10 9:58 AM
Hi,
Here are some FM :
SO_NEW_DOCUMENT_SEND_API1
sap_new_document_send_api1(send document)
sap_new_document_att_send_api1(send with attachments) .
This is a small program which is used for sending mail.
data : maildata type SODOCCHGI1.
data : mailtxt type table of SOLISTI1 with header line.
data : mailrec type table of SOMLRECI1 with header line.
start-of-selection.
clear : maildata,
mailtxt,
mailrec.
refresh:mailtxt,
mailrec.
maildata-obj_name = 'Test'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test mail'.
append mailtxt.
mailrec-receiver = 'any mailid'
mailrec-rec_type = 'U'.
append mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = maildata
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = ' '
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
tables
OBJECT_HEADER = mailtxt
OBJECT_CONTENT = mailtxt
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = mailrec
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope this will work.
Regards,
Dhanalakshmi L
2009 Aug 10 10:07 AM
REPORT ztest_mail.
DATA:
LS_RECEIVERS TYPE SOMLRECI1.
*----------------------------------------------------------------------*
* Structure to hold the email description (subject). *
*----------------------------------------------------------------------*
DATA:
LS_MAIL_DATA TYPE SODOCCHGI1.
*----------------------------------------------------------------------*
* Structure to hold the content of email body. *
*----------------------------------------------------------------------*
DATA:
LS_CONTENT TYPE SOLISTI1.
* Internal table declarations...........................................
*----------------------------------------------------------------------*
* Internal table to hold the list of email recepients. *
*----------------------------------------------------------------------*
DATA:
LT_RECEIVERS TYPE STANDARD TABLE
OF SOMLRECI1
INITIAL SIZE 0.
PARAMETER:
P_RECVR TYPE SOMLRECI1-RECEIVER .
DATA:
lt_content TYPE STANDARD TABLE
OF solisti1
INITIAL SIZE 0.
ls_mail_data-obj_descr = text-sub.
ls_mail_data-obj_name = text-des.
ls_receivers-receiver = p_recvr.
ls_receivers-rec_type = 'U'.
APPEND ls_receivers TO lt_receivers.
CLEAR ls_receivers.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_mail_data
document_type = 'RAW'
commit_work = 'X'
TABLES
object_content = lt_content
receivers = lt_receivers
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 NE 0.
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF SY-SUBRC NE 0
2009 Aug 10 10:24 AM
2009 Aug 10 11:29 AM