Page tree
Skip to end of metadata
Go to start of metadata

Virtual Time Hierarchies can also be used for CDS queries(see Embedded Reporting on ABAP CDS views) for fields with corresponding date or time semantics(e.g. @Semantics.calendar.month, @Semantics.fiscal.period). If required it is also possible to define one or more Time Dimensions, so a set of time characteristics which 'belong' to each other and where values of some elements(like Calendar Month) can be derived from a basic time reference characteristic(e.g. Calendar Day). The corresponding annotation is @ObjectModel.value.derivedFrom. There are also delivered CDS views of type Dimension which can used for defining a set of desired time characteristics in a CDS Cube, see the following simple example below for further details.

Two Important Delivered Dimensions

  • I_CalendarDate
  • I_FiscalyearPeriod

Time Semantics Examples

  • @Semantics.calendar.dayOfYear: true
  • @Semantics.calendar.yearMonth: true
  • @Semantics.calendar.yearQuarter: true
  • @Semantics.calendar.year: true
  • @Semantics.fiscal.yearPeriod
  • @Semantics.fiscal.yearVariant
  • @Semantics.fiscal.year
SCN Wiki
SAP Consulting Notes
  • 2895892 BW-Live Time-Series Chart drill levels are not available Part 2
  • 2895891 BW-Live Time-Series Chart drill levels are not available Part 1
  • 2895837 BW-Live Time Variance "Select Calendar Day or create a single selected filter based on Calendar Day to view time-based variance"

Virtual Time Hierarchies used in SAC

When using a time series chart is SAC note that, in contrast to other BI frontend tools like AO(and e.g. also transaction RSRT), in SAC the query/story needs to have the full set of characteristics of the Time-Dimensions (that are part of the Virtual Time Hierarchy) as part of the Query definition, see 2895891 for further details. In case of CDS queries this also means that all time characteristics to be used in a Virtual Time Hierarchy must belong to the same time dimension, so all should be derived from(annotation @ObjectModel.value.derivedFrom) the same basis characteristic. See also consulting notes above and the example below.

SAP Online Documentation
SCN Wiki


Our sample cube is based on the table SFLIGHT and has an association to the delivered dimension I_CalendarDate in order to make also calendar month and quarter available. These two fields are needed when we further down use a corresponding query in SAC.

We run following simple query 

in Transaction RSRT and add FlightMonth and FlightQuarter to the drilldown.

The result is consistent regarding the time dimension. Since we are interested in using a virtual time hierarchy for CalendarDay we check whether such hierarchies are offered in the Properties dialog:

We select the hierarchy 0QUA_MON_DAY and get the following result displayed:

Note that in general it is not necessary that FlightMonth and FlightQuarter are used in the query in order to be able to work with virtual time hierarchies regarding FlightDay. However, as we will see below, the situation changes e.g. when the feature Time Variance is used in SAC.

In general, virtual time hierarchies can only be used when they got activated in transaction RSRHIERARCHYVIRT:

Query used in SAC Story

As mentioned above, when queries with virtual time hierarchies are used as a basis for SAC stories, some additional conditions might exist: e.g. when using a time series chart, the query/story needs to have the full set of characteristics of the Time-Dimensions (that are part of the Virtual Time Hierarchy) as part of the query definition. 

The query 2CZSTPE_VT_Q2 from above has the time fields FlightMonth, FlightQuarter and FlightDay which belong to one time dimension(@ObjectModel.value.derivedFrom used). Hence, e.g. the hierarchy 0QUA_MON_DAY which we used above in RSRT should also be available for a corresponding time series chart. We take a look at a corresponding story and notice that the hierarchy 0QUA_MON_DAY is offered in this context:

Time Series Chart

E.g. a hierarchy like 0YEA_MON_DAY (Year-Month-Day) cannot be used for this query since the 'year' is missing.

Time-Based Variance

As explained in 2895837, unlike to a Time-Series Chart, the Time-Based Variance can (currently) only be used regarding the Calendar Day(0CALDAY). Our query fulfills this requirement and hence we can define the following variance

and again use the hierarchy 0QUA_MON_DAY:

Table Widget

In case of a table widget it works as in RSRT, so the hierarchy 0QUA_MON_DAY only requires(in the query definition) the basis characteristic 0calday which, in our case, corresponds to the field FlightDay

Hence, even a hierarchy like 0YEA_MON_DAY (Year-Month-Day) can be used:

  • No labels