Skip to main content
SAP Fiori

Introduction to FIORI tools – Part 2

UK Utkarsh Kanade, A technology enthusiast, Utkarsh has over 14 years 5 min read

This blog is the second part of a series of four blogs to introduce Fiori tools. For Part 1, start HERE.

In this blog, we will focus on the guided development feature of Fiori Tools.

Guided development, the big picture

Before we get into the specifics, let us figure out the rationale behind SAP coming up with guided development feature. For Fiori Elements apps, we are aware that there is some scope of customization. E.g., adding custom actions to list reports, setting table type, configuring list report/object page features, configuring card properties etc.

In order to implement these enhancements, we can either memorize the annotations and configurations, or we can refer to the SAP documentation (reference link below) to see the syntax and then copy-paste it at the right location. This is time consuming!

Reference-

https://sapui5.hana.ondemand.com/sdk/#/topic/7f844f1021cd4791b8f7408eac7c1cec

I always wondered if SAP would provide a wizard-based solution which will allow developers to choose what needs to be done and then also insert the code snippet at the desired location.

As an example, a developer might want to add a new column to the list report table. Wouldn’t it be awesome if the wizard within Fiori tools allows us to choose an option to add a new column? The wizard should then ask information like the entity type and property related to the column to be added. Furthermore, it should also insert the code snippet at the right place, in this case local annotation file.

Trust me, SAP is listening to developers and customers!

This is exactly what guided development does.

Examples

We will continue with the list report page app that we configured in the first blog.

Let’s revisit the architecture of Fiori elements app –

Fiori elements app lifecycle: start with a generated app, configure, enhance with annotations, extend with SAPUI5 code

We will explore steps 2 and 3 and will see how guided development will help us to configure and enhance the apps.

For list Report page – We will work on below three enhancements using guided development

List report app marked with the three planned changes: Supplier column, Supplier filter, Supplier Details button

Prerequisites – All steps in blog 1 are completed

https://mindsetstg.wpengine.com/introduction-to-fiori-tools-part-1/

Example 1 – Add a new column “Supplier” before Products column

Step 1- Open the guided development

Option 1 is to right click on any node below the Project node and select Open guided development tool as shown below

VS Code project context menu with SAP Fiori tools - Open Guided Development selected

Option 2 – Go to the command palette and type Fiori: Open Guided Development

VS Code View menu with Command Palette highlighted

VS Code command palette showing Fiori: Open Guided Development

We should see the below screen-

Guided Development tab listing List Report Page guides in VS Code

Step 2 – Select “Add a new column to a table option”.

Tip – If you cannot spot it, search it using the search option in the tool bar –

Guided Development toolbar with the Search guides box highlighted

Also pay attention to the options like Group by and View which provide different perspectives of viewing the guided development options. They are extremely useful!

Guided Development guide list with Add a new column to a table highlighted

Step 3:

Follow the guide by clicking on Start Guide.

About tab of the Add a new column to a table guide with the Start Guide button

Step 4:

Provide the Entity Type “SEPMRA_C_PD_ProductType” and Property “Supplier”

Step 1 of Add a new column to a table with entity type SEPMRA_C_PD_ProductType and property Supplier

Step 5:

Please observe the code auto generated by the wizard. Now click on the “Insert Snippet” button

Generated UI.LineItem annotation snippet with the Insert Snippet button

Step 6:

Check the inserted code in annotation.xml file. This is the local annotation file and from hereon, these annotations will be given preference over the annotations defined for line items in CDS view

annotation.xml with the inserted UI.LineItem records, including the Supplier record

Step 7:

Check the output. Supplier field appears at the end, which is great, but we want it to appear before Product column. So, in the next step let us reorder it using the guided development.

Product list report preview with Supplier shown at the end of each row

Step 8:

First, select “Reorder columns in a table” from the list of options.

Guided Development list with Reorder columns in a table selected

Step 9:

Secondly, start the guide by clicking on “Start Guide”

About tab of the Reorder columns in a table guide with the Start Guide button

Step 10:

The guide clearly explains that the annotation “UI.LineItem” from annotation.xml is to be amended. We need to copy the record for Supplier and paste it before the record for Products

Reorder columns guide Step 1 explaining how to move a UI.DataField record in annotation.xml

Step 11:

Go to the annotation.xml file and copy the record for supplier and paste it before the Product record

Copying the Supplier UI.DataField record in annotation.xml

Step 12:

Test the output. Supplier appears before Product

Product list report with the Supplier column now before Product

Example 2 – Add a new filter “Supplier”

Step 1 – Select the option “Add a new filter field to the Filter Bar”

Guided Development list with Add a new filter field to the Filter Bar selected

Step 2 – Click on Start Guide. Observe how the Sample Preview shows where the filter is added.

About tab of Add a new filter field to the Filter Bar with a sample preview

Step 3 – Select the Entity type “SEPMRA_C_PD_ProductType” and property “Supplier”

Filter field guide Step 1 with entity type SEPMRA_C_PD_ProductType and property Supplier

Step 4 – Insert the code snippet auto generated by the guided development by clicking on “Insert Snippet”

Generated UI.SelectionFields snippet adding Supplier, with Insert Snippet button

Observe that the code snippet was added to the annotation.xml file automatically

annotation.xml showing the UI.SelectionFields annotation with Supplier added

Step 5 – Test the output

List report with the new Supplier filter open, showing supplier values

Example 3 – Add a custom action called “Supplier Details”

Step 1 – Select “Add a custom action to a page” and then click on the start guide button

About tab of the Add a custom action to a page using extensions guide

Step 2 – Select the Page type as “List Report Page” and the Function name of your choice, e.g. “supplierDetails”. Now click on “Insert Snippet”

Custom action guide Step 1 with List Report Page and function name supplierDetails

Step 3 – Observe the new controller automatically created and also observe the code generated in the controller

Generated ListReportExt.controller.js with the supplierDetails function

Step 4 – Click on “Next” to go to Step 2 of guide. Here, provide the entity set which is “SEPMRA_C_PD_Product” in our case. Also provide the below details –

  • Action ID – suppplierDetails
  • Button Text – Supplier Details
  • Row Selection – No

Observe the auto generated code snippet  –

Custom action guide Step 2 showing the generated manifest.json extension snippet

Click on “Insert Snippet”

Once done, observe the changes highlighted in manifest.json file

manifest.json with the inserted controller extension and supplierDetails action

Step 5 – Test the application to see the new action

List report showing the Supplier Details button and its custom action alert

Congratulations! Completed! What next?

Coming soon: Part 3 – Exploring the service modeler

Share