2014 Jul 22 12:31 PM
Hello Experts,
I want to send email automatically through ABAP program. I can see those mails in SOST tcode. Everytime I used to execute mails manually in SOST & then they are delivered to respective recipient.
Is there any method that can send mails automatically without using SOST tcode ?
Thanks in advance,
Swanand
2014 Jul 22 12:35 PM
Searching on the net, I've found this piece of code that could help:.
DATA: send_request TYPE REF TO cl_bcs.
send_request = cl_bcs=>create_persistent( ).
... here goes your code.
* Set that you don't need a Return Status E-mail
DATA: status_mail TYPE bcs_stml.
status_mail = 'N'.
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = status_mail
i_status_mail = status_mail.
* set send immediately flag
send_request->set_send_immediately( 'X' ).
* Send document
CALL METHOD send_request->send( ).
2014 Jul 22 12:35 PM
Searching on the net, I've found this piece of code that could help:.
DATA: send_request TYPE REF TO cl_bcs.
send_request = cl_bcs=>create_persistent( ).
... here goes your code.
* Set that you don't need a Return Status E-mail
DATA: status_mail TYPE bcs_stml.
status_mail = 'N'.
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = status_mail
i_status_mail = status_mail.
* set send immediately flag
send_request->set_send_immediately( 'X' ).
* Send document
CALL METHOD send_request->send( ).
2014 Jul 22 12:43 PM
2014 Jul 22 12:47 PM
Hi ,
Pleas try to use RSCONN01 program as suggested by Dieter.
but make sure you need to send all SOST mail trigger either trigger form your program or some one else.
If any mail status is waiting in SOST then you can use above program. it will be clear all wait status for mail.
and you can set job schedule for this program.
Regards,
Prasenjit
2014 Jul 22 12:58 PM
2014 Jul 23 7:53 PM
Hi, You can try using the FM 'SO_NEW_DOCUMENT_SEND_API1', For example:
report ZSEND_MAIL .
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 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'.
append mailtxt.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
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.
I hope this helps you.
Regards.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |