Hi All
Am using the below code followed by a
submit rsconn01
with mode eq 'INT'
and return.
*// Adding a commit to "Trigger" the movement of mails.....
commit work.
But, in SCOT the mails are with the status 'Still not Entered in Queue' and they are not sent out....
Can anyone help me out fix this problem.
Regards
Raj
form send_email_to_employee tables p_it_receivers type somlreci1_t
using p_lf_barea type ben_area
p_lf_event type ben_event
p_lf_ltext type ben_evnttx
p_lf_emp type char1
p_innnn type prelp.
constants: gc_endda type endda value '99991231',
gc_x(1) type c value 'X'. "For X
data: it_objtxt type soli_tab with header line,
it_packing_list like sopcklsti1 occurs 0 with header line,
it_objhead like solisti1 occurs 0 with header line,
it_orec type string occurs 0 with header line,
it_objbin like solisti1 occurs 0 with header line.
data: gd_doc_data like sodocchgi1,
lf_sender type soextreci1-receiver,
lf_bdate(10) type c,
lf_edate(10) type c,
gd_sent_all(1) type c,
lf_tablines like sy-tabix.
data: lf_nachn type pad_nachn, "Last name
lf_vorna type pad_vorna, "First name
lf_midnm type pad_midnm. "Middle name
*// Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'(002).
*// Populate the Subject of the mail
gd_doc_data-obj_descr = 'Many Happy Returns of the day(001).
gd_doc_data-sensitivty = 'F'.
*// Describe/Build the body of the message
clear: it_objtxt, it_objtxt[].
*// Build the Body of the Email message
*//Set the Body background colour
it_objtxt-line = '<BODY bgcolor = "#E6E6FA">'.
append it_objtxt.
clear it_objtxt.
*//Set font color and its type
it_objtxt-line = '<FONT COLOR = "#191970" face="Veranda" size="4">' .
append it_objtxt.
clear it_objtxt.
concatenate '<p>' 'Happy Birthday ' lf_nachn lf_vorna </p>'
into it_objtxt-line separated by space.
append it_objtxt.
clear it_objtxt.
concatenate '<p>' '<b>' 'Human Resources Division'(020) '</b>' '</p>'
into it_objtxt-line separated by space.
append it_objtxt.
clear it_objtxt.
it_objtxt-line = '</FONT></BODY>'.
append it_objtxt.
clear it_objtxt.
describe table it_objtxt lines lf_tablines.
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-doc_size = ( lf_tablines - 1 ) * 255 + strlen( it_objtxt ).
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
it_packing_list-body_num = lf_tablines.
describe table it_objtxt lines it_packing_list-body_num.
it_packing_list-doc_type = 'HTM'(003).
append it_packing_list.
gd_doc_data-doc_size = ( lf_tablines - 1 ) * 255 + strlen( it_objtxt ).
*// Build the Subject of the Mail
it_objhead = 'Your Benefits Status Change Information'(001).
append it_objhead.
*// Set Sender mailID
lf_sender = <email address here>
*// Call the FM to post the message to SAPMAIL
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = gc_x
sender_address = lf_sender
sender_address_type = 'INT'
commit_work = gc_x
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
object_header = it_objhead
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = p_it_receivers
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.
endform. " SEND_EMAIL_TO_EMPLOYEE