Symptom
Your requirement is to export the Competitor Products using Data Workbench. Upon trying the Data Workbench Export for the object Competitor Product, able to see that the Total Records are different from the number of records available in Competitor Products view in Competitors workcenter.
Environment
SAP Hybris Cloud for Customer
Reproducing the Issue
To see the available Competitor Products
- Go to Competitors work center
- Go to Competitor Products view
- Show All
- There are X records in the OWL
To export the Competitor Products using Data Workbench
- Login to the HTML5 client
- Go to Data Workbench workcenter
- Go to Export tab
- In the Search field, select the object Competitor Product
- Select Data
- Select field
- Select Next
- Export Data
- Go to the Monitor tab
- Check for the relevant Task and download the exported file
- There are Y records
Cause
When the query to Select All the Competitor Products is executed using the Competitor Products work center, the below parameters are passed in the backend.
(attribute name) (sign) (option) (low)
COMPETITOR_PRODUCT_IND I EQ X
LIFE_CYCLE_STATUS_CODE I EQ 2
This call fetches X records.
Consider the scenario where the OData call is executed as below:
https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/competitorproduct/CompetitorProductCollection/$count
The parameters passed in the backend are:
(attribute name) (sign) (option) (low)
COMPETITOR_PRODUCT_IND I EQ X
COMPETITOR_MAIN_IND I EQ X
PRODUCT_MAIN_IND I EQ X
This call fetches only Y records.
The values for the above parameters are set at the CompetitorProduct entity level, in the CompetitorProduct OData service, and the above parameters are also hidden in the metadata of this OData service.
This is because the backend Business Object structure and the UI models were not same. Hence these two (COMPETITOR_MAIN_IND and PRODUCT_MAIN_IND) additional parameters are needed. Therefore, it cannot be removed from standard service. Hence, the difference in count is expected.
Resolution
You can use Custom Odata Service for querying Competitor Products and the standard service for other purpose.
You can create a Custom Odata Service same as standard one where you can remove the default value for this two parameters (COMPETITOR_MAIN_IND and PRODUCT_MAIN_IND).
To create Custom OData Service for Competitor Products you may follow the below steps:
- Go to Administrator work center
- Go to OData Service Explorer view
- Show Custom OData Services
- Select New to create Custom Odata Service
- Select Data Workbench enabled (optional)
- Edit the Custom OData Service
- Select the required BO (Material) under Select Business Object
- Select the Root node and expand the Root to select CompetitorInformation
- Save
- Activate
Keywords
CompetitorProduct, Competitor Products, Competitor Information, CompetitorInformation , KBA , competitor products , competitor information , competitorproduct , LOD-LE-PRD-PRD , Product + Product Category Hierarchy , Problem