09-09-2015 1:13 PM
Hi,
I was using old methods like : SO_NEW_DOCUMENT_ATT_SEND_API1, but i can not set mail receivers sequence list.It always sending with alphabetically..
Now i want to use this CL_BCS to sent new mail according to :
http://scn.sap.com/docs/DOC-33937
Is this sending method will work backgorund?I mean this will not trigger by user, that will work background.
Thank you.
09-09-2015 1:33 PM
Hi.
Yes it will work. Procedure is quite like this:
f_send_request = cl_bcs=>create_persistent( ).
prepare your mail:
f_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = f_test_mail_text[]
i_length = f_length
i_subject = f_test_mail_subj ). "#EC NOTEXT
* Add any attachment
CALL METHOD cl_bcs_convert=>xstring_TO_SOLIX
EXPORTING
iv_xstring = BINFILE
RECEIVING
et_solix = ft_content_pdf.
CLEAR f_objdes.
f_objdes = f_filename.
f_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = f_objdes
i_att_content_hex = ft_content_pdf ). "ALG_PDF_TAB ).
* Add attachment to your request
* Add document object to send request
f_send_request->set_document( f_document ).
* Create recipient mail address
f_recipient = cl_cam_address_bcs=>create_internet_address( tb_email-SMTP_ADDR ).
CHECK sy-subrc EQ 0.
* Add recipient object to send request
f_send_request->add_recipient( f_recipient ).
CHECK sy-subrc EQ 0.
* Set sender mail-name
f_sender = cl_sapuser_bcs=>create( f_mailname ).
"Add sender to send request
CALL METHOD f_send_request->set_sender
EXPORTING
i_sender = f_sender.
* Send mail
f_sent_to_all = f_send_request->send( i_with_error_screen = 'X' ).
IF sy-subrc NE 0.
RAISE NO_MAIL.
ENDIF.
commit work and wait.
Hope to help
Bye
09-09-2015 2:01 PM
Hi,
Tahnks for your reply,
Should i sent i_with_error_screen with X or '' ?I will not be taking any steps if mail will not sent.
09-09-2015 2:07 PM
Hi,
I_WITH_ERROR_SCREEN (optional) Indicator denoting whether the send log book is to be returned in the event of an error.
So it's only a way to manage any send errors. This will not show you nothing.
So for your need you can avoid it.
09-09-2015 2:25 PM
09-09-2015 1:37 PM