Develop and Consume Queries on SAP Analytics Cloud
Develop analytical queries from ABAP system as data sources and consume them in the SAP Analytics Cloud to create analytical models, stories and multi-dimensional reports.
Overview
You will learn
- How to create an analytical query as CDS View Entities
- How to connect an ABAP System to SAP Analytics Cloud
- How to consume analytical queries on SAP Analytics Cloud by creating models and stories
Prerequisites
Prerequisites
- You need the standard developer authorization profile to create ABAP development objects.
- You need a SAP Analytics Cloud account.
- Install
ABAPGitPlugin in ADT. See http://eclipse.abapgit.org/updatesite/ - To get the Flight Model into the system, follow the description at https://github.com/SAP/abap-platform-refscen-flight/blob/master/README.md
- Requires Customer or Partner License.
Steps
Intro
Always replace #### with your initials or group number.
The new RAP based InA service exposure enables the SAP Business Technology Platform ABAP Environment developers to develop analytical queries(based on ABAP-CDS analytical data models) and expose them via the InA (Information Access) service protocol. In this Tutorial you will create a complete Analytical Data Model for Booking data. This consists out of dimensions for Carrier, Customer, Connection and Agency data, as well as an interface CDS view for Booking data which acts as a data source for the cube and query.
These analytical queries can be further consumed in the SAP Analytics cloud to create analytical models, stories, multi-dimensional reports and more.

As a first task you will start to import templates that you will use in this tutorial to create Analytical CDS views such as dimension views, cubes and queries.
The templates already contain certain annotations that are mandatory for the above mentioned analytical CDS views. If values such as the name of a property have to be added this can then simply be done by using code completion.
Click on the following link to display the file analytical_templates.xml. Templates
Right-click on the browser window and save the content as an xml-file called analytical_templates.xml.

- Open ADT. In the menu choose Window > Preferences.

- In the Templates dialogue choose Import.

- Select the XML file analytical_templates.xml that you have saved.

> The Import-Dialog only allows to select files having the extension `.xml.` When you have downloaded the file using a different file extension you have first to rename your file so that it gets the extension `.xml.`
- You will see that three new templates have been imported that you will use in the following tutorial.
Press **Apply and Close**

Dimensions views are links to various master data, which are later used in reporting as further attributes (according to which different aggregations can be made) and thus make up the versatility of our Analytical Model.
In the following you will create four dimension views for Carrier, Customers, Connections and Travel Agencies so that you can visualize our measures Number of bookings and Flight price in relation to these dimensions.
That means you will be able to create different charts that show how much money was spend for bookings for the connection Frankfurt–>New York compared to the connection Frankfurt–>Sydney or that show how much money was spend for flights with a certain airline.
You will start to create a dimension view that contains the different Airlines / Carriers. Since our model will contain two measures, namely Number of bookings and Flight Price you will be able to answer questions such as
- How much bookings are there per Carrier ? or
- How much money was spend for bookings for a certain Airline?
Open ADT and login to your ABAP System. If you do not have a package, create a new one.
Right-click your package and choose New > Other ABAP Repository Object.

new Choose Core Data Services > Data Definition and click Next.

new data definition Enter the following values
- Name:`ZRAP500_I_CARRIER_###`
- Description: `Dimension for Carrier`
- Referenced Object:`/dmo/carrier`
and click **Next**.
By selecting a table or another CDS view as Referenced object the wizard will use this object as a data source for the new CDS view and it will automatically add all fields into the DDL source code and it will also create camel Case aliases if needed.

- Choose a transport request and click Next.
Do **NOT** press **Finish**, because otherwise the wizard will not provide us the option to choose a specific template but would choose the template that you have used the last time.

In the Templates dialogue choose the Define a View Entity for a Dimension and press Finish. The Define a View Entity for a Dimension template is one of the new data definition templates that you have imported in the last step. This template contains certain annotations which will be explained below that are mandatory for dimension views.

define view
Now you need to edit the dimension view. Here you can use code completion to add the values for the annotations
@ObjectModel.representativeKey
and
@ObjectModel.text.element
that are needed for our dimension view.

view Click on
representativeKey, delete the placeholderrepresentativKeyso that you get an empty string ’’ , press CTRL + Space and chooseCarrierId.

- Click on
textElement, delete the placeholder stringtextElement, press CTRL + Space and chooseName.

- Save and activate the dimension.

