Skip to Content
Technical Articles

SAP Analytics Cloud: Live Smart Predict with SAP HANA

In this blog I will describe the steps needed to use the SAC Live Smart Predict aka Live Predict, that is now available with SAP Analytics Cloud (SAC).  This allows using Smart Predict with live (remote) datasets that reside on-premise in SAP HANA.  This data will not be imported into SAC, it stays on-premise.

For this HANA connection, we require the SAP Cloud Connector (SCC), an SAC data repository, and an SAC (live) dataset.  This is required in addition to the SAP HANA CORS (HTTPS) configuration that I have described previously.

The official SAP documentation for this feature can be found here, including an architecture diagram.

Components Needed

  • SAP HANA (on-premise) with the Automated Predictive Library (APL)
  • SAP Cloud Connector (we will install this)
  • SAP Cloud Platform Account
  • SAP Analytics Cloud CF Tenant

Steps required

  1. Link SAC Tenant to SAP Cloud Platform Account
  2. Verify SAP HANA (on-premise) has the Automated Predictive Library installed
  3. Install the SAP Cloud Connector
  4. Configure the SAP Cloud Connector
  5. Add SAC Data Repository
  6. Create SAC Reference to Dataset
  7. Create Predictive Scenario

1. Link SAC Tenant to SAP Cloud Platform Account

In the SAC environment we need to link the tenant to a SAP Cloud Platform user account.

This is done by simply setting your username (email) in the system administration, datasource configuration.

Once complete you will see a Subaccount and region host that will be entered into the Cloud Connector Configuration later.

2. Verify SAP HANA (on-premise) has the Automated Predictive Library installed

Within HANA, we use the Automated Predictive Library (APL) v4, 1906 or higher, this is checked with the SQL call statement below.

If you don’t have this installed, are missing permissions or don’t have the correct version you should fix that.  I have previously described How to Install the Automated Predictive Library, that was for APL v1.1, so it’s probably best to check Andreas’s blog that includes an APL v4 update. Installing the Automated Predictive Library (APL) on SAP HANA Express

call "SAP_PA_APL"."sap.pa.apl.base::PING"(?)

 

 

3. Install the SAP Cloud Connector

For simplicity I installed the linux version of the SAP Cloud Connector (SCC) on the HANA box.

You download the SCC from the SAP Development Tools site

The cloud connector requires a JVM, to ensure compatibility I downloaded the SAP JVM.

https://tools.hana.ondemand.com/additional/sapjvm-8.1.059-linux-x64.zip
https://tools.hana.ondemand.com/additional/sapcc-2.12.1.1-linux-x64.zip

We see the 2 files downloaded onto the linux box.

Unzip the the JVM by extracting it to the target dir

Check if there is a JAVA_HOME already set

Install the Cloud Connector package

If you do see any errors during installation, it is easiest to correct these uninstall and re-install with rpm commands similar to the following.

## Query for scc package
rpm -qa |grep scc
## Erase / Uninstall 
rpm -e com.sap.scc-ui-2.12.1-5.x86_64
## Install Package
rpm -ivh ./com.sap.scc-ui-2.12.1-5.x86_64.rpm

The SAP Cloud Connector (scc_daemon) can be controlled with the systemctl commands.

systemctl status scc_daemon
systemctl restart scc_daemon

4. Configure the SAP Cloud Connector

We need to open the Cloud Connector Homepage, you may see some warnings because the SSL certificate is self-signed.  I had to use Safari in private browsing mode to get it to open and accept the insecure (untrusted) SSL cert.  This certificate can be replaced with a signed one to avoid this issue.

https://<hostname>:8443

The default SCC username password is Administrator / manage, this will be changed on first login.

We connect to the SAC tenant Subaccount from step 1, using our SCP credentials.  For SAP employees, this is your global password.

Once the Subaccount is defined, we add a “Cloud To On-Premise” connection

The wizard guides us, mapping the internal physical host to a virtual host

We see the mapping is added and the host is reachable.

5. Add SAC Data Repository

We use this Cloud Connector configuration to specify the remote data repository

Verify the connection works

6. Create SAC Reference to Dataset

In the HANA environment I have already import the “APL_SAMPLES” schema and datasets.

We can see the AUTO_CLAIMS_FRAUD Table

The table is populated with sample data.

In SAC, we create a reference to this data

Choose datasource

Connect to Live Data Repository

Choose our data repository

Select the desired table or SQL view

This becomes our dataset, but the data remains in the source HANA environment

We get a data preview of our remote dataset

7. Create Predictive Scenario

In just a few clicks we can create a predictive scenario using our live dataset.

Select the required dataset

We set the model parameters, select the target variable and input fields.

Once the model has been trained we get some useful output

From here we can chose to keep the model, modify the model parameters, add a new model to our scenario or apply the existing model to a separate dataset.

 

