Skip to Content
Technical Articles
Author's profile photo Felipe de Mello Rodrigues

Create an analytical model based on ABAP CDS views

SAP HANA combines OLAP and OLTP processing in a single in-memory database, transactional and analytical can live together in the same place and this means you have access to the exact information you need in real time.

With this new approach an interesting question emerges, since we have the transactional and analytical worlds combined in a single database, is there any difference in the development approach when we talk about data models constructed over ABAP CDS (Core Data Services)?

The answer is Yes and in this article I try to clarify these different concepts with a good example of how you should construct an Analytical model based on ABAP CDS views.


Transactional vs. Analytical

One of the biggest advantages of constructing data models with ABAP CDS is that you can design views thinking about both paradigms, depending on your requirements you can apply different development techniques focusing in one of the scenarios.

Analytical models are recommended for reporting purposes when you need to use advantage of aggregations to expose results across different areas (e.g. by time, by location, by responsible). These models are conceived over Facts and Dimensions and these views contain the basic data used to conduct detailed analyses and derive business values.

Imagine as an example a sales report which provides results based on customer, product, date and sales person. The Fact is the sales itself and it holds values that we can measure (e.g. number of sales and total amount of sales), the filters by customer, product, time and sales person are the Dimensions and these dimensions can have Attributes or Texts attached (e.g. customer name, address and product description) and when we connect all of them we have a Cube and consequently an analytical model ready for consumption.

On top of this analytical model we need to construct a Query adapting the data in the way we want to expose to the user. The cube must be constructed in a way it can be reused and consumed by several different Queries, for example, with the sales model above we can generate the following metrics in different queries:

  • Sales by year quarter;
  • Sales by products with cost above $100;
  • Sales by customer located in a specific city;
  • Average of sales amount per number of sales;
  • Uplift on sales from prior year.

Each query will fulfill an specific purpose and it could be designed for different applications (e.g. Reports, KPIs, etc.).

Important Note: This article won’t focus extensively on Business Intelligence (BI) concepts, if you still have questions about the subject I advise you to perform an extra search with all the topics discussed so far.

  • Dimensions
  • Facts
  • Attributes
  • Texts
  • Cubes
  • Analytical Queries

The real focus of this article is actually to translate those BI concepts to the universe of ABAP CDS views and with this statement in mind we can proceed to our next topic.


Adapting Business Intelligence concepts in ABAP CDS

If you already worked with ABAP CDS in the past you definitely heard about annotationsOne of the main purposes of Core Data Services is to allow the creation of semantically rich data models and annotations are the main component to support this task.

There are annotations related with different areas like configuration of UI applications, Enterprise Search, OData service publishing and Analytics. The official documentation and list of all annotations available can be seen in the link below:

Since the focus of this article is to talk about analytic models we’re going to focus in two groups of annotations:

Analytics provide support to adapt ABAP CDS views and enable multidimensional data consumption taking advantage of data aggregation. AnalyticsDetails support the adaptation of analytical query layout with changes in the aggregation behavior, planning or formulas to calculate metrics.

The process to adapt CDS views is pretty simple, if you want to declare a Dimension, Fact, Aggregation Level or Cube you must include the following annotation in the header of your CDS view:

@Analytics.dataCategory: #VALUE

Replace #VALUE by one of the categories commented before:

  • #CUBE
  • #FACT

Pay attention because Cubes must contain at least one measurable attribute, to define a field as a measure you need to place this annotation on the top of the field:

@DefaultAggregation: #SUM

Changes in the default aggregation are possible but the most common scenario is configured with a #SUM aggregation.

When we talk about a Query there is a slight difference in the process because you should include a different annotation in the header of your CDS view:

@Analytics.query: true

Queries must select data from cubes because of the aggregation pattern defined previously, if you try to consume data from a different view the system will return an error during the activation.

