Sub topic 10
Analytical apps in SAP Fiori: KPI tiles and report apps
This chapter assumes you have read the earlier chapters on analytical query views and CDS access control. You should be able to read a query view with @Analytics.query: true, and you should know that a DCL role restricts rows at read time. You also need basic Fiori launchpad navigation. Menu names, app names and available tile types vary by release, so check them against your system's documentation.
Where analytical apps sit in the stack
An analytical query view holds the logic: which measure, which dimensions, which filters. It does not show anything to a user. A Fiori analytical app is the front end that calls the query through an OData service and draws the result.
Two kinds of app matter here:
- KPI tiles show one number, often with a trend arrow and a color. A tile sits on a launchpad page or space and answers a single question, such as "How much did we invoice this month?"
- Report apps let a user open the same data as a table or chart, filter it, drill into dimensions, and navigate to other apps.
Both read the same query. The tile is the entry point, and a click on it usually opens a report app on the same data.
Making the query available to apps
A query view is not reachable from a browser until it is exposed as a service. In current view-entity based development you do this with a service definition and a service binding.
First, extend the query from the previous chapter. This version adds a filter annotation and the consumption view type, so apps know which fields they can filter on:
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Net amount by customer'
@Analytics.query: true
@VDM.viewType: #CONSUMPTION
define view entity ZC_NetAmountByCustomer
as select from ZI_SalesItemCube
{
@AnalyticsDetails.query.axis: #ROWS
@Consumption.filter: { selectionType: #SINGLE, multipleSelections: true, mandatory: false }
CustomerId,
@AnalyticsDetails.query.axis: #COLUMNS
NetAmount
}Then add a service definition that exposes it:
@EndUserText.label: 'Net amount service'
define service ZUI_NETAMOUNT_SD {
expose ZC_NetAmountByCustomer;
}Finally, create a service binding for this definition in ABAP Development Tools (ADT). Choose the binding type your release documents for analytical consumption, then activate it and publish the local service endpoint. After publishing, the service appears in the service catalog of the gateway, and apps can reference it by name.
Some older systems use the @OData.publish: true annotation on DDIC-based views for the same purpose. That annotation is not available on view entities, so new development uses the definition and binding approach.
The consumption annotations matter more than they look. Smart Business and the report apps read them to decide which fields appear as filters. A field with no filter annotation is often not offered as a filter at all.
KPI tiles with Smart Business
SAP Smart Business is the framework behind most KPI tiles on the launchpad. Key users build tiles in the KPI modeling app (listed in the launchpad as an app for managing KPIs and reports). The model has three levels.
- KPI. The definition of the number: which query and which measure, plus the aggregation and any fixed filters. A KPI can also hold a currency or unit and a time-based dimension for trends.
- Evaluation. The KPI plus its judgment rules: what counts as good or bad, whether higher is better, and which target value applies. One KPI can have several evaluations for different audiences or thresholds.
- Tile. The visual instance of an evaluation. You add it to a launchpad catalog or page and assign it to users.
Thresholds and improvement direction
An evaluation needs an improvement direction, and it decides how thresholds are read:
- Maximize. Higher is better. Values below the warning and critical thresholds turn the tile yellow or red.
- Minimize. Lower is better, for example overdue invoices. Values above the thresholds turn yellow or red.
- Target. The value should stay near a target, and deviation in either direction is bad.
A wrong direction is a common reason for a tile that shows red when the business is doing well. Check it before you check the data.
Tile types
| Tile type | Shows | Use it for |
|---|---|---|
| Numeric | One value with a unit and a status color | Headline figures such as open orders |
| Trend | Value plus an arrow comparing to a previous period | Monthly revenue against last month |
| Comparison | Several bars against a target | Regions or products side by side |
| Deviation | Value as a difference from target | Plan versus actual |
| Chart tiles | A small line or column chart | Short time series |
Available types depend on the release and on what the query can supply. A tile that needs a time series requires a time dimension in the query, so a trend tile on a query with no date field cannot be built.
Fixed filters and tile numbers
A tile shows one aggregate, so the query behind it must be able to produce that aggregate without any user input. Check these points when a tile number looks wrong:
- Mandatory filters or parameters must have defaults in the KPI definition. Without a default the tile cannot load.
- Fixed filters in the KPI apply to the tile only. When the user opens the report app, the same filters usually carry over, and users sometimes mistake this for missing data.
- Currency amounts need a single currency. If the query returns mixed currencies, the tile cannot show one sum and may display a placeholder. Filter to one currency in the KPI, or convert in the cube.
Report apps
When a user clicks a tile, or opens an app directly from the launchpad, they get a report app. There are three common patterns.
Drill-down report from Smart Business
Every Smart Business evaluation can open a generic drill-down view. It shows the measure by a chosen dimension, as a table or chart. The user can add filters, change the dimension, and save views. The dimensions on offer come from the query's rows and filterable fields. The view therefore depends on the consumption annotations discussed earlier.
Query browsing apps
Many systems include a browsing app (often named for the query or view browser) in which a key user finds any published query, runs it in a generic grid, and pivots rows and columns. This is useful when you test a new query. It also shows what the service delivers before you build a tile.
Fiori elements analytical list page
The analytical list page (ALP) pairs a chart with a table and a filter bar, and the two stay in sync. It uses the Fiori elements framework and needs UI annotations such as @UI.chart, @UI.selectionVariant and @UI.presentationVariant, usually in a metadata extension on the query. It suits cases where users filter with a chart interaction.
| Pattern | Built by | Best for |
|---|---|---|
| Smart Business drill-down | Key user, from an evaluation | Quick exploration of a KPI |
| Query browser | Delivered app | Testing and ad-hoc pivoting |
| Analytical list page | Developer, with UI annotations | Curated report with chart and table |
Any of these can link to other apps. Navigation uses a semantic object and action, such as a customer or a sales order. The query needs to expose the field that identifies the target object. Without it, the user can see numbers but cannot jump to the underlying document.
Authorizations and launchpad access
Two separate checks apply, and mixing them up is the main source of "it works for me" problems.
- Launchpad access controls whether the tile or app appears. It comes from the business catalog and the roles assigned to the user. In newer launchpads, spaces and pages come from the same roles.
- Data access controls which rows the query returns. It comes from the DCL role on the cube, dimensions or query.
A user can see a tile with no data access and get a zero or an authorization error. A user can also have full data access and see no tile, because the catalog is missing. The service itself needs a start authorization too, so the user's role must include the published service.
Because the query runs as the signed-in user, two people on the same tile may see different numbers. This is correct. Say so in the tile's description so that colleagues do not report it as an error.
Common errors
| Symptom | Likely cause | Check |
|---|---|---|
| Tile shows no value or a gray state | Query needs a mandatory filter with no default | KPI definition, filter defaults |
| Tile red although performance is good | Wrong improvement direction | Evaluation settings |
| Tile missing for a user | Catalog or role not assigned | Role and catalog assignment |
| Tile loads, then "not authorized" | Service not in the role, or DCL denies all rows | Service authorization, DCL trace |
| Filter missing in drill-down | No consumption filter annotation | Query annotations |
| Mixed-currency total absent | Several currencies in the result | Filter one currency or convert in the cube |
| Change in the query not visible | Service metadata cache | Clear the gateway cache, reload the app |
A working checklist
- Confirm the query returns correct numbers for a test user in the query browser.
- Expose the query through a service definition and binding, then publish it.
- Add the service to the roles that need it, and check the DCL for those users.
- Create the KPI with its measure, fixed filters and defaults.
- Create the evaluation and set the improvement direction and thresholds.
- Create the tile and add it to a catalog, then to a page or space.
- Assign the role and test with a user who has restricted data access.
Exercise
A tile for "Overdue invoices" shows red for a month in which overdue invoices fell sharply. The query numbers are correct. What is the most likely cause, and where do you fix it?
Show answer
The improvement direction is set to Maximize, so the lower value counts as worse than the thresholds. Open the evaluation in the KPI modeling app and set the direction to Minimize. Then check that the warning and critical thresholds sit above the target value.
Exercise
Two sales managers open the same "Net amount" tile and see different numbers. Both have the tile in their catalog. Is this a defect? Which object explains the difference?
Show answer
It is not a defect. The query runs as the signed-in user, and the DCL role on the cube or query limits each manager to their permitted rows, for example their own sales organization. Compare the two users' access control roles to confirm.
Exercise
You add a new field to the query and set its filter annotation, but the drill-down view still offers no filter for it. Name two things to check.
Show answer
First, check that the service was regenerated or republished, and clear the gateway metadata cache so the app reads the new metadata. Second, check that the field is exposed by the service and carries a consumption filter annotation. Also check that any KPI-level setting does not hide it.