- Your final code should look like following:
```ZRAP500_I_Carrier_####
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Dimension for Carrier'
@Metadata.ignorePropagatedAnnotations: true
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@ObjectModel.representativeKey: 'CarrierId'
define view entity ZRAP500_I_Carrier_####
as select from /dmo/carrier
{
@ObjectModel.text.element: ['Name']
key carrier_id as CarrierId,
name as Name,
currency_code as CurrencyCode
}
```
**Coding explained**
| Code | Explanation |
| ------------- | ---------- |
| @Metadata.ignorePropagatedAnnotations: true | ignore annotations from tables and base views, because you want to completely control/override the annotations here. |
| @Analytics.dataCategory | you define this CDS view as a dimension. |
| @Analytics.internalName: #LOCAL | Create UUIDs. |
| @ObjectModel.representativeKey: 'CarrierId' | you define **CarrierID** as the representative key to be able to refer to it using @ObjectModel.foreignKey.association in the Cube that you will create later |
| @ObjectModel.text.element: ['Name'] | Using this annotation you define that the attribute **Name**, contains the text element for a given CarrierId. |
Customer Dimension
The data for customers is contained in the table /dmo/customer. So you have to follow all steps above and create a dimension ZRAP500_I_Customer_#### and use the table /DMO/customer as a data source / reference object.
The table /dmo/customer contains the columns first name and last name, but not the full name of the customer. You will hence add a new field to our CDS view where you calculate the full name so that you can use it as the text element for the key field CustomerId.
The table /dmo/customer also contains fields that are too long to be used in analytics scenarios and it contains administrative fields that you do not want to show. You will hence delete these fields from the field list after having used the Define a View Entity for a Dimension template.
- Right click on your Core Data Services folder, choose Data Definition > New > Data Definition. Enter following values and press Next:
- **Name**: `ZRAP500_I_Customer_####`
- **Description**: `Dimension for Customer`
- **Referenced Object**: `/dmo/customer`

- Select a transport request and press Next
- Select again the template Define a View Entity for Dimension and press Finish
- Add a new field
CustomerNamewhich will later be specified as the text element for the key field.
`concat_with_space(first_name, last_name, 1) as CustomerName,`
- Remove or comment out these fields because they are too long for our analytics scenarios and you do not need any administration fields.
```
// email_address as EmailAddress,
// createdby as Createdby,
// createdat as Createdat,
// lastchangedby as Lastchangedby,
// lastchangedat as Lastchangedat
```
Add the association
_Countryassociation [1] to I_Country as _Country on $projection.CountryCode = _Country.Countryand add
_Countryto the field list so that it is exposed.

