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 nineth installment of the PAi and S/4HANA Blog series. In our last blog, we took you through how to connect your S/4HANA Cloud system to SAP Analytics Cloud, create a model, and publish it back to S/4HANA.

As promised this week I will cover S/4HANA on-premise. The connection steps for Cloud and on-premise are different, so we are separating the steps avoids any confusion.



Note: For this week we will be focusing on S/4HANA On Premise (1709 EHP1 onward). I covered S/4HANA Cloud in my last blog. The connection steps for Cloud and on-premise are different, so separating the steps avoids any confusion.

Get Connected

Let's get started with the initial steps required to do the following:

  • Connect your S/4HANA On Premise system to SAP Analytics Cloud to import Datasets

  • Connect SAP Analytics Cloud to your S/4HANA On Premise system so we can send new predictive scenarios back to S/4HANA.

Roles Required:

User User Role Task
SAP Cloud Connector Administrator ADMINISTRATOR To manage system connections
S/4HANA Key User SAP_BR_ANALYTICS_SPECIALIST To manage Predictive Scenarios and Predictive Models
SAC Administrator

·        BI Admin

·        Predictive Admin
To configure connection settings
SAC Business User Predictive Content Creator Create Predictive Models



1) Add S/4HANA On Premise as a datasource (import):

  1. In order to connect your S/4HANA On Premise system with SAP Analytics Cloud you will need to install the Cloud Connector. You can find details on how to do that in the Cloud Connector Installation Guide.

  2. Next you will need to add your SAP Analytics Cloud instance to your Cloud connector. On the Connector screen, select Add Subaccount.

  3. Enter Subaccount details and select save. For further details see the configuration guide


  1. Once complete it is time to add your S/4HANA On Premise system to the cloud connector as follows. Select the Subaccount you have just created.

  2. Select Cloud to On Premise tab and, select the Add button.

  1. Select backend type Other SAP System and, select Next

  2. Select Protocol type HTTP and, select Next

  3. Enter Internal host and port and, select Next

  1. Select principal type None and, select Next

  2. Add a description (optional) and, select Next

  3. Review Summary and, select Finish

  4. Check your S/4HANA system is reachable

  5. Configure which resources should be accessible

  6. You can limit which ever Resources (service URLs) are accessible as appropriate. You can learn more here. Or Select Path and all sub-paths and select save

  7. Next you logon in to you SAP Analytics Cloud system and, ensure you have the BI Admin role in order to configure datasource connections. Select Connections.

  8. Select Acquire data and datasource type SAP S/4HANA

  9. Enter your Connection name and details of your S/4HANA On Premise system, ensuring you tick the “Connect to an on premise S/4HANA” box and, select ok

2) Configure PAi Connection:


  1. While still in SAP Analytics Cloud connections page select the PAi Connection tab. Ensure you have the Predictive Admin role in your profile.

  1. Select Add new Connection and, complete details as follows and, select Test Connection

Name: Connection name

Description: Connection description

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

Select “Use SAP Cloud Connector”

Client: Client of your S/4HANA application

Username & Password: Your username and password must have the Analytics Specialist Role assigned.


  1. Once the test connection is successful, select Save


Get Data

The first thing you will need to do is acquire data from S/4HANA On Premise into SAP Analytics Cloud as a Dataset.

  1. From the main menu navigate to Create -> Dataset

  1. Select Data acquired from a datasource.

  1. Select SAP S/4HANA as the datasource type.

  2. Select your previously configured S/4HANA Data Connection, and select Next.

  3. Browse folders or search for your CDS view. Note your CDS view must be OData enabled.

  4. Once you have found your CDS view, select it.

  5. Select the fields, and apply filters to your dataset.

  6. Give the dataset a name, and save it to the required folder.

  7. You now have your new dataset, and can begin modeling.





Get Modeling

Now you have data, and are ready to create a new predictive scenario in SAP Analytics Cloud Smart Predict. The dataset we have extracted from S/4HANA contains data about historical License Sales deals, and we are going to use this information to build a Regression model to forecast future License sales.

  1. From the main menu navigate to Create and Predictive Scenario.

  2. We can chose from Classification, Regression and Time Series, as Sam described in our previous Blog. In this example, we are going to do a Regression use case.

  1. Enter a name and description, and select Save.

  2. Select the button to create a Predictive Model.

  1. On the right-hand panel select the drop down for the Input Dataset, and navigate to the Dataset we acquired above.

  2. Select the target variable, and exclude variables as necessary.Select Save and Train.

  3. Depending on the volume of data in your dataset, training could take some time.

  1. We now have a trained model, and can review the relevant debriefing information.

  2. Once we are happy with our model,we can send it back to PAi in S/4HANA by selecting the Publish button.

  3. Select the relevant PAi Connection, and drop down to name the predictive scenario.

  4. Select the default package.

  5. Select New predictive scenario. Enter a name and description, and select OK and Publish.Note: A Predictive Scenario name length must not exceed 20 characters and can only contain uppercase alphabetic (A-Z), numeric (0-9) and underscore (_)

  6. Review your settings and select Publish

  7. You can monitor the progress of the publishing on the Predictive Models Tab.




Get Active

You now have a new Predictive Scenario in S/4HANA On Premise in draft mode.

  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.Once complete, select Publish.

  2. Your predictive scenario has now been published. You will find the API details of how you integrate your predictive scores in to your application here:

  3. Your predictive scenario is now ready to train and activate. You can find details on how to do this in our previous blog


Congratulations! You have now successfully created connections to and from SAP Analytics Cloud – Smart Predict and SAP S/4HANA On Premise, imported data, built a model, and exported it to S/4HANA.

In the coming weeks, we will be going through how you can integrate the API details above in to your S/4HANA system as a new Fiori stay tuned!