Skip to Content
Technical Articles
Author's profile photo Orla Cullen

PAi Blog Series 5: Create new Predictive Scenarios with SAP Predictive Analytics

Welcome to the fifth installment of the PAi – S/4HANA Blog series. By now you should have PAi installed and working in your S/4HANA application. You should also have been running our out of the box predictive scenarios. Also, you have been inspired by Paul’s blog last week to start creating your own predictive scenarios.

Firstly, I would like to introduce SAP Predictive Analytics, which has been around for some time. SAP Predictive Analytics is a statistical analysis, data mining, and predictive analytics solution, which enables you to build predictive models to make accurate predictions about future events.

Predictive Analytics allows you to automate the entire predictive modeling process with self-services designed to give you a broad set of reusable analytical records to model datasets instantly.

For more information, my colleagues have created some wonderful blogs, which will enable you to install, get access to our trial version, and finally walk through model examples using Predictive Analytics.

SAP Predictive Analytics 3.3 enables you to create new predictive scenarios. You can then publish these predictive scenarios to PAi and embed them within your S/4HANA application. In this blog I am going to focus on the steps you need to follow to publish a predictive scenario to PAi.


Getting Started:

Above we have given links on how to install and run SAP Predictive Analytics. For this week’s blog we will assume you already have SAP Predictive Analytics up and running in your environment. To avail of the Publish to PAi feature you must have version 3.3 or higher, and have SAP S/4HANA version 1709 EHP1 or higher.

Note Publishing from SAP Predictive Analytics to S/4HANA is available for On Premise only. In the coming weeks we will show S/4HANA Cloud customers how they can do this with SAP Analytics Cloud – Smart Predict.

The first thing you will need to do is connect Predictive Analytics to your S/4HANA application. Connections must be made on both the SAP HANA level, and SAP NetWeaver level.

1)   Create ODBC connection to SAP HANA:

To add SAP HANA as a data source, we must create an ODBC connection to the underlying SAP HANA from your S/4HANA application.



  1. Go to Search Windows, and type ODBC. Choose ODBC Data Sources (64-bit).


  1. Select dBASE Files, and select Add.

  1. Select HDBODBC, and select Finish.



  1. Add SAP HANA system details:

  1. Select OK, and add your SAP HANA credentials:

  1. Select OK.


2) Add SAP HANA as a data source

Now we are going to add SAP HANA as a data source in SAP Predictive Analytics, so we can use it for modeling.

  • Launch SAP Predictive Factory

  • Select the Tab “Modeling Servers”, and select the relevant Automated Server

*Note you will need the Administrator Role to do this.

  • Select Edit, and scroll down to the Data Connections section


  • Select   to add a new connection.Enter name,description, and select a data source name.

  • From the Data Providers list select Database.

  • You will see a list of ODBC database connections. Select the SAP HANA system you created earlier.


  • Enter your SAP HANA credentials, and select “OK”, and save.



3) Add S/4HANA as a PAi Application

To send new predictive scenarios to our S/4HANA, we must create a connection to the PAi Repository within S/4HANA.

  • Go to the “PAi Applications” tab, select , and choose PAi ABAP Application.

  • Enter the name and description of your S/4HANA system.

In the connection section:

Application Type: “On Premise Application”

PAi Application URL: This is the ANA_PAI_PF_SRV you configured in Blog 2

Client: Client of your S/4HANA application

Access Policy: Select Private if you wish each user to have to enter their S/4HANA credentials when publishing a new predictive scenario (recommended). Select shared if you want to store central credentials for use by all users.


  • Select “Test Connection”, and enter your S/4HANA user name and password. Once successful, select OK, and Save.

Here is also a short youtube video that goes through the steps.


4) Create a new Project

We are now ready to start our modeling activities. We will create a project, and ensure the relevant connections to S/4HANA are assigned.

  1. Select the Projects tab, and select new project.

  1. Give the project a name, and assign users.

  1. Add your Modeling Server, and the Data Connection to SAP HANA you created earlier.

4.Add the PAi Application you created to your S/4HANA application, and save.

  1. You are now ready to start modeling.

5) Publish to PAi

Now that you have completed your data science experiments, and are happy that you have a good model that you want to use in your S/4HANA application, we can now Publish it to PAi.

  1. Within your project, select the Model Version you wish to Publish to PAi, and select “Publish” -> “New Predictive Scenario”.
  2. Select the PAi Application you wish to send it to.

  1. Select the Catalog within S/4HANA you want to save it to.
  2. Add a name, description, and select Publish.

  1. You can check the progress of your publishing task in the notification bar.

  1. Once complete, you will see the status in the Notifications tab.


