Once again searching for a solution for a generic solution in the SAP Standard paid off. I’ve got the business requirement that two existing Service Requests (SR, CRM Object Type BUS2000223) had to be merged. When they are merged, then the leading SR should get a new status and the duplicate should get the status “Cancelled”. Using my trusted Google Custom Search- SAP Community Network Search I found the SAP Standard documentation Deduplication of Leads. I followed the description and was able to to get the merge of Leads working in our CRM sandbox system.

For a quick test possibility I’ve created an report and used the coding from method EH_ONMERGE_SEL of class CL_BT108S_L_RESULT_IMPL to replicate the call of the BOL method mergeDuplicateDocument. That way I could already test the merge of SR’s without the need to make adjustments in the WebUI.

The first issue to get around was the customizing view CRMV_ORDER_DEDUP. It restricts the possible transaction types to leads. As I didn’t take the time to investigate further I’ve simply created my own maintenance view for the table CRMC_ORDER_DEDUP.

Then I investigated the Package CRM_ORDER_DEDUP with the implementation to merge Leads (CRM Object Type BUS2000108). But my first attempt to use a custom class as a subclass of CL_CRM_DEDUP_MERGE_LEAD_IMPL failed. I’ve got a dump in the area of the document flow. Then I’ve reached out to other CRM Experts via Twitter:

Luckily Andrei Vishnevsky replied:

I’ve exchanged my investigations with him via E-Mail and he provided a lot of valuable information. So I’ve created first an interface IF_CRM_DEDUP_MERGE_BUS2000223 (of course with a SSCR-Key needed) and added the instance methods MERGE_STATUS and MERGE_HEADER. For the needed parameters I took the information from the interface IF_CRM_DEDUP_MERGE_BUS2000108. Based on that I’ve implemented my own merge class with the super class CL_CRM_DEDUP_MERGE. Here it would be great if SAP could provide an implementation of the abstract class CL_CRM_DEDUP_MERGE that could be re-used for other objects. In the moment I had to re-implement the constructor in my class as a copy from CL_CRM_DEDUP_MERGE_LEAD. The rest was straight forward and I’ve implemented the methods MERGE_STATUS and MERGE_HEADER according to the business requirements.

But the execution of my test report still failed with a dump. Via debugging I’ve found that there where missing entries for SR Object Type BUS2000223 in the customizing view MVOBLRO. So I  took the entries for the Lead:

Role Type Object Type Repository
CRM_DEDUP BUS2000108 BO
CRM_PRIME BUS2000108 BO

and create similar ones for the Service Request:

Role Type Object Type Repository
CRM_DEDUP BUS2000223 BO
CRM_PRIME BUS2000223 BO

After that adjustment the call of BOL method mergeDuplicateDocument went through smoothly.

Do you have a similar requirement? Should SAP perhaps provide support for merge in additional CRM Object Types? Let me know via the comments.

To report this post you need to login first.

1 Comment

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

  1. Andrey Vishnevskiy

    Just want to add few points to Gregor’s post.

    1. Customizing in IMG is restricted using FM CRM_DEDUP_CLASS_CHECK (which is called from form crmv_dedup_entry_check_add include LCRM_DEDUP_CDF01). It checks that any maintained class has an implementation of interface with “pattern” name IF_CRM_DEDUP_<SEARCH/MERGE/PRPMRG>_<business_object_type> accordingly. As far as there are only

    IF_CRM_DEDUP_MERGE_BUS2000108

    IF_CRM_DEDUP_PRPMRG_BUS2000108

    IF_CRM_DEDUP_SEARCH_BUS2000108

    exist in the standard system the way to maintain the customizing is just create an own maintenance view. Or create appropriate interfaces for other business object type as Gregor did.

    2. If the one doesn’t want to create interfaces for other business object types using SSCR-keys the way around is to do all needed steps in methods of IF_CRM_DEDUP_MERGE, IF_CRM_DEDUP_SEARCH, IF_CRM_DEDUP_PRPMRG interfaces accordingly.

    3. The data which can be maintained during deduplication can be seen in CL_CRM_DEDUP_MAINTAIN->SET_MAINTAIN_ORDER.

    4. During check before save event standard deduplication search and merge functionality called in FM CRM_ORDER_CHECK_BEFORE_SAVE_OW. See the call of cl_crm_dedup_order_integration=>check_before_save there. Inside it uses scenario type 0 (search + merge).

    It would be great to have an ability to use this functionality for any type of business object. Personally I’ve needed to implement to complete the same requirement for complaints.

    Thank you, Gregor, for the post!

    (0) 

Leave a Reply