SAP CRM Email Response Management System (ERMS) is a very important and powerful component. It combines SAP Connect, Workflow and the Rule Modeler to automate incoming email handling.
Since the whole functionality happens in background, it make it pretty difficult to do troubleshooting.
SAP offers a logging report (transaction CRM_ERMS_LOGGING) which provides the Factbase (xml form of the data used the process), the rule steps executed as well as the exception if the rule class returns it. However, this won’t be sufficient if we want to figure out why certain logic in the rule class doesn’twork.
If you are implementing your own ERMS service with custom service class, you can put the following endless loop login in the EXECUTE method.
IF NOT x IS INITIAL.
When the service gets invoked, it will simple just run in endless loop. You will be able to see the process in SM50. Select the process, under the menu Program/Session > Program > Debugging and the debugger will launch and stop at the loop. Just replace the x with a value and you can debug the rest of your code.
Similar technique can be used to debug standard ERMS service. To do this, in the configuration path SPRO > E-mail Response Management System > Define Repository, select the Context ERMS. Under the Context Properties folder, enter the following entry
Property Name: DEBUG, Value: X
When ERMS get invoke, an endless loop will get executed in the class method CL_CRM_ERMS_SERVICE_MANAGER->EXECUTE.
If you also want to debug agent routing, you can also add the following entry
Property Name: DEBUG_R, Value: “X”
The endless loop will get executed in the Function Module CRM_ERMS_AGENT_DETERM1.
From then on, you can go to SM50, bring up the debugger, set you desired break points, replace the variable VAR = ‘X’ and continue from there.
Just bear in mind that, you have to set the two context properties in the context “ERMS” and not anywhere else.