Skip to main content
SAP BTP

Analytical List Page with the help of HANA Studio and Business Application Studio

AR Abhishek Rai, Abhishek Kumar Rai is a SAP UI5/FIORI Developer at Mindset Consulting, India 4 min read

In continuation of my previous blog, today, I will discuss ‘How to create an Analytical List Page using SAP Fiori -> ALP template and CDS views/annotations. The CDS views/annotation and the Fiori app are created in HANA Studio and Business Application Studio, respectively.

What is the Fiori Element Analytical List Page?

The ‘Analytical List Page’ is a unique template for visualizing transactional data with analytical charts. It is one of the powerful templates from which we can create an analytical dashboard with the help of graphs, KPIs, filters, visual filters, etc. Additionally, we can create an Object Page using this template.

Material Price Variance analytical list page with filter bar, grouped bar chart by month and a purchase order table

The Analytical Page has 3 sections:

1. Title: Page Title contains Variant Management and KPI Tags.

Page title with the Standard variant selector and an AMR 0.3 % KPI tag

2. Header: Page Header contains Compact Filters and Visual Filters along with adapt filters and Go button.

ALP header with compact filter fields above visual filters for revenue by year, customer, product and category

3. Content: Page Content contains Charts and Table (different kinds of views are available)

ALP content area with a Material Price Variance bar chart above a table of purchase orders and invoices

Let’s continue with the steps to create the ‘Analytical List Page.’

Creating CDS Views:

Prerequisite: Go through my previous blog for HANA Studio configurations; we also need SAP Business Application Studio; now, we are ready to create CDS views and ALP Fiori App.

1. Open HANA Studio > Logon to your S4 System > Right-click on $TMP package > New > Select Other ABAP Repository.

Eclipse context menu on the local package, New submenu open with Other ABAP Repository Object highlighted

2. Select ‘Data Definition’ under ‘Core Data Services and click on Next.’

New ABAP Repository Object dialog filtered on core, with Data Definition selected under Core Data Services

3. Provide ‘Name’ and ‘Description’ and click on Next.

New Data Definition dialog with name zi_salesorder, description Sales Order CDS and package $TMP

4. Select ‘Define View’ and select ‘Finish’.

New Data Definition templates list with Define View selected and the template code preview below

5. Below is the basic CDS structure. We will add the SQL View name in the first line and add some elements along with the data source—press cmd+S to save the CDS view.

Generated CDS view template for zi_salesorder in the Eclipse editor with an empty sqlViewName

CDS view editor with the SQL view name ZI_VIEW_SO added in the first line

zi_salesorder CDS view selecting key vbeln and header fields from table vbak

6. Create another CDS view in a similar manner.

Second CDS view zi_salesorderitem selecting item fields from table vbap, SQL view ZI_VIEW_SO_ITEM

7. Now, create an association between these two CDS views to read related data of the Sales Order Items CDS view from the Sales Order CDS View. This will help drill down to Object Page navigation from the Main Page. Additionally, we will add the below lines in respective CDS views, save, and Activate both together.

zi_salesorder CDS view with an association [1..*] to zi_salesorderitem exposed as _SALESORDERITEMS

zi_salesorderitem CDS view with an association line added to zi_salesorder

8. The association is created between both the CDS views. Now we will right-click on the created Data definitions and run it as an ABAP project. Further, this is the Data Preview.

Exposing CDS View as an OData Service:

1. Open ‘ZI_SALESORDER’ CDS view and add ‘@OData.publish : true’ define view as below:

zi_salesorder CDS view in Eclipse with the @OData.publish : true annotation highlighted

2. Save and activate the view.

3. Now, open the SAP logon system and go to T-Code “/N/IWFND/MAINT_SERVICE”

4. Click on “Add Service” and find the CDS View Service here which we just created.

Activate and Maintain Services screen in SAP GUI with the Add Service button highlighted

5. Tick the ‘Co-Deployed’ checkbox and enter the service initials and Click on ‘Get Services’. We will be able to see the CDS view name which we created ending with ..CDS. Select and click on ‘Add Selected Services’.

Add Service filter with technical name ZI_SALES*, Co-Deployed checked and ZI_SALESORDER_CDS in the results

6. A new dialog will open, select ‘Local Object’ and proceed further’.

Add Service dialog for ZI_SALESORDER_CDS with package $TMP and the Local Object button highlighted

7. After this step, we will see the below message. It means our OData Service ‘ZI_SALESORDER_CDS’ is created and active now.

Information popup: service ZI_SALESORDER_CDS was created and its metadata was loaded successfully

Creating an Analytical List Page using SAP BAS:

1. Open SAP BAS – Dev Space and Select ‘New Project from Template’ > Select ‘SAP Fiori application’ card > click on ‘Start’.

SAP Business Application Studio Get Started page with New Project from Template highlighted

New Project From Template wizard with the SAP Fiori application card and Start button highlighted

2. Select the ‘Analytical List Page’ template and Click on Next.

SAP Fiori application template list with Analytical List Page selected and Next highlighted

3. In the next page, we will configure Data Source and select the service which we registered above. Click on ‘Next’.

Data Source and Service Selection step with service ZI_SALESORDER_CDS (1) - OData V2, credentials blacked out

4. Next we will select the entity set as below and click on Next.

Entity Selection step with main entity zi_salesorder, navigation entity to_SALESORDERITEMS, table type Analytical

5. Now, provide the below ‘Project attributes’ for the application and click on ‘Finish’.

Project Attributes step with module salesorder_alp, title Sales Order Analytical List Page, namespace com.demo

6. Here is the application generated with all the information.

Application Information page for the generated salesorder_alp project in Business Application Studio

7. Preview the application > Right click on the application’s ‘webapp’ folder and select ‘Preview Application’. The application will look like below since we don’t have any annotations for the table, filters, and charts. We will add annotations in the following steps.

Preview of the generated app with an empty chart area and a table with no visible columns

8. After this, we will add some UI annotations in order to load the filters and the table by default like @UI.selectionField, @UI.lineItem etc. as below and re-run the Fiori app.

zi_salesorder CDS view with @UI.selectionField, @UI.lineItem and other UI annotations on each field

The screen will look like this:

App preview with Sales Document, Created On, Created By and Sales Organization filters and a sales order table

9. Now, write some annotations for adding the charts and graphs to the application.

CDS annotations for @UI.chart, @UI.presentationVariant and @UI.selectionVariant in the zi_salesorder view

10. Since we have used ‘ChartDefault’ as qualifier in annotation of the Chart, we will add [ “qualifier” : “Default” ] in the Manifest’s Analytical List Page Setting.

manifest.json Analytical List Page settings with the qualifier : Default line highlighted

11. Now reload the Fiori application. We can switch the chart type with the help of the highlighted button below.

Finished ALP with a donut chart of net values above the sales order table, chart type button highlighted

Finished ALP with a bar chart of counter by net value above the sales order table

This is how the basic Analytical List Page looks. And this is how we create a basic ALP.

In conclusion, we have successfully built a basic Analytical List Page in this blog. I hope this helps you create an SAP Fiori Element ALP. Happy Learning!

Visit our blog library here.

View our LinkedIn, here.

Share