04-19-2008 6:31 AM
hi gurus
can any one suggest me
how to get a mail after background job is over
either report or bdc job
if job is not completed the queries should come to mail
how to solve this issue.
thank you
regards
kals.
04-19-2008 6:52 AM
this code works for all the succesfull jobs in background:
data: list type table of abaplist with header line.
data: htmllines type table of w3html with header line.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
* Produce a list
do 100 times.
write:/ sy-index, at 30 sy-index, at 50 sy-index.
enddo.
* Save the list
call function 'SAVE_LIST'
tables
listobject = list
exceptions
list_index_invalid = 1
others = 2.
* Convert the list
call function 'WWW_LIST_TO_HTML'
tables
html = htmllines.
* Send mail
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = 'you at yourcompany.com'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
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.