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: 
Product and Topic Expert
Product and Topic Expert
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!