cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with BADI Check Duplicate

pablo_daniel
Participant
0 Kudos

Hi Expert. I am a facing a problem with a develop.

Basically, we need to filter the duplicate Customers and BP using the badi

This must be triggered when a Customer is created!.

The develops basically need to filter only the customers that has a percentage value higher to a custom percentage value (this value are defined in a BO).

In the next screen shot we can see the problem. This script es from CheckForDuplicateAccount, when a try to debug always the return is empty.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member226
Employee
Employee

Hi,

I think the code which you have implemented is incorrect. In your code, you have declared "result" at line 2 but then it (result variable) was never filled/assigned with any value before the second last line which try to remove the duplicates (using execute result.duplicates.remove**** ). In my opinion, even before this,second last, statement is executed the value of "result" is already blank.

Further instead of calling "remove" method of duplicate collection you have to prepare a collection of duplicate records found using "add" method, something like:

   	resultEntry.BusinessPartnerUUID.content
        resultEntry.SimilarityPercent = "90.85";
        result.Duplicates.Add(resultEntry);

I would strongly suggest checking the Badi documentation in Repository Explorer where they explained the same via sample code:

pablo_daniel
Participant
0 Kudos

Thanks for the reply, Now I understand that the BADI is used to fill an Account to the Duplicate list.

But there is a way to find the duplicates and check by Similarity percent that´s exists in the BO?

Thanks in advance!

former_member226
Employee
Employee
0 Kudos

Hi,

Yes. SAP does provide a standard action CheckForDuplicates which is PSM released as part of Customer BO. This action can be used to find potential duplicates with their similarity percent.

I used this action(CheckForDuplicates) as part of BeforeSave script to fill a custom field + logic. However, in my opinion, this should NOT be used with the BADI you were implementing since it might generate an endless loop, but validate it your self.