12-13-2011 8:56 AM
Hi all,
Below is my requirement.
No of error messages = 200
No of warning messages = 250
No of information messages = 200
When i execute the program, it has to send a mail to xxxxxx, with the above 3 lines of information.
Please help me.
Regards,
Venkat
Moderator message : Spec dumping not allowed, search for available information, thread locked.
Edited by: Vinod Kumar on Dec 13, 2011 5:01 PM
12-13-2011 9:09 AM
You can use FM 'SO_NEW_DOCUMENT_SEND_API1' for same purpose,if u do not have attachments.If u have them,
use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
Regards,
AS
12-13-2011 9:12 AM
hi
use this FM to send mails from "so_new_document_att_send_api1"
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_TXT = OBJTXT
CONTENTS_HEX = OBJBIN
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
check tcode : SOST to check send messages.
12-13-2011 10:40 AM
12-13-2011 10:57 AM
Nothing to do in sost , but after sending you need to check format thats why I had given this tocde , like here it contains the sent mails .
if you want to send mail to group of pepole at a time you need to create distribution list .tcode will be so15 ,
if you the solution close the thread=> Again. Leave it to the OP.
Regards
Siva
Edited by: kishan P on Dec 13, 2011 10:56 PM
12-13-2011 9:23 AM
I have used this code many times and works very well,..
DATA lt_message TYPE bcsy_text.
DATA lv_mail_title TYPE so_obj_des.
DATA document TYPE REF TO cl_document_bcs.
DATA recipient TYPE REF TO if_recipient_bcs.
DATA send_request TYPE REF TO cl_bcs.
DATA sent_to_all TYPE os_boolean.
DATA bcs_execption TYPE REF TO cx_bcs.
DATA email_id TYPE ADR6-SMTP_ADDR
Create Email Message, and receipients....
send_request = cl_bcs=>create_persistent( ).
*Create Title
CONCATENATE 'Mail Subject' '-' 'xxx'
INTO lv_mail_title RESPECTING BLANKS.
*Create Message(EMAIL Body)
APPEND '<p>No of error messages = 200</p>' TO lt_message.
APPEND '<p>No of warning messages = 250</p>' TO lt_message.
APPEND '<p>No of information messages = 200</p>' TO lt_message.
APPEND '<br>' TO lt_message.
*Create Document
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = message_body
i_subject = subject ).
*Add Attachement(If Needed only)
document->add_attachment(..
...). "Check this method
*Add document to email
send_request->set_document( document ).
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = email_id ).
*add recipients to send request
send_request->add_recipient( i_recipient = recipient ).
sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
COMMIT WORK.
IF sent_to_all = 'X'.
MESSAGE s398(00) WITH 'Message Sent Succesfully'.
RETURN.
ENDIF.
You can also dynamically write the Email Message Body... Just inside the loop ... append the message table...