Overview and Details
Types
There are 2 types of OData Queries:
- OData (Easy) Query: based on standard BexQuery(OData flag in QueryDesigner)), see Example II or Steps to Create an ODATA service for a BW Query.
- OData CDS Query: based on ABAP CDS views with @Analytics.query: true(transient analytic query) and @OData.publish: true. See Example I.
The transient analytic query generation and the OData service generation is executed automatically, so one can use the service almost(apart from releasing the service in /IWFND/MAINT_SERVICE → package assignment) without additional manual steps.
Transactions
- /IWFND/GW_CLIENT - for testing the service
- /IWFND/MAINT_SERVICE - list of all released services
- /IWFND/APPS_LOG - SAP Gateway Application Log Viewer
- /IWFND/CACHE_CLEANUP - Cleanup of GW Model Cache
- /IWFND/CACHE_REBUILD - Rebuild Gateway Model Cache
- /IWFND/ERROR_LOG - SAP Gateway Error Log
- /IWFND/TRACES - SAP Gateway Tracing Tools
- /IWBEP/REG_SERVICE - Maintain Service
Most important URI parameters
Parameter | Description | Example |
---|---|---|
$metadata | get e.g. name of fields(infoobjects) and variables | Example III |
../AdditionalMetadata | get queryname, query definition timestamp, data refreshtimestamp | Example |
../QuerynameResults | resultset without variables for BEx Queries | Example II |
../viewname | resultset without view parameters for CDS based Queries | Example I |
../QuerynameResults?$inlinecount=allpages | resultset with linecount (number of rows returned by the query) | Example IV |
../Queryname(var1=value,var2=value,...)/Results | resultset with variables (single selection) |
|
../Queryname(var1=datetime'YYYY-MM-DDT00:00:00')/Results ../Queryname(var1=time'PT<hh>H<mm>M<ss>S')/Results | resultset with date / time variables |
|
../QuerynameResults?$select=char1,char2,keyf4... | reduced resultset output size via fieldselection |
|
../QuerynameResults?$filter=char1 eq 'value' | reduced resultset output size via filter |
|
$order_by=char desc/asc | sorting of values works similar to BW queries, see example | Example VIII(OData CDSquery) |
Important Points & Topics
- Bex Variables
- The technical names of the Bex variables need to be specified with capital letters, see ODATA query with variables.
- In case no variables at all are specified in the URI('Results') the system uses the default values if available. When mandatory variables remain empty the error BRAIN 629 occurs, see also Example IX.
- If variables should/need to be specified in the URI then all variables have to be filled, even when they should be left empty, see Example III and Example IX.
- For interval variables both the From and To Fields must be filled, see ODATA query with variables.
- Only one default value is shared per variable in case of a meta data call($metadata), see Example IX.
- Only default values defined in query definition are exposed in a meta data call($metadata), values that are determined at runtime (e.g. via customer exit at i_step=1) cannot be exposed in this case. See Example IX.
- Parameter $select: it defines the drilldown; if not specified, all InfoObjects/Fields(including free characteristics) and key figures are put into the drilldown! (memory/performance issue!)
- The URI parameters are case sensitive! Hence always use the exact technical names of the parameter values as listed in $metadata(e.g. for the query and variables). See e.g. ODATA query with variables.
- OData CDS Query: the order of the Infoobjects in the drilldown is defined in the CDS view, the order in the URI is irrelevant.
- OData Easy Query: the order of the Infoobjects in the drilldown is defined in the Query(free characteristics are not taken into account), the order in the URI is irrelevant
- OData CDS Query: parameters are always mandatory and hence have to be filled by the URI: see Example VI.
- BW OData Queries: Hierarchy-Handling
- Analytical OData V4 services are not supported at the moment. It will be only available for OData CDS Query in the future S/4 releases.
- As a prerequisite certain settings have to be maintained in the BW backend system which can be done with the help of report EQ_RS_AUTOSETUP, see 1944258 for further details.
- Troubleshooting Fiori Apps based on ABAP CDS view queries
- Guided Answers: BW Bex: Unable to activate OData Service based on CDS/BW queries
- How to identify a BW OData Service
Examples
- Example I: Simple CDS based OData Query
- Example II: Simple BexQuery with active OData flag (OData EasyQuery)
- Example III: OData EasyQuery with Variables
- Example VI: OData CDS query with paramters and filters
Example VII OData CDSQuery with paramters and filters (Interval, Range)
- Example VIII OData Call using $select to select Query Structure Elements
- OData Query with Hierarchy: Example I
Documentation
SAP Consulting Notes
- 2367553 ODataQuery features and limitation
- 2512407 Common Issues when using ODATA Queries
- 2505265 Odata - EasyQuery service not available after transport
- 2498513 How to input variable values in URI for an Easy Query
- 2257830 OQ: OData query with tracing
- 1944258 Easy Query EQ and oData: Easy Setup Report
- 1906173 ODataQuery: Features and Limitations for SP05
- 1941751 ODataQuery: Features and Limitations for SP06
- 2387550 Unable to activate the OData service for a Fiori Analytic App on S4HANA
- 3005437 Easy Query OData: Required Settings for Service Generation