SAP Knowledge Base Article - Public

2849046 - ODATA Filters not Available in Query Builder or Not Working

Symptom

You are trying to build an ODATA query using a filter on a certain characteristic. When you open the OData query builder, you cannot find your field in the filters to choose from. Alternatively, you may find the field but when you set the filter and run the query, you will get missing or wrong results.

Environment

  • SAP - C4C Cloud For Customer
  • SAP - BusinessByDesign

Reproducing the Issue

  1. Go to the Business Analytics work center.
  2. Find the report you want to build an ODATA query on.
  3. Click Build OData Queries and go to the Filters tab.
  4. Here it may happen that your field is missing when you search for the description.
  5. Alternatively, you can set your field here, generate the query and then run it, but you will get wrong or missing results.

Cause

The field you are setting the filter on is a variable in the selection of your report. When a field is a variable, it has a different ID than a normal characteristic. In some cases, the variable in the selection is renamed, and has a different label compared to the report characteristic (an example would be the Key Date variable, which often corresponds to the Calendar Day characteristic).

Currently, the ODATA URL builder does not support variables. This means that when the Initial selection of your report has a variable and you try to overwrite it by passing a filter, this cannot work since the filter works with the characteristic ID, not the variable ID.

Resolution

This feature will be addressed in a future release.

However, you can manually add the variable to the URL and the data will be extracted:

  1. Open the OData query builder for your report.
  2. Click Generate Metadata Query.
  3. Run this query in a browser.
  4. Via Ctrl+F, search for the field you would like to filter on.
  5. Note down its technical ID. It will most likely begin with PARA_*.
  6. In your OData data query, replace your characteristic ID (which you would like to filter on) with the technical ID of the variable you found. 

Keywords

odata, build odata queries, parameter, variables, selection, filter not working, no results, missing data, business analytics , KBA , {"d":{"__count":"0","results":[]}} , {"d":{"results":[]}} , AP-RC-ANA , C4C, ByD, Travel: Analytics Tools & Frameworks , Product Enhancement

Product

SAP Business ByDesign all versions ; SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions