My code to send email does not work...
I am trying to send email to users after adding a new record. Now, it does not work properly. Below is the code I made. Please help me out on this guys. Again, thank you guys and have a nice day!
DATA: maildata TYPE sodocchgi1.
DATA: mailtxt TYPE TABLE OF solisti1 WITH HEADER LINE.
DATA: mailrec TYPE TABLE OF somlrec90 WITH HEADER LINE.
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'.
SELECT * FROM zshipto_email
INTO TABLE it_zshipto_email.
LOOP AT it_zshipto_email.
mailrec-receiver = it_zshipto_email-zemail.
mailrec-rec_type = 'U'.
delete mailrec where receiver is initial.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
Message was edited by: viraylab
Amit Mittal replied
1. For this u will have to take help
of basis team,
for proper settings of SCOT.
2. If u can see your email message
in scot (waiting for send)
then your code is working fine.
3. Only scot settings( which are done by basis team)
will need to be done/corrected.