I would like to share my experience with issues faced while triggering personalized emails. We have an option to trigger personalized mails configured in web, these mail forms are not traditional SO10 text forms.
We have used 2 standard function modules to compose email body and to send email respectively CRM_ERMS_COMPOSE_MAIL and CRM_ERMS_MAIL_SEND.
We have used action profiles to trigger emails, while the transaction is saved system trigger the mail forms as emails.
We have got couple of dumps due to the CRM_ERMS_MAIL_SEND while saving the order,
1. Address does not exist in system.
2. Document has been archived or deleted from the database.
3. Emails were not delivered from SOST but instead status was “Still no entry in Queue”.
4. We were facing dump in ECC system when we create PGI for sales order due to the email trigger.
Actually all these scenarios are looks very strange and can not expect issue are due to triggering personalized emails. I will explain the scenario when we face above error messages.
Address does not exist error message throws while saving the order first time and Document has been archived or deleted.
For example, If user trying to update any partner address fields like telephone number or postal code by means any change which creates a new address number in transaction document. As we have configured action to trigger email system will generate the email using the FM CRM_ERMS_MAIL_SEND.
Initially we have avoided the Address does not exist error by passing false value to IV_SEND_PML exporting parameter. So that system was not refreshing address number exist in buffer before commit to database. But later on we were facing the second error message “Document has been archived or deleted from the database after saving the document.
Emails were not delivered from SOST but instead status was “Still no entry in Queue”.
We were facing an issue email were not deliver status but we could see the email with status ‘Still no entry in Queue’ in some scenarios. I have searched in SCN and few threads talking about COMMIT WORK should be there after calling the send interface. Even though standard FM is having COMMIT WORK statement under after calling send interface still the emails were not delivered from SAP.
Dump in ECC system due to email trigger in CRM system
As per the client requirement we are sending email from CRM system once the delivery and PGI created for products in ECC system. There was dump from standard code and found the issue due to the email send system is performing commit work before completing the complete process of the order. I have understood that we should not use commit work statement in any of the action badi implementations. I have raised discussion for this issue recently,
Finally we have come with the concept of using RFC function module, we have bound the complete send function module inside a custom RFC enabled function module. We have called the RFC function module with destination ‘NONE’.
I thought of sharing these details because i have not find inputs when i looked for it.