Add new fields and an association Choose the property
CustomerIdfor the annotation @ObjectModel.representativeKey and choose the newly created propertyCustomerNamefor the annotation @ObjectModel.text.element.
Add text Element Save and activate the dimension.
> You expose the association `_Country` to be able to access country information in the cube and query.
- Your final code should look like following:
```ZRAP500_I_Customer_####
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Dimension for Customer'
@Metadata.ignorePropagatedAnnotations: true
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@ObjectModel.representativeKey: 'CustomerId'
define view entity ZRAP500_I_Customer_####
as select from /dmo/customer
association [1] to I_Country as _Country on $projection.CountryCode = _Country.Country
{
@ObjectModel.text.element: ['CustomerName']
key customer_id as CustomerId,
first_name as FirstName,
last_name as LastName,
concat_with_space(first_name, last_name, 1) as CustomerName,
title as Title,
street as Street,
postal_code as PostalCode,
city as City,
country_code as CountryCode,
phone_number as PhoneNumber,
// email_address as EmailAddress,
// createdby as Createdby,
// createdat as Createdat,
// lastchangedby as Lastchangedby,
// lastchangedat as Lastchangedat
_Country
}
```
Connection Dimension
The information about the connections (flights) is stored in the table /dmo/connection. In this dimension view you again add a new field. The newly created field Trip will show the departure airport and the destination airport in one string.
For tables such as /dmo/connection that contain more than one key field, the key fields that are not annotated as the representative key field have to be annotated with a foreign key relationship.
Since the key field ConnectionId will be annotated as the representativeKey you have to add an association that points to the Carrier dimension view which will be added as a foreign key relationship to the key field CarrierId.
Right click on the folder Data Definitions > New > Data Definition.
Enter the following values and press Next.
- Name:
ZRAP500_I_Connection_#### - Description:
Dimension for Connections - Referenced Object:
/dmo/connection
- Name:
Select a transport request and press Next.
Select again the template Define a View Entity for Dimension and press Finish.
Add a new field Trip which will later be specified as the text element for the key field
ConnectionId.
`concat(airport_from_id, concat(' -> ', airport_to_id)) as Trip, `
- Add an association
_Carrier
<pre></pre>
association [1] to ZRAP500_I_Carrier_#### as _Carrier on $projection.CarrierId = _Carrier.CarrierId
and expose it in the field list by adding `_Carrier`
- Add the following annotation to the key field
CarrierId
`@ObjectModel.foreignKey.association: '_Carrier' `
Select the field
ConnectionIdfor the annotation@ObjectModel.representativeKeySelect the field
Tripfor the annotation@ObjectModel.text.elementSave and activate the dimension view.
Your final code should look like the following:
```ZRAP500_I_Connection_####
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Dimension for Connections'
@Metadata.ignorePropagatedAnnotations: true
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@ObjectModel.representativeKey: 'ConnectionId'
define view entity ZRAP500_I_CONNECTION_#### as select from /dmo/connection
association [1] to ZRAP500_I_Carrier_#### as _Carrier on $projection.CarrierId = _Carrier.CarrierId{
@ObjectModel.text.element: ['Trip']
@ObjectModel.foreignKey.association: '_Carrier'
key carrier_id as CarrierId,
key connection_id as ConnectionId,
airport_from_id as AirportFromId,
airport_to_id as AirportToId,
concat(airport_from_id, concat('->', airport_to_id)) as Trip,
departure_time as DepartureTime,
arrival_time as ArrivalTime,
distance as Distance,
distance_unit as DistanceUnit,
_Carrier
}
```
Agencies Dimension
The information about the Agencies that perform the bookings is stored in the table /dmo/agencies.
Right click on the folder Data Definitions > New > Data Definition.
Enter the following values and press Next
- Name:
ZRAP500_I_Agency_#### - Description:
Dimension for Agencies - Referenced Object:
/dmo/agency
- Name:
Select a transport request and press Next
Select again the template Define a View Entity for Dimension and press Finish
Remove these fields because they are too long for our analytics scenarios
```
// email_address as EmailAddress,
// web_address as WebAddress
```
Choose the property Name for the annotation @ObjectModel.text.element.
@ObjectModel.text.element: ['Name']
Choose the property
AgencyIdfor the annotation @ObjectModel.representativeKey.@ObjectModel.representativeKey: 'AgencyId'Save and activate the dimension view.
Your final code should look like the following:
```ZRAP500_I_Agency_####
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Dimension for Agency'
@Metadata.ignorePropagatedAnnotations: true
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@ObjectModel.representativeKey: 'AgencyId'
define view entity ZRAP500_I_Agency_#### as select from /dmo/agency {
@ObjectModel.text.element: ['Name']
key agency_id as AgencyId,
name as Name,
street as Street,
postal_code as PostalCode,
city as City,
country_code as CountryCode,
phone_number as PhoneNumber
// ,
// email_address as EmailAddress,
// web_address as WebAddress
}
```
You now have to create an interface view that serves as a data source for the Cube.
Right click on the folder Data Definitions and choose New > New Data Definition from the context menu.
Enter the following values and press Next
- **Name**: `ZRAP500_I_Booking_####`
- **Description**: `Interface View for Booking`
- **Referenced Object**: `/dmo/I_Booking_U`

Select a transport request and press Next.
Do NOT press finish at this point because you need to select a different template in the next step.This time select the template Define a View Entity and then press Finish

new interface Add an annotation
@Semantics.amount.currencyCodeto the property Flight Price that points to the propertyCurrencyCode.@Semantics.amount.currencyCode: 'CurrencyCode'
Add a new field
AgencyId. The value for this field will be retrieved using the association_Travel. That points to the parent entity. This way the fieldAgencyIdcan be used as a dimension field._Travel.AgencyID as AgencyID,

