Skip to Content

Introducing the SAP Automated Predictive Library


You may have already heard about the recent release of SAP Predictive Analytics 2.0, but may not be aware that this also includes the SAP Automated Predictive Library (APL) for SAP HANA.

The APL is effectively the SAP InfiniteInsight (formerly KXEN) predictive logic optimized and adapted to execute inside the SAP HANA database itself for maximum performance – just like the SAP HANA Predictive Analysis Library (PAL) and Business Function Library (BFL).

Obviously when you already have data in SAP HANA it makes sense to perform heavy-duty processing such as data mining as close as possible to where the data resides – and this is exactly what the APL provides.

By way of comparison, the PAL provides a suite of predictive algorithms that you can call at will – as long as you know which algorithm you need, whereas the APL focuses on automation of the predictive process and uses it’s own in built intelligence to identify the most appropriate algorithm for a given scenario. So the two are very much complementary.

There are a couple to ways to take advantage of the APL. Of course, you can exploit the APL when using the SAP Predictive Analytics 2.0 desktop application – whenever accessing SAP HANA as a data source. In this case usage is implicit.

However it’s also possible to access the APL independently of SAP Predictive Analytics 2.0. You can access the APL explicitly using SQLScript or from the Application Function Modeler (AFM) in SAP HANA Studio. And, of course, you can embed APL capabilities into your own custom SAP HANA applications.

We’ve put together a series of SAP HANA Academy hands-on video tutorials to explain how to access the APL from SAP HANA Studio using SQL Script:

1. Reference Guide & Download

In this video, part of the SAP Automated Predictive Library (APL) for SAP HANA series, we will introduce the SAP Automated Predictive Library (APL), download the APL reference guide, then download sample data & code and extract them for later use.

2. Import Sample Data & Check Installation

In this video, part of the SAP Automated Predictive Library (APL) for SAP HANA series, we will use SAP HANA studio to import the provided sample data into a SAP HANA schema, ensure the SAP HANA script server is running, and verify that the APL has been correctly installed.

3.Create APL User & Table Types

In this video, part of the SAP Automated Predictive Library (APL) for SAP HANA series, we will create and authorize a SAP HANA database user so that it can make use of the APL. We will also set up APL table types and test the APL using the “ping” function.

4. Predicting Auto Insurance Claim Fraud

In this video, part of the SAP Automated Predictive Library (APL) for SAP HANA series, we will use the APL to predict auto insurance claim fraud.

This example shows how an insurance company assesses past insurance frauds in order to create a category of client characteristics that may be susceptible to make fraudulent claims.

The first step of the analysis is to prepare the main input tables, one containing data that has already been analyzed, that contains some known fraud cases. This table is used to train the model. The results are used to indicate which variable(s) to use as the target and describe the claims data.

After considering past data and past fraudulent claims, the customer uses the data to train the APL model on that date produce an updated model that will be applied to the new data in order to detect potential fraud risks.

After training the model, the APL function returns summary information regarding the model as well as indicators like the Predicitve Power (KI) of the model, or the Prediction Confidence of the results (KR).

At the end of the data mining process, the “Apply Model” function produces scores in the form of a table that can be queried.

5. Recommendations

In this video, part of the SAP Automated Predictive Library (APL) for SAP HANA series, we will use the APL to generate buying recommendations.

The recommendations component can be used to generate product or service recommendations for customers by analyzing their behavior and other details and comparing these with the details and behavior of other customers.

The first step of the analysis is to prepare the main input tables, in particular, the customer transaction history table which is then used to train the model via the “Create Reco Model And Train” function. A number of advanced configuration options can be specified to define how the model should be built.

After training the model, the “Apply Reco Model” function produces recommendations for a given customer in the form of a table that can be queried.

Or for the YT playlist follow this link:

We hope these help you get started with the APL.

For a more in-depth discussion of the APL do check out the excellent blog by Ashish Morzaria.



You must be Logged on to comment or reply to a post.
  • Philip,

    One question, you mentioned we can access APL from Application Function Modeler. However, in our case APL is installed and I can use it SQL editor but how do I make sure that APL is available in function modeler or flowgraph model?



    • Hi Angad,

      Thanks for the feedback.

      Indeed, the APL does not have it's own dedicated section in in the right hand side of the Application Function Modeler yet - unlike PAL, BFL, and R.

      However you can access APL functions via the "AFL Function" option in the "General" panel.In fact this approach works for any AFL function.





  • Hi Philip,

    APL is a great approach to incorporate easy-to-use predictive capabilities into application. Trying out this, I actually run into issues with time series analytics.

    The demo data regarding "cashflow" works well, but when trying to create a model on own data, with the CREATE_AND_TRAIN API I get an error saying:


    SAP DBTech JDBC: [2048]: column store error: search table error:  [2620] _SYS_AFL.APL_AREA:CREATE_MODEL_AND_TRAIN: [135] (range 2) AFLFunctionFatal exception: [APL error] Automated Analytics error (-2147024809): phase 'KxCPPInterf::IKxenParameter::getSubValue()'  [[APLModel:Can not find parameter 'Model'.]]

    Could you help me in getting to the root of this problem - is there any additional material regarding trouble shooting available.

    Using the Automated Analytics Modeler on the same data works well.

    I'd really appreciate your help.

    Best regards,


    • Hard to tell ; I would double-check the signature definition, making sure you clean up all input tables before inserting parameters for the signature defintion, and comparing your own SQL script with the sample SQL script provided.

      • Hi Rudolf,

        I did get your SQL script and data set. The script works fine on our APL 2.2 server in Paris.

        Could you run it against the latest version of APL ? the version 2.2.

        Best Regards

        • Rudolf,

          There is no model generated by APL ; if I do the forecast using the same data but using the desktop tool the problem is the same : no model found.

          In fact the data set has no clear granularity : sometimes it has 1 point per month (monthly series ?) sometimes 28 points (daily series ?) sometimes 4 points (weekly series ?)

          The tool cannot make forecast out of it.

          Best Regards