Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 

Welcome back! In previous installments, Shekhar showed us how to install and
configure PAi, Orla showed us how to set up Predictive Factory with PAi,
and taught us how we can create our own Predictive Scenarios.
Paul introduced us to the process of Predictive Modeling, and gave us a deep-dive
about defining the target variable. By now you're probably thinking "Okay, I can create
a Predictive Scenario. Now what?".

Once you have a predictive scenario, what can you do with it? You could
integrate the scenario into an existing business process to give decision-makers
better information so they can make better decisions. You could even take action
directly, and completely automate a business process. This
is where the real power of PAi lies: automating business processes.

Of course, that requires some development effort (but not much!). Is there anything
I can do without writing ANY code?
It turns out, yes! It's possible to create a beautiful, predictive Fiori
dashboard application without writing ANY code. And I'm going to show you how.

Before we start

We'll assume you have created a PAi Predictive Scenario, trained a model, and
activated it.
We'll also assume you have access to the Custom CDS Views Fiori Application, and
to an instance of SAP WebIDE.


Step 1 - Gather information

First of all, there's some information we need from our predictive scenario.
To find it, navigate to your Fiori Launchpad and click on the Predictive Scenarios
tile. Then find your predictive scenario, and click on it.

Here you can see some information about the predictive scenario. I've highlighted
where to find the Apply Dataset and the Apply View. Take a note of these, because
we're going to need them later. You'll also need to note the key columns from the Inputs tab.


Step 2 - Create expanded CDS view.

In this step we're going to create a new CDS view, which combines the predictions
with the rest of the data. This will give us all the data we need to build our
dashboard later.

In your Fiori Launchpad, open the Custom CDS Views app. You'll be greeted with
this screen. You can use the search bar to find your Apply View, then click on it
to highlight it. To create a new view based on your Apply View click on the Create button.


Next we'll give our new view a sensible name, and a label (1). Then we'll mark it
as an External API (2). This just means that an OData service will be created when we publish the view. And then we'll add the Apply View by clicking on Add => Add Associated Data Source (3).


On this screen we're going to find our Apply Dataset, and add it to our new view.
Use the search bar to find the Apply Dataset we noted in step 1. Click on it (1),
and then click Add (2).


Now that we've added the Apply Dataset as an associated data source, we need to define
the association between the Apply View and the Apply Dataset. That is, we need to
specify how to join our views together. To do this, click on the broken link icon next to the Apply Dataset.


Here we're going to want to add a Condition for each key field we noted in step 1, like the one I have below. Once you've got an association for each key field, press OK.


Now that we've defined how our views relate to each other, we're going to
decide which columns we want to see in our Fiori app. To do this, we're going
to go to the Field Selection tab (1). Then in the panel on the left, make sure any
columns you want to see are selected in the Select column. At minimum, you'll
want the fields from the Apply View, which I've highlighted (2). However, feel free to add
more! Once you're happy with your selections, take a minute to ensure that everything's
correct. When you're sure, click the Publish button to finalize your new view (3).
This will automatically generate an OData service, which we can use to power the
Fiori app.


Step 3 - Create Fiori App

Now that we have an OData service providing the data that we want, we can use it
create a Fiori app. To start, go to WebIDE. On the homepage, we're going to
select "New Project from Template".


Next, we'll choose which template to use. I think the List Report template (1) is
the best bet, but feel free to try out the others. Once you've chosen your template,
click Next (2).


Now we'll give our app a sensible name, title, and application component hierarchy.
(For now you can give a dummy value for that). Then click Next again.


So, we've chosen our template, and given our app a name. Now we can select the OData
service that was generated with our view. Make sure you have "Service Catalog"
selected in the Sources list. In the dropdown, select the system where you created the view.

Use the search bar to find the view we created in the list (1). Then press Next.


Here we're going to choose the OData collection. In some OData services there may
be more than one collection, but for ours there's only one. Just select it in
the dropdown (1), and click Finish (2).

Now you have a WebIDE project with your new Fiori app. Let's start it up and
have a look.


Step 4 - Preview the Fiori application

First click the Preview button.


You might be asked to choose a file to run. We want to see our predictive data,
so choose flpSandbox.html (1) and press OK (2).


You should be given a (fake) Fiori Launchpad, with your tile on it. Click on your



And there it is! You should see a table of data, including the predicted field from
your Apply View. Congratulations, you just created a predictive Fiori app!


Wow, that was easy! We started with a PAi predictive scenario. We created a new CDS view to join our predictions with more explanatory data. We generated an OData service from our new view. Finally we used the OData service to generate a Fiori application. And all without writing any code!

From here you could customize your Fiori app to better suit your usecase, and publish it to the Fiori Launchpad to make it available to others.