15 Comments
You must be Logged on to comment or reply to a post.
  • Great blog Ian! I think one point that is worth highlighting as well when it comes to Smart Predict based on live SAP HANA data is the ability to create live BI stories in SAP Analytics Cloud. These stories effectively combine actuals on one hand and predictions on the other hand, which fully meets the promise of Augmented Analytics. 

  • Hi, great blog, is really helpful. I have only one question, this work only with HANA On Premise or can I make a Dataset from a Live Data Connection to a HANA Cloud (Cloud Foundry or Neo)?

    Thanks and Regards

    • Thanks Nicolas,

      I haven’t tested, but I expect you can get a SAC Live Dataset from either HANA Cloud using the SAP Cloud Connector, but we do not yet support the Automated Predictive Library (APL) v4 in these environments.

  • Great Blog.

    I’m getting an error that “Data repository is not reachable from SAC” when I try to preview the data, even though I get a message that “Live dataset is created successfully”

  • Hello Punitha, feel free to raise a support ticket with SAP Support if you face problems. The component that should be used is LOD-ANA-PR. Kind regards, Antoine

  • Hi Ian,

    Excellent blog! I have set up the Data Repository without any issues in the past but recently it stopped working. In the meantime, we have moved to new CF tenants and I want to reconfigure the connection but I get an authorization error.

    {packageId: "sap.fpa.services.resource.dataRepository", objectName: "message_dataRepository",…}
    args: []
    bUIMessage: false
    bWarning: false
    httpStatus: 403
    message: "You are not authorized to create data repository."
    messageId: "DATA_REPO_CREATE_NOT_AUTHORIZED"
    objectName: "message_dataRepository"
    packageId: "sap.fpa.services.resource.dataRepository"
    stack: "Exception@/sap/fpa/services/core/system/Exception.xsjslib:122↵RestException@/sap/fpa/services/dataRepository/RestException.xsjslib:37↵throwUnauthorizedError@/sap/fpa/services/dataRepository/helper/DataRepoAuthCheck.xsjslib:86↵assertPrivilegeOnDataRepo@/sap/fpa/services/dataRepository/helper/DataRepoAuthCheck.xsjslib:56↵RestDataRepository.prototype.doPost@/sap/fpa/services/dataRepository/api/RestDataRepository.xsjslib:65↵Rest.prototype.dispatch@/sap/fpa/services/core/rest/Rest.xsjslib:177↵handleRequest@/sap/fpa/services/GetResponse.xsjslib:184↵main@/sap/fpa/services/GetResponse.xsjslib:216↵@/sap/fpa/services/GetResponse.xsjs:9↵"
    status: 403

    Do you have any idea?

    Kind regards,

    Martijn van Foeken | Interdobs

  • Hi Ian,

    After going through your blog, which found it very informative while exploring the Live Smart Predict. However I have one query regarding the live data connection.

    EX: As in your use case “APL_AUTO_CLAIMS_FRAUD”  has been used as live data for creating the predictive scenario. but if data is saved locally in SAC then How can it be considered as live data or can it automatically update data inside SAC locally if data is updated inside HANA?

     

    Regards,

    Chandra Bhushan

    • Hi Chandra,

      The dataset APL_AUTO_CLAIMS_FRAUD is still “live”, meaning in SAC we just have a reference to the data set stored in HANA. You preview the data via SAC, but we do not copy the data.  When the predictive scenario is created we push the processing to the data (HANA), using the APL in the source HANA system and only the summary results and metadata are kept in SAC.

  • Hi Ian,

    Thank you for your response. I was having query how “APL_AUTO_CLAIMS_FRAUD” is stored in HANA(manually or through an automatic SQL query)?

    What is definition of SAC coming to Acquired and Live data( in both the cases we are manually importing the data either to SAC or HANA) ?

     

    Regards,

    Chandra Bhushan

    • Hi Chandra,

      Sorry, I think I misunderstood your question. To make this clearer, I have just added some additional screenshots and descriptions to Step 6. Create SAC Reference to Dataset.

      Acquired data is imported into SAC (I am not describing this scenario)

      Live data remains in the source HANA and we only preview/visualise that in SAC. (This is the scenario I am using)

      Please let me know if that clears things up?

      • Hi Ian,

        Thank for clarification, but was having one query

        If the data is manually imported in HANA and then used in SAC for predictive scenario… do we call that as Live?
        Regards,
        Chandra Bhushan
        • Ah, that’s different question I suppose. 🙂

          For me it is live as that is the “source” of the data and could be updated/modified.  We are still connecting to that source and not duplicating data.  Yes, in this example I used a sample dataset that is static, but the same configuration would also apply for data that has been loaded into HANA in real-time through replication. Alternatively you may have an application that runs on HANA and that data could also become a dataset for Smart Predict.