Now you should be able to identify the basic steps to create ABAP CDS analytical views but still without any idea of how you should connect all of these different views to create an analytical model. In the next section we still start to practice with a real development.


Creating an analytical model with ABAP CDS

As usual I like to explore SAP flight demo tables in my exercises and for this article I’m going to create a data model on top of the Single Flight Booking table (SBOOK). For the purpose of this demo a simple data model containing a few measures and dimensions is enough to demonstrate the concepts discussed so far. Let’s check the proposed data model in the card below:


Flights Bookings
  • Total number of bookings
  • Total price of bookings
  • Total weight of luggage


  • Date
  • Airline
  • Connection
  • Customer
  • Travel Agency


There are a lot of options left to explore in SBOOK table but since I don’t want to over complicate the exercise I’m not going to explore its full potential. When you replicate this demo try to play around identifying more fields that could potentially add business value and feel free to attach them into the current data model.

With the analytical model planned we can finally start the development of ABAP CDS views. For the date dimension we don’t need to develop a custom view because the standard view I_CalendarDate provides support with association to all relevant attributes (e.g. year, quarter, month and week) but we need to implement the rest of the dimensions creating custom CDS views. Have a look in the source codes for each one of them below:


@AbapCatalog.sqlViewName: 'ZDIMEAIRLINE'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Airline'

@Analytics.dataCategory: #DIMENSION

define view Z_Dimension_Airline
  as select from scarr
      @ObjectModel.text.element: [ 'AirlineName' ]
  key carrid   as Airline,
      @Semantics.text: true
      carrname as AirlineName,
      @Semantics.currencyCode: true
      currcode as Currency

DIMENSION: Connection

@AbapCatalog.sqlViewName: 'ZDIMECONNECT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Connection'

@Analytics.dataCategory: #DIMENSION

@ObjectModel.representativeKey: 'FlightConnection'

define view Z_Dimension_Connection
  as select from spfli
  association [0..1] to Z_Dimension_Airline as _Airline on $projection.Airline = _Airline.Airline
      @ObjectModel.foreignKey.association: '_Airline'
  key carrid                    as Airline,

      @ObjectModel.text.element: [ 'Destination' ]
  key connid                    as FlightConnection,

      @Semantics.text: true
        concat(' -> ', cityto)) as Destination,



@AbapCatalog.sqlViewName: 'ZDIMECUSTOMER'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Customer'

@Analytics.dataCategory: #DIMENSION

define view Z_Dimension_Customer
  as select from scustom
  association [0..1] to I_Country as _Country on $projection.Country = _Country.Country
      @ObjectModel.text.element: [ 'CustomerName' ]
  key id      as Customer,

      @Semantics.text: true
      name    as CustomerName,

      @ObjectModel.foreignKey.association: '_Country' true
      country as Country, true
      city    as City,

DIMENSION: Travel Agency

@AbapCatalog.sqlViewName: 'ZDIMETRVAGENCY'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel Agency'

@Analytics.dataCategory: #DIMENSION

define view Z_Dimension_TravelAgency
  as select from stravelag
  association [0..1] to I_Country as _Country on $projection.Country = _Country.Country
      @ObjectModel.text.element: [ 'TravelAgencyName' ]
  key agencynum as TravelAgency,

      @Semantics.text: true
      name      as TravelAgencyName,

      @ObjectModel.foreignKey.association: '_Country' true
      country   as Country, true
      city      as City,

Important Notes:

  1. All dimensions must have an @Analytics.dataCategory: #DIMENSION classification in the header of the view.
  2. Associations with texts and names are executed through annotation @ObjectModel.text.element.
  3. Associations of external attributes are determined by foreign key using annotation @ObjectModel.foreignKey.association.
  4. Dimensions with composite keys needs a definition of a single field as a representative key, this configuration is achieved through annotation @ObjectModel.representativeKey.
  5. Annotation @Semantics helps to define text and address fields.

With all dimensions prepared we can move on to the development of our cube.

