PAi Blog Series 8: Creating models in SAP Analytics Cloud Smart Predict and Publishing to SAP S/4HANA Cloud
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.
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.
|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|
· 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:
- Logged in to S/4HANA Cloud as an Administrator go to the Communication Management Tab, and select the Communications Arrangement Fiori tile:
- In the Communication Arrangements Fiori tile, select “New”.
- Select the drop down on the Scenario box.
- Select Communication Scenario SAP-COM_0229 – SAP Predictive Factory Integration.
- 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.
- 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.
- Enter the Service URL/ Service Interface details, the Inbound Communication User name and password, and select Test Connection.
- Once the test connection is successful, select Save
The first thing you will need to do is acquire data from S/4HANA Cloud into SAP Analytics Cloud as a Dataset.
- From the main menu navigate to Create -> Dataset
- Select Data acquired from a datasource.
- Select SAP S/4HANA as the datasource type.
- Select your previously configured S/4HANA Data Connection, and select Next.
- Browse folders or search for your CDS view. Note your CDS view must be OData enabled.
- Once you have found your CDS view, select it.
- Select the fields, and apply filters to your dataset.
- Give the dataset a name, and save it to the required folder.
- You now have your new dataset, and can begin 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.
- From the main menu navigate to Create and Predictive Scenario.
- 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.
- Enter a name and description, and select Save.
- Select the button to create a Predictive Model.
- On the right-hand panel select the drop down for the Input Dataset, and navigate to the Dataset we acquired above.
- Select the target variable, and exclude variables as necessary.Select Save and Train.
- Depending on the volume of data in your dataset, training could take some time.
- We now have a trained model, and can review the relevant debriefing information.
- Once we are happy with our model,we can send it back to PAi in S/4HANA by selecting the Publish button.
- Select the relevant PAi Connection, and drop down to name the predictive scenario.
- Select the default package.
- 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_*
- You can monitor the progress of the publishing on the Predictive Models Tab.
You now have a new Predictive Scenario in S/4HANA Cloud in draft mode.
- 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.
- Select the new predictive scenario, and add your Training, and Apply CDS views.Once complete, select Publish.
- 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:
- 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.