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 eighth installment of the PAi and S/4HANA Blog series. In our previous blog Sam introduced SAP Analytics Cloud Smart Predict. This week I am going to take you through how to connect your S/4HANA Cloud system to SAP Analytics Cloud, create a model, and publish it back to S/4HANA.



Note: For this week we will be focusing on S/4HANA Cloud (1902 onward). I will cover S/4HANA on-premise next week. The connection steps for Cloud and on-premise are different, so separating the steps avoids any confusion.

Get Connected

So, on that note, let’s start with the initial steps required to do the following:

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

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

Roles Required:

User User Role Task
S/4HANA Administrator SAP_BR_ADMINISTRATOR To configure connection settings
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) Configure S/4HANA Cloud (import):

To configure the connections necessary to acquire data from SAP S/4HANA Cloud please follow the SAP Analytics Cloud Data Connection Guide.

There are a few references to the Planning module in SAP Analytics Cloud, but the process to import data from S/4HANA Cloud is also applicable to Smart Predict. Also please note the CDS view you wish to connect to must be OData enabled.

2) Configure PAi Connection:

  1. Logged in to S/4HANA Cloud as an Administrator go to the Communication Management Tab, and select the Communications Arrangement Fiori tile:

  1. In the Communication Arrangements Fiori tile, select “New”.

  1. Select the drop down on the Scenario box.

  1. Select Communication Scenario SAP-COM_0229 – SAP Predictive Factory Integration.

  1. Enter Arrangement Name, Communication System, and Inbound Communication User Name as used in step 1 above. Select Save.

Take note of the Service URL/ Service Interface, as you will need this to configure the PAi Connection in SAP Analytics Cloud.

  1. You must now log in to SAP Analytics Cloud, and ensure you have the Predictive Admin role in your profile. Go to the Connections Tab, and Select PAi Connections.

  2. Enter the Service URL/ Service Interface details, the Inbound Communication User name and password, and select Test Connection.

  3. Once the test connection is successful, select Save


Get Data

The first thing you will need to do is acquire data from S/4HANA Cloud 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 (_) and begin with YY1_*

  6. 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 Cloud 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 Cloud, imported data, built a model, and exported it to S/4HANA.

In the coming weeks, we will be going through how you can set up connections to and from SAP Analytics Cloud – Smart Predict and S/4HANA On Premise - so stay tuned.