Wednesday, January 2, 2013

SAP CRM Client Groupware enhancements

What if you are using client groupware integration and you would like to enhance the functionality, for instance because SAP's logic does not match your business requirements.

Let's say as an example, you disagree that deleting a contact from outlook should mean that the contact should be archived in SAP CRM. After all, users might be deleting a contact in outlook because this particular contact is of no interest for them, but this does not necessarily mean that the contact is of no interest for your SAP CRM system.



In the client groupware context, there are several badi's available:

For our example, we would be implementing CRM_GWI_CONTACT_REQUEST~DELETE_CONTACT_REQ.

This BADI allows us to raise an error message (using CT_RETURN) in case a contact should not be deleted. Additional checks can be programmed here, for instance on the type of contact or the origin.

Typical abap to raise the message would be:
datals_return type bapiret2.

  CLEAR ls_return.
  ls_return-TYPE 'E'.
  ls_return-ID 'CRM_XML_GW_SYNC'.
  ls_return-NUMBER 018.
  APPEND ls_return TO ct_return.

The existence of an error message is checked in the following code, and the contact is not archived.
Raising an error message does result in showing an error message to the user, which in this case might not be required.
Furthermore, everytime the user synchronises, the synchronisation process will find that there is a difference between outlook and SAP, and the deletion of the contact from SAP CRM will be proposed, and the error message of the failed deletion of the contact will be shown.


Using a the subclass of CL_CRM_XML_GW_SYNC.

The handling of the synchronisation process is done using a webservice, which can be viewed in SICF node

In this node, you will find that the handlerlist contains a class called CL_CRM_XML_GW_SYNC.

If we create a subclass in SE80 (i.e. ZCL_CRM_XML_GW_SYNC), and enter this in the handlerlist instead of the standard class, this will enable us to redefine methods in the handling of the synchronisation process. We should then be able to for instance have SAP do 'nothing' when a contact has been deleted from outlook (without bothering the user with error messages), or maybe even add the entry to the exception list, so that outlook will not try to close the difference between the 2 systems.