You created a custom odata service using the standard Business Object (BO) Customer and with that you also created an import function with the action CheckForDuplicates. However, as a result of calling the function in the odata query https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/service_XYZ/CustomerCheckForDuplicates1?ObjectID=’YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY’, you received only the message below:
17 potential duplicates found for business partner ZZZZZZ (ABC) ABC
(XXXXXX represents the tenant number / service_XYZ represents the name of the custom odata service / YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY represents the Object ID / ZZZZZZ represents the Business Partner ID, ABC represents the name of the Business Partner)
- SAP Hybris Cloud for Customer.
Reproducing the Issue
Go to the Administrator work center, in the OData Services Explorer view.
Select the filter to show Custom OData Services.
Click on New, to create a new service.
Set a name for your service and open it.
Select the Customer BO.
Click on the Import Functions tab.
Add a new line and select the Function Import Type as ACTION.
Select the Entity Name (e.g. Customer).
Select the HTTP Method GET.
Select the BO Action/Query CheckForDuplicates.
Save and activate.
Call the function and see the result message.
The OData framework currently supports two function import types:
- ACTION: This one performs an operation on one or more instances. It does not have any exporting/returning parameters.
- QUERY: This one returns data by using an existing query at a business object.
So this approach fails for two reasons:
- You are using a function import of type ACTION. That one, by design, cannot return data.
- The action CheckForDuplicates at the Customer BO is designed for a very specific UI scenario and is not consumable by an OData service the same way it is in UI.
Trying to implement a function import of type QUERY likely will not yield the required results, either.
The biggest obstacle being that a query has to be called in a very specific 'configuration' for it to work like a duplicate check and not just a regular exact match query. In particular the caller has to provide field weights and etc. Currently the OData framework does not support such requirements. The existing OData function imports CheckForDuplicates (Contacts) and CheckForDuplicateIndividualCustomers (Individual Customers), therefore, rely on extensive exit coding to work properly.
function imports, custom odata service, checkforduplicates, customer check for duplicates , KBA , LOD-LE-BP-BP , Business Partner , How To