on 05-04-2007 12:37 PM
Hi Friends,
i have a table and a toolbar button (send) when i click on that button i have to send an email for the selected row from the table with an attachment. please let me know step by step in detail.
Thanks,
Mahesh.Gattu
done
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahesh,
I observed one thing that the mail was waiting in the system. In SCOT transaction we can see that the mail was waiting.
And also we need to add one more parameter to the function module call i.e. commit_work = 'X'
After adding this parameter also in my scenario the mail was in waiting state in SCOT transaction.
In Scot transaction, i have created a job sheduled for the INT, selected varient INT and set the peroid 1 min.
After performing this, the mail functionality was working in my application.
Sample code:
METHOD onactionsend_mail .
For API
DATA: ls_maildata TYPE sodocchgi1,
lt_mailtxt TYPE TABLE OF solisti1,
ls_mailtxt TYPE solisti1,
lt_mailrec TYPE TABLE OF somlrec90,
ls_mailrec TYPE somlrec90,
sent_to_all TYPE sonv-flag.
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
ls_maildata-obj_name = 'Test mail Subject'.
ls_maildata-obj_descr = 'Test mail Description'.
ls_maildata-obj_langu = sy-langu.
ls_mailtxt-line = 'Test mail Subject 2'.
APPEND ls_mailtxt TO lt_mailtxt.
CLEAR ls_mailtxt.
ls_mailtxt-line = 'Test mail Description 2 '.
APPEND ls_mailtxt TO lt_mailtxt.
ls_mailrec-receiver = 'email.id@abc.com'.
ls_mailrec-express = 'X'.
ls_mailrec-rec_type = 'U'.
APPEND ls_mailrec TO lt_mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_maildata
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
object_content = lt_mailtxt
receivers = lt_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.
ENDIF.
ENDMETHOD.
You can also refer the thread (regarding email was waiting) .
Best regards,
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suresh,
thanks for your answer but the program is not working... please help me
here is the code...
For API
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 again '.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test mail'.
append mailtxt.
mailrec-receiver = 'gattumahesh@yahoo.com'.
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.
else.
write:/ 'Message sent Sucess Fully to', mailrec.
endif.
Rgds,
Mahesh
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.