CUBE: Flight Bookings

@AbapCatalog.sqlViewName: 'ZCUBEFLIGHTBOOK'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Bookings'

@Analytics.dataCategory: #CUBE

define view Z_Cube_FlightBookings
  as select from sbook
  association [0..1] to I_CalendarDate           as _CalendarDate on  $projection.FlightDate = _CalendarDate.CalendarDate
  association [0..1] to Z_Dimension_Airline      as _Airline      on  $projection.Airline = _Airline.Airline
  association [0..1] to Z_Dimension_Connection   as _Connection   on  $projection.Airline          = _Connection.Airline
                                                                  and $projection.FlightConnection = _Connection.FlightConnection
  association [0..1] to Z_Dimension_Customer     as _Customer     on  $projection.Customer = _Customer.Customer
  association [0..1] to Z_Dimension_TravelAgency as _TravelAgency on  $projection.TravelAgency = _TravelAgency.TravelAgency
  /** DIMENSIONS **/

  @EndUserText.label: 'Airline'
  @ObjectModel.foreignKey.association: '_Airline'
  carrid                 as Airline,

  @EndUserText.label: 'Connection'
  @ObjectModel.foreignKey.association: '_Connection'
  connid                 as FlightConnection,

  @EndUserText.label: 'Flight Date'
  @ObjectModel.foreignKey.association: '_CalendarDate'
  fldate                 as FlightDate,

  @EndUserText.label: 'Book No.'
  bookid                 as BookNumber,

  @EndUserText.label: 'Customer'
  @ObjectModel.foreignKey.association: '_Customer'
  customid               as Customer,

  @EndUserText.label: 'Travel Agency'
  @ObjectModel.foreignKey.association: '_TravelAgency'
  agencynum              as TravelAgency,

  @EndUserText.label: 'Flight Year'

  @EndUserText.label: 'Flight Month'

  @EndUserText.label: 'Customer Country'
  @ObjectModel.foreignKey.association: '_CustomerCountry'
  _Customer.Country      as CustomerCountry,

  @EndUserText.label: 'Customer City'
  _Customer.City         as CustomerCity,

  @EndUserText.label: 'Travel Agency Country'
  @ObjectModel.foreignKey.association: '_TravelAgencyCountry'
  _TravelAgency.Country  as TravelAgencyCountry,

  @EndUserText.label: 'Travel Agency Customer City'
  _TravelAgency.City     as TravelAgencyCity,

  /** MEASURES **/

  @EndUserText.label: 'Total of Bookings'
  @DefaultAggregation: #SUM
  1                      as TotalOfBookings,

  @EndUserText.label: 'Weight of Luggage'
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'WeightUOM'
  luggweight             as WeightOfLuggage,

  @EndUserText.label: 'Weight Unit'
  @Semantics.unitOfMeasure: true
  wunit                  as WeightUOM,

  @EndUserText.label: 'Booking Price'
  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'Currency'
  forcuram               as BookingPrice,

  @EndUserText.label: 'Currency'
  @Semantics.currencyCode: true
  forcurkey              as Currency,

  // Associations
  _Customer._Country     as _CustomerCountry,
  _TravelAgency._Country as _TravelAgencyCountry

Important Notes:

  1. It’s not mandatory to construct a Fact view to consume it from inside of a Cube, you can expose the table who holds the measures directly in the cube to avoid an extra view and consequently an unnecessary level. Based on the documentation, fact views cannot have joins or association and they must hold only measurable values, if you want to connect your dimensions in the same view you should definitely use a cube instead of a fact.
  2. All cubes must have an @Analytics.dataCategory: #CUBE classification in the header of the view.
  3. Associations of external attributes are determined by foreign key using annotation @ObjectModel.foreignKey.association.
  4. @DefaultAggregation annotation should be place before the fields determined as measures.
  5. Annotation @Semantics helps to define text, currency, quantity and address fields.
  6. All the associations are exposed in the bottom of the view to provide access to Attributes and Texts during the query consumption.

