‎2009 Apr 01 5:12 AM
Hi All,
I have a requirement in which I need to send a mail and then update a database table.
Sending mail and table update should work as one transaction i.e should be consistent.
I need your inputs to implement the above.As per my understanding :
CASE I : Send mail and then update database.
ISSUE : If database table is not updated, a 'ROLLBACK WORK' is called but mail cannot be reterived.
CASE 2 :Update database and then send mail.
ISSUE : IF database update is successful but mail sending failed??
Thanks in advance.
‎2009 Apr 01 5:16 AM
why do you think database will not update? update or insert statement should help u
‎2009 Apr 01 5:18 AM
‎2009 Apr 01 5:19 AM
Hi its very simple.
you have to regist your subroutine with on commit addition .
for your case1.
perform send_mail on commit.
perform update_table.
*--here you have to evaluvate sy-subrc of database update .
if sy-subrc = 0.
*here you are sending mail if update has beeen sucess or trigger error what every you need.
commit work.
endif.
Regards,
Peranandam
‎2009 Apr 01 5:45 AM
What if mail sending fails??
Database is updated and mail sending fails, This is also not desired.
‎2009 Apr 01 2:46 PM
Hi,
in my point of view if you coded properly for sending mail by considering all the failiure factor then there is no problem.
or
If mail sending fails, revert back all the changes you have updated in the table and display error log.
Regards,
Peranandam