Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

RAP510 - Developing for Analytics with the SAP BTP ABAP Environment

Description

This repository contains the material for the hands-on session RAP500 - Developing for Analytics with the SAP BTP ABAP Environment.

It is used for various events such as SAP TechEd, SAP user groups events, etc.

Requirements needed to participate in this workshop

In order to participate in this hands-on session you MUST have installed the latest version of Eclipse and the latest version of the ABAP Development Tools (ADT) in Eclipse.
Please check the following two short documents how to do this if you have not already done it.
Install the ABAP Development Tools (ADT)
Adapt the Web Browser settings in your ADT installation

Overview

^Top of page
A nice overview about the development for Analytics with SAP BTP ABAP Environment can be found in the following blog post Developing for Analytics with the SAP BTP ABAP Environment by Andreas Riehl

In the following graphic, the devlopment objects of a RAP based business object (on the left side) are compared with the corresponding analytical development artefacts (on the right side):

The Big Picture - Service Consumption

Development flow RAP style analytics

Development starts in both cases with data modelling based on existing CDS views and tables. The Analytical Model is based mainly on cubes and dimensions that are also modelled in CDS.

The analytical equivalent to a projection view is the analytical query. It is based on an analytical cube and is again also an ABAP CDS artefact. The query is then used within service definition and binding via the InA protocol.

SAP Information Access (InA) is a REST HTTP-based protocol used by SAP Analytics Cloud to query your data sources in real time.

So the analytics developments are really following the same paradigm with CDS views, service definition and binding and use the same data models as a basis – just as you are used to from the RAP style transactional world. The differences (at least from the programming model perspective) are just small additions to adapt to the special needs for analytics:

The new service binding type InA is tailored to the needs of analytical clients, e.g., to serve different aggregation levels at once and of course additional annotations are needed to describe the semantics that are unique to analytics.

By the way, if you are not familiar yet with the ABAP RESTful Programming Model, there is a great getting started blog post available Getting Started with the ABAP RESTful Application Programming Model (RAP).

What are the analytical models?

^Top of page

Star Schema

Let us look at the Travel analytical model. At its center we find a CDS view entity for travel data, the cube view, that pulls together fields from many tables that are involved in the travel booking, like customer ID, agency ID, No.of travels, and so on.

The cube view contains dimensional data (= descriptive data such as a travel ID or an customer ID) as well as measurable data (=quantifiable fields that can be calculated, e.g. the number of travels or the total price). We refer to these as dimension fields and measures.

Measures can be aggregated and, if necessary, can have an association to a unit of measure or a currency. Their aggregation behavior is defined via annotation @Aggregation.default. If for example the annotation @Aggregation.default: #SUM is used, the measures will be summed in an analysis. Measures usually contain transactional data

In our Flight Bookings analytical model we have the following measures:

  1. Total number of bookings
  2. The total price of a booking

Dimension fields can be used to filter the results of an analysis and to group the result rows of an analysis according to the values of the dimension fields. The more dimension fields a cube contains, the higher the flexibility of possible analyses as there are more options for filtering and grouping the data. Dimension fields usually contain master data.

In our Flight Bookings analytical model we have the following dimensions:

  1. Customer
  2. Agency

Dimension views

The cube view at the center of our schema references dimension views (annotation @Analytics.dataCategory: #DIMENSION) which provide additional attributes for the dimension fields in the cube view. The dimension fields of the cube are connected to the dimension views via foreign key association (annotation @ObjectModel.foreignKey.association). The field that is referenced in the association is defined as the representative key of the dimension view (annotation @ObjectModel.representativeKey).

Using the dimension view for customer data it is for example possible to retrieve the full name of a customer or the country a customer lives in based on the dimension field CustomerID stored in the cube view.

Dimension views can contain text fields that are not language dependent, such as the name of a company or the full name of a customer. These are annotated in the dimension view using the annotation @ObjectModel.text.element.

In order to provide language-dependent texts for the dimension fields text views (annotation @objectModel.dataCategory: #TEXT) are used. They are connected to the dimension fields via a text association (annotation @ObjectModel.text.association).

In this exercise we will only use text fields.

Analytical Queries

On top of this analytical model (views with transaction data or master data), we define Analytical Queries as specific CDS View Entities. These views have to contain all fields that are needed for grouping on the query level. If they don't already exist, extended analytical reuse views are created in addition. The query views have to contain all fields, that are relevant for reporting, including calculated fields, master data attributes, and texts.

The analytic queries will not be processed by an SQL engine but by an Analytic Engine, which selects the data via SQL from the views of the underlying analytic model (CUBES, DIMENSIONS, TEXT). Analytical clients like SAP Analytics Cloud that query this data are using the RESTful HTTP-based protocolSAP Information Access (InA).

With our flight booking model we can generate the following metrics in different queries:

  • Total of travels booked by an agency
  • Total price for each travel/customer

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

Let's start creating ABAP CDS views based analytical data models by following the exercices listed below.

Download and Installation

^Top of page
You have to download and install the ABAP Development Tools (ADT) as described in section Requirements

Known Issues

^Top of page
This tutorial can only be performed on licensed systems, i.e. SAP BTP ABAP Environment and SAP Analytics Cloud.

Exercises

^Top of page
These are the steps of our hands-ons session:

How to obtain support

^Top of page
Support for the content in this repository is available during the actual time of the online session for which this content has been designed. Otherwise, you may request support via the Issues tab.

Further Information

^Top of page
You can find more information on the SAP Help Portal:

License

^Top of page
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.