new field Save and activate the interface view.
Your final code should look like the following:
```ZRAP500_I_Booking_####
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Interface View for Booking'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define view entity ZRAP500_I_Booking_#### as select from /DMO/I_Booking_U {
key TravelID,
key BookingID,
BookingDate,
CustomerID,
AirlineID,
ConnectionID,
FlightDate,
@Semantics.amount.currencyCode: 'CurrencyCode'
FlightPrice,
CurrencyCode,
_Travel.AgencyID as AgencyID,
/* Associations */
_BookSupplement,
_Carrier,
_Connection,
_Customer,
_Travel
}
```
The Cube is the analytical interface view that is ultimately used in the query and “holds together” the model. In addition to the facts and the measurable key figures (if necessary also calculations), it contains references to the dimensions.
You will now use the Booking interface view as a data source to create a cube. All cubes must have at least one measure. The measurable data are the quantifiable fields that can be calculated, such as number of flight bookings and price of a flight. Using a query, you can SUM these fields. To create a cube, there is a mandatory header annotation:
@Analytics.dataCategory: #CUBE
This annotation is part of the template Define a View Entity for a Cube that you have imported in your ADT installation at the beginning of this tutorial.
Right click Data Definition and choose New > New Data Definition.
Enter the following values and press Next
- Name:
ZRAP500_I_BookingCube_#### - Description:
Booking Cube - Referenced Object:
ZRAP500_I_BOOKING_####(The booking interface view)

new cube - Name:
Choose a transport request and then choose Define a View Entity for a Cube and click Finish.

template cube Add the following associations
associationsassociation [0..1] to ZRAP500_I_Customer_#### as _Customer on $projection.CustomerID = _Customer.CustomerId association [0..1] to ZRAP500_I_Carrier_#### as _Carrier on $projection.AirlineID = _Carrier.CarrierId association [0..1] to ZRAP500_I_Connection_#### as _Connection on $projection.AirlineID = _Connection.CarrierId and $projection.ConnectionId = _Connection.ConnectionId association [0..1] to ZRAP500_I_AGENCY_#### as _Agency on $projection.AgencyID = _Agency.AgencyIdyou also need to add the following to entries to the field list
_Agency, _Customer._Country as _CustomerCountryIn the created cube you define
foreignKey associatonsvia_Customer,_Carrier,_Connection, and_Agencyto be able to fetch and expose information in the cube and in the query.- Add the annotation
@ObjectModel.foreignKey.association: '_Customer'to the fieldCustomerId - Add the annotation
@ObjectModel.foreignKey.association: '_Carrier'to the fieldAirlineID - Add the annotation
@ObjectModel.foreignKey.association: '_Connection'to the fieldConnectionId - Add the annotation
@ObjectModel.foreignKey.association: '_Agency'to the fieldAgencyID
- Add the annotation
Comment out both lines of annotation
@Semantics.amount.currencyCodeand the property Flight Price.Add the following two fields alongside with a foreign key association
foreignKey@ObjectModel.foreignKey.association: '_CustomerCountry' _Customer.CountryCode as CustomerCountry, _Customer.City as CustomerCity,You add fields that contain information about the customers
customer@ObjectModel.foreignKey.association: '_CustomerCountry' _Customer.CountryCode as CustomerCountry, _Customer.City as CustomerCity, _Connection.Trip as Trip,You now add Measures to our cube.
You add a field
TotalOfBookingstotalOfBooking@EndUserText.label: 'Total of Bookings' @Aggregation.default: #SUM 1 as TotalOfBookings,and the field Flight Price which is annotated as follows
Flight@Semantics.amount.currencyCode: 'CurrencyCode' @Aggregation.default: #MIN FlightPrice,Save and activate the cube.