Here is also a short youtube video which goes through the steps.

6) Activate new Predictive Scenario in S/4HANA


Congratulations – you have created a new predictive scenario!! You now have a few small steps to go to make it active:

  1. In S/4HANA, navigate to the Predictive Models Tab, and Predictive Scenarios Tile. Details of how to do this can be found in Blog 3. You will see your new predictive scenario in “Draft” status.


  1. Select the new predictive scenario, and add your Training, and Apply CDS views.
  2. Once complete, select Publish.

  1. Your predictive scenario is now ready to train and activate. You will find the API details of how you integrate your predictive scores in to your application here:


Now you know to connect S/4HANA to Predictive Analytics for some inspiration for new predictive use cases please review some of the blogs mentioned above. Also for some data science guidance please check out Paul’s blog from last week.

As mentioned above and in line with our continuing investment in the cloud we are also enabling our customers to Publish New Predictive Scenarios from SAP Analytics Cloud – Smart Predict. This will be available to both S/4HANA On Premise and Cloud customers in the coming weeks…..Stay tuned!


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo James Elliott
      James Elliott

      Hello Orla,

      I've been testing SAP Predictive Analytics from my laptop. We're getting ready to implement SAP Predictive Factory on our SAP sandboxes to test. Moreover, we just went live with S/4 HANA. If we already have S/4 HANA...Do we even need the SAP Predictive Analytics on laptop and Predictive Factory setup to work with S4? Please provide any documentation sources or insights, and perhaps Value Map if possible?

      Author's profile photo Orla Cullen
      Orla Cullen
      Blog Post Author

      Hi James,

      To use the pre-configured use cases listed above you do not need Predictive Analytics or Predictive Factory. You will need to install both PAi and APL which are free to download for S/4HANA customers 1709 and onwards. See blogs 2 and 3 for details.

      If you wish to customise the content delivered out of the box you must be on a minimum version of 1709 EHP1 and then you will need Predictive Factory.




      Author's profile photo James Elliott
      James Elliott

      Thanks Orla! We have SAP S/4 HANA 1709 On-Premise and to your point - have to install PAi and APL.



      Author's profile photo James Elliott
      James Elliott

      Thank you for your timely response Orla!! I'll read blogs 2 and 3 again and will check for Predictive Factory blogs or details too. Do you have any links to the provide for specific academic sources for using the out of the box preconfigurations, ie Sales and Finance? I also sent an Linkdn request to connect too. Hope to hear back from you.




      Author's profile photo Hitesh Kapadia
      Hitesh Kapadia

      Hi Orla,

      In step no. 6. 2 it shows we need to add a CDS view as a Training data set, and Apply it.

      In case of a customized Model, it get trained in the Predictive Factory and published to S/4 HANA, hence why does it require to provide the CDS view as a Training data set in S/4 HANA for the Predictive Scenario?

      It would be really useful, if you can help me to understand the rational.




      Author's profile photo Orla Cullen
      Orla Cullen
      Blog Post Author

      Hi Hitesh,


      In Predictive Factory you actually train the model on the underlying HANA SQL view, hence when you come back in to S/4HANA you need to specify the ABAP CDS View.


      Also by adding both the training and apply views to the Predictive Scenario we can generate not only the ABAP class but also the ABAP CDS view for scoring.



      Author's profile photo M Depa
      M Depa

      Hi Orla,

      Thanks for your hard work very informative blog. We are planning to develop Business process KPI s (predictive analysis in functional areas like sales, inventory and finance ) in S/4 HANA like simple example sales prediction etc. Do I need to follow all blogs mentioned in this series or please guide me which steps I need to follow...Your inputs are very much appreciated.




      Author's profile photo M Depa
      M Depa

      Hi Orla,

      In continuation to my previous question, if I need to develop a time series model for forecasting future data can't I use same steps you are mentioning in these blogs without looking for cloud analytics which was mentioned in later blogs...


      Author's profile photo Qianyuan Li
      Qianyuan Li

      Hi Orla,

      thank you for your hard work. I do have a question about SAP Predictive Analytics. Is it possible to publish a model version to a Pai ABAP Application, which I created with Expert Analytics? Cause I want to create a new predictive scenario with an expert analytics model and embed that within my S/4HANA application.

      I would be very grateful for your reply.