Before we proceed to the query development let’s have a quick look in the transaction RSRTS_ODP_DIS (Transient Provider Preview). This transaction is used to review associations, texts and hierarchies placed inside of the analytical data model providing a detailed analysis for each one of the attributes.

You can use this transaction to review any kind of analytical views but the focus here is to review the cube only. Copy the name defined in the annotation @AbapCatalog.sqlViewName, place it in ODP Name parameter and execute the program.

In the right section of the screen we can see two types of icons, the left one  confirms that we have a valid dimension associated with the attribute (based on a Foreign Key), the right one confirms that we have a text association with this field.

All the attributes were validated (by foreign key and text) and since everything looks fine we can move on to the query development.

QUERY: Flight Bookings

@AbapCatalog.sqlViewName: 'ZQUERYFLIGHTBOOK'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Bookings'

@Analytics.query: true

define view Z_Query_FlightBookings
  as select from Z_Cube_FlightBookings
    /** DIMENSIONS **/
    @AnalyticsDetails.query.display: #KEY_TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY_TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY_TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY_TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #TEXT
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    @AnalyticsDetails.query.display: #KEY
    @AnalyticsDetails.query.axis: #FREE
    /** MEASURES **/
    @EndUserText.label: 'Average Weight Per Flight'
    @AnalyticsDetails.exceptionAggregationSteps.exceptionAggregationBehavior: #AVG
    @AnalyticsDetails.exceptionAggregationSteps.exceptionAggregationElements: [ 'Airline', 'FlightConnection', 'FlightDate' ]
    @AnalyticsDetails.query.formula: '$projection.WeightOfLuggage'
    @AnalyticsDetails.query.decimals: 0
    0 as AverageWeightPerFlight

Important Notes:

  1. All queries must have an @Analytics.query: true classification in the header of the view.
  2. Annotation @AnalyticsDetails is used all over the query providing support for the following tasks:
    1. Display (Key or Text) and axis control (Free, Columns or Rows) of dimensions.
    2. Exception aggregation behavior.
    3. Query formulas.
  3. All the three main measures were exposed in the bottom of the query but there is an extra metric based on an average aggregation behavior, the query formula will use the weight of luggage as measure and apply the aggregation to calculate the average during the run-time.

Since there is a calculated field in the query level there is no option to test the aggregation and formula using HANA Studio data preview, to achieve this functionality we need to test our query through a front-end application which supports this task.


Testing the Analytical Query

It is possible to execute tests directly through transaction RSRT (Query Monitor) but I would like to show you an alternative way using View Browser Fiori application available in the standard role SAP_BR_ANALYTICS_SPECIALIST (Analytics Specialist).

Search the query, select the record and click in the button Show Content.

The report screen shows all the 4 metrics (3 measures and 1 formula) and all of the dimensions in the left side available for selection. Check that Booking Price shows * as result, this happens because we have multiple currencies and the system cannot aggregate them without the Currency dimension exposed.

Let’s fix this issue moving Currency from Dimensions to Rows area. This is the expected outcome:

Now we can play with different dimensions checking the results across different areas, check some examples below:

By Airline:

By Customer Country:

By Year:


UI5 and BI front-end applications

Examples of UI5 applications which make use of ABAP CDS analytical queries:

  • Smart Business Applications
    • KPI modeller
    • APF (Analysis Path Framework)
  • Fiori Elements
    • Overview Pages (Analytical cards)
    • Analytical List Pages
  • Custom applications with analytical UI controls
    • Analytical Tables
    • Charts

Most part of the SAP BI front-end applications (from the SAP BusinessObjects BI suite) already provide support to ABAP CDS analytical queries:

  • SAP Web Intelligence (WebI)
  • SAP Analysis for Microsoft Office
  • SAP Lumira


So this is the end! Hope you enjoyed the content. 🙂