cube ADT Your final code should be look like following:
ZRAP500_I_BookingCube_####@AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Booking Cube' @Metadata.ignorePropagatedAnnotations: true @Analytics.dataCategory: #CUBE @Analytics.internalName: #LOCAL define view entity ZRAP500_I_BookingCube_#### as select from ZRAP500_I_Booking_#### association [0..1] to ZRAP500_I_Customer_#### as _Customer on $projection.CustomerID = _Customer.CustomerId association [0..1] to ZRAP500_I_Carrier_#### as _Carrier on $projection.AirlineID = _Carrier.CarrierId association [0..1] to ZRAP500_I_Connection_#### as _Connection on $projection.AirlineID = _Connection.CarrierId and $projection.ConnectionId = _Connection.ConnectionId association [0..1] to ZRAP500_I_Agency_#### as _Agency on $projection.AgencyID = _Agency.AgencyId { key TravelID, key BookingID, BookingDate, @ObjectModel.foreignKey.association: '_Customer' CustomerID, @ObjectModel.foreignKey.association: '_Carrier' AirlineID, @ObjectModel.foreignKey.association: '_Connection' ConnectionID as ConnectionId, FlightDate, // @Semantics.amount.currencyCode: 'CurrencyCode' // FlightPrice, CurrencyCode, @ObjectModel.foreignKey.association: '_Agency' AgencyID, @ObjectModel.foreignKey.association: '_CustomerCountry' _Customer.CountryCode as CustomerCountry, _Customer.City as CustomerCity, _Connection.Trip as Trip, /* Measures */ @EndUserText.label: 'Total of Bookings' @Aggregation.default: #SUM 1 as TotalOfBookings, @Semantics.amount.currencyCode: 'CurrencyCode' @Aggregation.default: #SUM FlightPrice, /* Associations */ _Carrier, _Connection, _Customer, _Travel, _Agency, _Customer._Country as _CustomerCountry }
Since a query belongs to the projection layer (formerly known as consumption layer) it must have a C in its name according to the naming convention used in the Virtual Data Model (VDM) used in SAP S/4HANA.
Again you can use a template that you have imported at the beginning of this tutorial.
Right click Data Definition and choose New Data Definition.
Enter the following values and press Next
- **Name**: `ZRAP500_C_BookingQuery_####`
- **Description**: `Query for Booking`
- **Referenced Object**: `ZRAP500_I_BookingCube_####`

Choose a transport request and then press Next.
In the following dialogue choose Define a View Entity for Query and click Finish.

template query Edit the code of your query with removing KEY from
TravelIDandBookingID, add the annotation @AnalyticsDetails.query.axis to all properties except the two measuresFlightPriceandTotalOfBookings. All fields beside the fieldCustomerCountryget the annotation @AnalyticsDetails.query.axis: #ROWS, whereas the fieldCustomerCountrygets the annotation @AnalyticsDetails.query.axis: #COLUMN.You add a currency conversion to the field
FlightPriceto be able to comparison all flight prices in a single currency.Code@Semantics.amount.currencyCode: 'CurrencyCode' currency_conversion ( amount => FlightPrice, source_currency => CurrencyCode, target_currency => cast( 'EUR' as abap.cuky( 5 ) ) , exchange_rate_date => cast ('20200101' as abap.dats), exchange_rate_type => 'M' ) as FlightPriceSave and activate the query.

ADTquery
> With the annotation **@AnalyticsDetails.query.axis:<VALUE>**, the elements of the view can be positioned on multiple axes: Rows, Columns and Free. The elements can be directly annotated with their axis. All measures (elements which can be aggregated) need to be on the same axis. The annotation of the first measure will therefore be used for all measures of the query. If **@AnalyticsDetails.query.axis:<VALUE>** is not found, the system positions the measures on the columns.
- Your final code should look like the following:
```ZRAP500_C_BOOKINGQUERY_####
@EndUserText.label: 'Flights Query'
@AccessControl.authorizationCheck: #NOT_ALLOWED
define transient view entity DEF23_Flights_Query
provider contract analytical_query
as projection on DEF23_Flights_Cube
{
@AnalyticsDetails.query.axis: #ROWS
TravelID,
@AnalyticsDetails.query.axis: #ROWS
BookingID,
@AnalyticsDetails.query.axis: #ROWS
BookingDate,
@AnalyticsDetails.query.axis: #ROWS
CustomerID,
@AnalyticsDetails.query.axis: #ROWS
AirlineID,
@AnalyticsDetails.query.axis: #ROWS
ConnectionId,
@AnalyticsDetails.query.axis: #ROWS
FlightDate,
@AnalyticsDetails.query.axis: #ROWS
CurrencyCode,
@AnalyticsDetails.query.axis: #ROWS
AgencyID,
@AnalyticsDetails.query.axis: #COLUMNS
CustomerCountry,
@AnalyticsDetails.query.axis: #ROWS
CustomerCity,
@AnalyticsDetails.query.axis: #ROWS
Trip,
TotalOfBookings,
@Semantics.amount.currencyCode: 'CurrencyCode'
currency_conversion (
amount => FlightPrice,
source_currency => CurrencyCode,
target_currency => cast( 'EUR' as abap.cuky( 5 ) ) ,
exchange_rate_date => cast ('20200101' as abap.dats),
exchange_rate_type => 'M'
) as FlightPrice
}
```
Similar to the SAP Fiori Elements preview which is offered for OData V2 UI and OData V4 UI service bindings there is now an Analytical Data Preview available. This can be used by the ABAP developer to test the implementation of an Analytical Query since the preview uses the InA protocol.
Now that you have created the query it is possible to use a data preview to test our implementation.
Navigate to the folder Data Definition
Right click on the query
ZRAP500_C_BOOKINGQUERY_####and select Open with > Data Preview
Right Click A new browser tab will open and you might have to authenticate using the credentials of your SAP BTP ABAP environment system.

