Skip to Content

Introduction

In the context of a customer project we recently implemented ERMS in SAP CRM (E-Mail Response Management System – SAP Library) for the handling of inbound customer emails. An nice collection of links to documentation, best practices and OSS notes related to ERMS is available in the blog´ERMS Configuration Guides and Documentation by John Burton.

In the context of our project we faced the challenge, that not all customer emails could directly be routed to the SAP CRM system. Instead, some customer email would arrive e.g. in the private email inboxes of customer agents or general purpose inboxes. Therefore, the requirement was to being able to manually select and forward emails from those inboxes to the CRM system. However, the problem with forwarding of emails is that the information in the email header regarding sender and receiver is changed. Consequently, it is not possible to e.g. send automatic responses to the original sender of the email.

In this blog I’ll share how we solved the scenario mentioned above. In particular the described approach shows what is possible with inbound email handling in

Solution Approach

The first thing I did was to ask on twitter if someone ever solved a similar problem. In the cause of this discussion Gregor Wolf gave me the hint that it might be possible to implement something in the inbound email handling to solve our requirement. He also warned me, that it also might be quite difficult. Unfortunately, there is not much documentation available regarding inbound email processing besides the following to articles:

Nevertheless, it is enough information so I could come up with an initial solution approach. The solution approach consists of the following steps:

  1. Instead of simply forwarding emails to the CRM system, the initial email is forwarded as an attachment. The advantage of this approach is that the original email will be available as a MIME object in the email and therefore the original sender information is still available. Furthermore, email clients can be configured to always forward emails as attachments.
  2. In the inbound email processing the following steps are executed:
    • check if the email is sent from a list of defined email addresses (basically the list of email inboxes from which forwarding is allowed)
    • check if it contains an attachment of type email
    • If this is the case stop the processing of the current email and continue the inbound processing with the attached email.

Solution

While the solutions approach looks quite simple it took a significant amount of debugging and trail and error to get it finally working. The code snippet below (also available here: #10770844 – Pastie) shows the implementation of the interface IF_INBOUND_EXIT_BCS( for detailed configuration instructions see the article by Thomas Jung mentioned above):

2016-03-23 09_43_17-ABAP - CVQ_100_drumm_de_.adt_classlib_classes_zc_crm_cl_email_inbound_zc_crm_cl_.png

Lines 34-40 check if the email was sent from one of the defined email inboxes. If yes, lines 42-49 check if there is an email MIME object attached to the inbound email. If one is found it is converted into a new inbound send request (lines 50-58), the new inbound send request is processed (lines 65 and 66) and the original inbound request is terminated (line 68). If anything goes wrong, the system simply continues with the standard inbound processing (line 72 ff).

With this implementation in place the inbound processing in transaction SCOT shows how emails a processed (cf. screenshot below). First a email from c.drumm@… is send to test-crm@…, the CRM inbound mailbox. This email contains an email as an attachment. Therefore, the processing of the initial inbound request is terminated (no internal recipient) and new inbound send request is created. The new inbound send request is created for the original sender christian.dr…@… and the original recipient c.drumm@…

2016-03-23 09_52_08-ABAP - CVQ_100_drumm_de - Eclipse.png

I hope this blog helps anybody trying to implement advances inbound email handling in CRM.

Christian

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Gregor Wolf

    Hi Christian,

    great that you’ve shared this with the SCN community. For robustness I would do a TRANSLATE TO UPPERCASE for the from address. You never now what external systems send you.

    CU

    Gregor

    (0) 
  2. John Burton

    Hi Christian,

    Very cool stuff! Thanks for sharing with everyone! I updated my ERMS Configuration Guides and Documentation article with a reference to your post above as well.

    Regards,

    John

    (0) 

Leave a Reply