In my next post I’m going to move back to the Fiori Elements subject and reuse the data model created in this article to explore how we can work with an Analytical List Page.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Young Hwan Kim
      Young Hwan Kim

      Nice blog. Looking forward your next blog.

      Author's profile photo Michelle Crapo
      Michelle Crapo




      Author's profile photo abraham mendez
      abraham mendez

      What a superb blog Felipe!

      Thanks for your effort in explaining the details of the solution, specially on how to test the cube and query.

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      My pleasure!

      Thank you for the feedback, it feels great to see this content being appreciated by the community.


      Author's profile photo Vivek Ramasamy
      Vivek Ramasamy


      We tried to display hierarchy using Hierarchy CDS views and it is fine in "Analysis Office" but the expansion of nodes are not working if the same is consumed in Fiori Elements List report.

      The issue is detailed in ( Please can you let us know your comments.




      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Vivek,

      I provided some ideas in the thread.



      Author's profile photo Timothy Muchena
      Timothy Muchena



      Thanks for the blog. Its very informative.

      In dimension Travel Agency there is an association to I_Country, my question is where is I_Country coming from?


      Thanks you

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Timothy Muchena,

      I_Country is a standard CDS view that provides a list of countries from the table T005. It is also connected with a second CDS view called I_CountryText which reads country name from table T005T.

      Have a look in your S4/HANA instance and you'll notice several standard views reusing I_Country along with other interface views like I_Language, I_Region, etc.

      PS: You could potentially create your own Country view but since SAP offers a reusable option is better to implement this one instead of having duplicate views in the system.



      Author's profile photo Roger Beach
      Roger Beach


      Thank you for the blog, it is great information.  I was curious, we have an on-prem Oracle database behind our system, so NO HANA.  I followed your blog exactly and everything is functioning.

      I cannot see the standard views like I_CalendarDate and I_Country in our system, but I don't see any errors either.

      It appears to be functioning correctly.  Do you know how our system might be intepreting the references to I_CalendarDate and I_Country?

      Thanks in advance.

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Roger Beach,

      Probably you’re still on a previous version of the SAP Basis. I’m not sure but I believe they were released after SAP Basis 7.52.

      Alternatively, you can create your custom CDS views reading data from the following tables:

      • Country: T005
      • Calendar Date: SCAL_TT_DATE



      Author's profile photo kyo choi
      kyo choi

      You can go to SE11 and use 'where used list', 1 and select DDL Source or create one.


      Author's profile photo TEAM SAP
      TEAM SAP

      hi Felipe de Mello Rodrigues

      can you help me how to consuming hana view fiori launchpad, im stucking with this past 10 days please do me need ful

      thanks in advance

      Arunkumar Mani

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author


      I advise to access the SAP Help Portal for the official documentation and if you have any queries in the future please provide more details about the topic you want to discuss.

      If you want to consume HANA views maybe this post is not the best fit for you. Try to use the Q&A section so this way other users will be able to contribute with your question.



      Author's profile photo Smriti Gupta
      Smriti Gupta

      Hello Felipe,


      Such a well written step by step blog. As analytics annotation is true, we can also consume it in query browser, right?

      But I am getting gollowing error when I open it any query in query browser. I will anyway check if some Snote is missing

      Query 2CZQUERYFLIGHTBOOK is unknown; MsgClass:Query 2CZQUERYFLIGHTBOOK ist unknown; MsgClass:


      Thanks once again for the awesome blogs


      Best Regards


      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Smriti Gupta,

      Thank you for the kind words, I really appreciate the recognition. 🙂

      If you are receiving this error you probably have an exception in your Query or Cube, sometimes when you activate the views via HANA Studio the system activates the view but you can still find some errors in the Problems & Errors log.

      This error is quite common and I don't believe you need to apply any SAP Notes in the system, try to review your views, review all the steps available in this blog and test the query via Query Browser until you receive the expected outcome.



      Author's profile photo Sonet Kebede
      Sonet Kebede

      can we

      • Create CDS view on the existing HANA 2.0 tables instead of creating HANA calculation views.  And
      • Consume the CDS view as a OData service in SAC by creating a SAC 0Data connection instead of the SAC Live connection.
      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Sonet Kebede,

      You can create ABAP CDS or HANA CDS views on top of any table or view available in your HANA database.

      Regarding the exposure you can also publish via OData service and consume via SAP BO tools or SAP Analytics Cloud, but I believe the performance of HANA Live Connection is actually superior since you have one less communication layer in the landscape.

      Hope this information helps.



      Author's profile photo Sonet Kebede
      Sonet Kebede


      Author's profile photo Timothy Muchena
      Timothy Muchena


      Its me again. I use your blog as a reference for "a lot of things CDS views". Thank you

      You mentioned that

      " Dimensions with composite keys needs a definition of a single field as a representative key, this   configuration is achieved through annotation @ObjectModel.representativeKey. "

      I noticed that the annotation is missing in CDS Z_Dimension_Airline, thanks to RSRTS_ODP_DIS tcode. I added it and got error

      "Foreign key associatiotin Airline not found"

      I changed the association to "_Airline". After changing the association i get error

      "Association _Airline ignored: Field Airline is already the representative key           Z_DIMENSION_CONNECTION "

      I then commented out the foreign key association and got no errors.

      Now getting an error in Z_Query_FlightBookings saying "error reading infoprovider for cds view"

      I have since changed Z_Dimension_Airline to your verion but still getting the infoprovider error.

      Any idea of what might be the cause.


      Thank you

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Timothy Muchena,

      The Airline dimension is not based on a composite key so you shouldn't use the annotation @ObjectModel.representativeKey, for this reason you received the error message.

      I advise you to review the steps mentioned in the article and review your CDS views to troubleshoot and fix the error.



      Author's profile photo Timothy Muchena
      Timothy Muchena

      Thank you for your response.

      Much appreciated

      Author's profile photo Prasad Damoder
      Prasad Damoder

      Fabulous blog! I have now got clarified on a lot of attributes of CDS Views. Thanks so much. Keep sharing.

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Thank you Prasad Damoder! I really appreciate the feedback. 🙂

      Author's profile photo Abhijeet Kankani
      Abhijeet Kankani

      I read both of your blog for KPI modeller, it is one of best blog on Analitics using CDS.


      We also have similar kind of requirement, KPI in SD, MM, FI,QM, PM and EWM.

      UX in our project is Microsoft Xamarin and UI team is not going to set filterfor date from there side like yeartodate, quatertodate, monthtodate, yesterday(ytd,qtd,mtd,ys and tday) and today for given measure.


      So in above blog time is used as dimension and can be called using filter or parameter, but in our case it is fix(ytd,qtd,mtd,ys and tday) for given dimention on which they want aggregations.


      So had work around by using CDS view and exposing it in Odata by RDS(Reference data source) so that all the filter capacities we can leverage using CDS concept.


      added time like below in CDS --

      cast(0 as netwr )                                      as    Yeartodate,

            cast(1 as netwr)                                       as    Monthtodate,

            cast(2 as netwr)                                       as    Quatertodate,

            cast(3 as netwr)                                       as    yesterdaytotill,

            cast(4 as netwr)                                       as    Today


      once runtime artefact generated, Copied the generic functionality of CDS which is there in DPC_EXT(get_entityset)


      Calling Interface method for base CDS functionality

          if_sadl_gw_dpc_util~get_dpc( )->get_entityset( EXPORTING io_tech_request_context = io_tech_request_context

                                                         IMPORTING et_data                 = et_entityset

                                                                   es_response_context     = es_response_context ).

      * Assigning Result


      Once result set is there in ET_entityset, by using loop based on date did the aggregation and assign to ytd,mtd,qtd..


      Its working for given measure for any filter on dimension, but not clear solution as for each measure need to do write logic in side dpc_ext in side loop , if you have any better alternative then please suggest.



      Abhijeet Kankani

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi abhijeet kankani,

      Thank you for the positive feedback.

      If you want to benefit from the automatic aggregation provided by the analytical engine you must deploy your OData services directly via annotation.

      With your example (based on SADL and deploy of CDS views via SAP Gateway) you would need to provide manual aggregations for each one of the dimensions exposed in the service, definitely not a recommendable approach in my point of view.

      Hope this info helps.



      Author's profile photo hugo picon
      hugo picon

      Hi Felipe,

      First of all, excellent blog , this give us a good understanding about CDS.

      I was wonndering if you can help me with this error, when i'm trying to active my CUBE CDS.

      Field NUMBEROFDAYS ignored: Data type INT4 not allowed characteristic


      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi hugo picon,

      Thank you for your message.

      Regarding the error, I believe you probably missed the annotation for the aggregation and your measure was actually identified as a dimension by the CDS compiler.

      I advise to review all the steps and examples available in this article.



      Author's profile photo Prashanth Veeranki
      Prashanth Veeranki

      Hi Felipe,

      I am getting the same error. hugo picon any update on how you fixed this?



      Author's profile photo ED F4114
      ED F4114

      you need to check the sap note 2600268 - Error 'Could not resolve field xxx' when activate a CDS view


      then corrects I_CalendarYear and I_YearMonth


      define view I_CalendarYear as select from scal_tt_year
      key scal_tt_year.calendaryear as CalendarYear,
      scal_tt_year.isleapyear as IsLeapYear,
      @DefaultAggregation: #SUM
      scal_tt_year.numberofdays as NumberOfDays
      //cast( concat(calendaryear, '0101') as abap.dats ) as FirstDayOfYearDate


      define view I_YearMonth
      as select from scal_tt_month as month
      inner join scal_tt_year as year on month.calendaryear = year.calendaryear
      association [0..1] to I_CalendarMonth as _CalendarMonth on $projection.CalendarMonth = _CalendarMonth.CalendarMonth
      association [1..1] to I_CalendarQuarter as _CalendarQuarter on $projection.CalendarQuarter = _CalendarQuarter.CalendarQuarter
      key month.yearmonth as YearMonth,
      @ObjectModel.foreignKey.association: '_CalendarMonth'
      month.calendarmonth as CalendarMonth,
      month.calendaryear as CalendarYear,
      @ObjectModel.foreignKey.association: '_CalendarQuarter'
      month.calendarquarter as CalendarQuarter,
      year.isleapyear as IsLeapYear,
      @DefaultAggregation: #SUM
      month.numberofdays as NumberOfDays,
      month.firstdayofmonthdate as FirstDayOfMonthDate,
      month.lastdayofmonthdate as LastDayOfMonthDate,
      month.halfyear as HalfYear,



      Author's profile photo Vijay Ginjupalli
      Vijay Ginjupalli

      Thanks Felipe , Great Post .

      Is there a way If we want to save as a tile and share with users ?


      Thanks .

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Vijay Ginjupalli,

      Some applications from the SAP Smart Business Services provide you this feature out-of-the-box.

      You can also create your own tiles and publish them via Fiori Launchpad Designer.



      Author's profile photo Vineet Gupta
      Vineet Gupta

      Great blog!


      Any pointers on how to connect Business Objects tools to the CDS query view. We have a Suite on HANA system with Netweaver 7.5, effectively ECC on hana. I was able to create an OLAP connection in Business Objects using the BW connector, but cannot see the Query view in WEBI.

      Author's profile photo Felipe de Mello Rodrigues
      Felipe de Mello Rodrigues
      Blog Post Author

      Hi Vineet Gupta,

      If you published your query properly you should be able to consume it in WebI via OLAP connection.

      Please, have a look in your back-end system and confirm if the query is available via RSRT t-code, I believe your query was not deployed and for this reason you're not able to reach it through SAP BusinessObjects.



      Author's profile photo Vineet Gupta
      Vineet Gupta

      Thanks for your response. The query is visible in RSRT but it causes a shortdump when I execute the query. We have never used ECC for BW queries so far. I will research further to the cause of shortdump. It seems I am missing some basic BW setup in ECC for Analytical CDS views to work.

      Author's profile photo Pavana Rahul Pippalla
      Pavana Rahul Pippalla

      Great Blog ..!

      Actually i'm facing an issue where i'm not able to bind the data to p13n dialog of analytical table.

      For example

      1.columns which are visible in table are not been preselected in in p13n dialog by default and order of columns in p13n dialog is different from the table columns.

      2.applied  filters, sorters and grouping outside the p13n dialog are not shown p13n dialog etc.

      Are there any  annotation which needs to be added to the cds so that p13n (View Settings)

      dialog will work fine as it should be ??

      Thanks and regards,


      Author's profile photo B@lu .
      B@lu .

      hi Felipe de Mello Rodrigues,

      according to object model annotations are not nessary  while dealing with READ operations.then what is the significance of objectmodel annotations while building analytical query (READ).

      Author's profile photo Appu John
      Appu John

      Nice blog with Great Details

      Author's profile photo Subbaiah Kotha
      Subbaiah Kotha

      Very detailed blog and Thanks Felipe for sharing all your knowledge and experience in this area.

      Author's profile photo Baris Celebi
      Baris Celebi

      great guide , thanks a lot

      Author's profile photo Elizabeth Kinanga Daniel
      Elizabeth Kinanga Daniel

      Hello Felipe Felipe de Mello Rodrigues ,

      i created  two Mimension Views and get error that i can use  the annotation @ObjectModel.representativeKey: 'CostCenter' because  CostCenter is used  already the representative key [Analytics]

      what am i doing wrong?

      If i tried @ObjectModel.text.association: '_DM' get also a error that
      CDS view ZCDS_CSKT_DM does not have data category #TEXT or data category #TEXT ignored.

      Thank you advance!!



      Author's profile photo Elizabeth Kinanga Daniel
      Elizabeth Kinanga Daniel

      Hi Felipe de Mello Rodrigues

      I have found the error. I correct it.

      Thank you

      Author's profile photo Daouda Pouye
      Daouda Pouye

      Hello Felipe,
      Thank you for sharing this very interesting blog.
      However, I have a question regarding the DATE parameter in an application.
      The default date shows '1970.01.01' while I want to see the current date or empty field.
      I tried with the following annotations:
      - @Environment.systemField: #SYSTEM_DATE
      - @Consumption.defaultValue: 'TODAY'
      - etc...
      Is my requirement possible? If yes please help me.

      Author's profile photo Adem Güler
      Adem Güler

      Thank you for the blog. Useful article.

      Author's profile photo Chun Kim
      Chun Kim

      Hello Felipe,


      in view browser,

      1. search with z_query, we get result which is Z_Query_FlightBookings

      2. mark the checkbox, and click the Show Content

      3. get error

      Title: ErrorMessage: App could not be opened either due to an incorrect SAP Fiori launchpad configuration or a missing role assignment.Details: { "info": "Failed to resolve navigation target \"#AnalyticQuery-analyze?bsa_query=2CZQUERYFLIGHTBOOK&sap-app-origin-hint=\". This is most likely caused by an incorrect SAP Fiori launchpad content configuration or by a missing role assignment.", "fixedShellHash": "#AnalyticQuery-analyze?bsa_query=2CZQUERYFLIGHTBOOK&sap-app-origin-hint=", "technicalMessage": "Could not resolve navigation target"}


      How to resolve this error?

      Thank you!

      Author's profile photo shu yin
      shu yin


      My Hero


      thank you