Authenticate You can see the data that has been retrieved using the InA-Protocol. Please note that the measures are grouped by the Country/Region Key.

Data Preview
You use a service definition to define which data is to be exposed as a business service, using one or more business service bindings.
Right-click your created query in step 6 and choose New Service Definition.

new service definition Enter the following values and press Next.
- **Name**: `ZRAP500_UI_BOOKING_####`
- **Description**: `Booking query service definition`
- check if Exposed Entity is your created query `ZRAP500_C_BOOKINGQUERY_####`

- Select transport request and press Next.
- Select the template Define Service and press Finish.
- After the query is exposed as a service it must be activated by pressing Ctrl+F3
The service binding is used to bind a service definition to a communication protocol and in our case, the protocol that enables web-based data access from ABAP systems is the Information Access (InA) protocol.
- Right click your newly created service definition and choose New Service Binding.

- Enter the following values and press Next
- **Name**: `ZRAP500_UI_BOOKING_####`
- **Description**: `Booking Query Service Binding`
- Choose **InA - UI** as **Binding Type**
- Check that in the field **Service Definition** the service definition `ZRAP500_UI_BOOKING_####` is listed that you have created service definition in last step

- Choose a transport request and click Finish.
- Activate your service binding.
- After activation, the external service name for your query is displayed.

>The analytical query will be displayed with the external service name in SAP Analytics Cloud as the data source.
Right-click your package, choose New > Other ABAP Repository Object.

New Search for IAM App under Cloud Identity and Access Management. Click Next.

New Enter the following values and press Next
- **Name**: `ZRAP500_BOOKING_####`
- **Description**: `IAM App for Booking Query`
- choose **EXT-External App** as **Application Type**

- Choose a transport request and click Finish.
Your created IAM App name will get an EXT automatically in his name like:
RAP500_BOOKING_####_EXT.

- Go to the Services tab and click on insert button.

- Select Service Type as
InA - UIand your Service Name which is your service binding nameZRAP500_UI_BOOKING_####. Click OK.

- Save and Publish Locally.

Right-click Cloud Identity and Access Management in your package, choose New > Business Catalog.

business catalog Enter a Name and Description and click Next.

next Choose a transport request and click Finish.
To create a Business Catalog App Assignment, in your created Business Catalog click Apps, click Add, assign your previously created external IAM app as IAM App. Enter a Name and Description and click Next.

IAM App 
IAM App Choose a transport request and click Finish. The Business Catalog App Assignment will be opened.
Back to the Business Catalog, choose your Assignment ID and click Publish Locally.

publish
Login to the Fiori launchpad and open Maintain Business Roles App under Identity and Access Management.

maintain business roles Navigate to the
SAP_BR_DeveloperRole, select Assign Business Catalogs and click Edit.
Assign Business Catalogs 
Add Business Catalog Click Add and find your business catalog in the popup and click OK to add the business catalog.

Add 
select Check in the Assigned Business Catalogs, if your business catalog is added in the list. Click Save.

save
Back to the main page of Fiori launchpad and open Communication Systems App under Communication Management.

Communication Systems Click New to create a new communication system. Enter System ID and System Name, click Create.

new communication system 
edit communication system The new communication system will be opened. Switch Destination Service to OFF and now enter you SAP Analytics Cloud host name (ex:
###.cloud.sap) as Host Name and443as Port. Click Save.
edit communication system Back to the Communication Management and open Communication Arrangements to create a new one.

communication arrangement Click New and select
SAP_COM_0065as Scenario.Enter a name for your communication arrangement and click Create.
create The new communication arrangement will be opened. Choose the communication system which you created previously in the Communication System field. Provide the Tenant ID of your SAP Analytics Cloud tenant.

tenant
> **Tenant ID** can be found under the main menu of the SAP Analytics Cloud tenant, click **System** > **About** > **System Name**.
Under the Outbound Services, the service status for UI Link Navigation should be checked as Active and Retrieve Stories should be unchecked, click Save.

Outbound
Login to the SAP Analytics Cloud tenant.

Login Open the main menu and click Connection and on the Connection Window click Add. In the popup under Connect to Live Data click SAP S/4 HANA.

add connection 
connection In the New S/4 HANA Live Connection dialog enter Name and Description, Connection Type has to be Direct, for Host copy your Fiori launchpad link like
###.abap-web.stagingaws.hanavlab.ondemand.com. Enter443in HTTPS Port field, and100for Client. As Authentication Method choose SAML Single Sign-on (Standard Compliant). Click OK.
new connection check the result.

result
Models transform your raw data into useful information that can then be used to create dynamic visualizations. Since you will use the unique feature Live Data Connection SAP Analytics cloud will create the model based on the analytical query that you have created and published in the previous exercise. Based on such a model you can perform online analysis without the need of data replication.
Expand navigation bar.

navigation bar Choose Modeler and click Live Data Model

live data In the popup choose SAP BW for System Type

system type Choose your created connection in the last step as Connection and login with your username and password in the second popup.

connection Select your created Query in the last exercise as Data Source.

data source Click OK to continue.

ok button In the model you can check all Dimensions and Measures.

measures 
dimensions Save the new model and enter the following values and click OK:
- Name:
ZRAP500_#### - Description:
Model ####

save - Name:
Check your model in the Modeler page.

modeler
A story is a presentation-style document that uses various elements such as charts, images or tables to visualize your data. Adding a chart starts with picking a chart type. Then you select your model and add measures and dimension and start on working how the data is displayed. Here you will create a story including a chart, a table and a Donut chart.
Open a blank dashboard
Expand navigation bar and click Stories.

stories Choose Dashboard as your template.

template A Blank Dashboard will be opened.

blank Enter a Dashboard Title like
RAP500_####.Now you can insert some charts or tables and use the model you created before based on your analytical query.
Insert Chart
To insert a chart, click on the chart icon in the task menu and select your model with double clicking your model.

insert chart You can move the chart with click and drag around the page.

move chart After you found a place for your chart, you need to add some measures and dimensions, which should be shown on the chart. You will find all settings on the right hand side under Builder.

Builder Open + Add Measure and choose Flight Price. You will see the sum of all flight prices that have been booked on the chart.

measure Open + Add Dimension and choose Country/Region Key. Now there is a chart which shows how the flight costs are distributed in different countries your customers live in.

dimension
Insert Table
- To insert a table, click on the table icon. A Table will be created and all dimensions and measures will be displayed. You can move the table, make it bigger. You can change dimensions and measures under Builder.

In the table you can find all data from your query, what you choose as ROWS or COLUMNS. You have just one dimension CustomerCountry in columns and all other dimensions are in rows.

Insert Donut Chart
Insert another chart and choose Donut under Builder > Chart Structure.

donut Choose Flight Price under + Add Measure and choose Airline ID under + Add Dimension.
You now have a visualization how the booking costs are distributed in different airlines.

measure 
chart donut
Save the Story
You are almost done with your story, you need just to save the story. Click on save icon and choose Save.

save Enter following values and click OK
- Name:
RAP500_####_Story - Description:
Story ###

story - Name:
You will find your new created story under Welcome to Stories

You have used the preconfigured connection of the SAP Analytics Cloud instance to connect to the SAP BTP ABAP environment system where you have developed an Analytical Query. The data was retrieved using a Live Data Connection so that any change in the data was immediately reflected in the visualization of your query in SAP Analytics Cloud.
You can create more different and complicated analytics charts and tables with your query. Here there is some more examples.
Click the chart icon in the task menu, click Correlation and choose Scatter plot.

correlation Choose Flight Price and Total of Booking as X and Y axis and Customer ID as dimension. You can choose Country/Region Key as Color dimension to have different colors for each country in this chart, you can make the chart bigger or move it around your dashboard too.

chart Click again chart icon in the task menu, click Distribution and choose Tree Map.

Distribution Choose Total of Booking as Size under Measures, TRIP as Label under Dimensions. You can change the title of the chart with double clicking the title or choose an other color for this chart.

trip Do not forget to save your story.

save
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.