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.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ian_Henry
Product and Topic Expert
Product and Topic Expert

Having shown you how to install the Automated Predictive Library (APL) link below

How to Install the Automated Predictive Library in SAP HANA

We can now look to use the samples provided with the APL.

I would advise copying the SQL samples locally from the APL source location, probably on the HANA box, but also available within the Predictive Analysis (PA) 2.0 download inside the SAPPAAPL2000_0.TGZ

First you will need to setup a user or be granted the relevant right to your user.  If you look at the apl_admin.sql it contains all the relevant statements.

The user roles needed for this would be

           AFL__SYS_AFL_APL_AREA_EXECUTE

     AFLPM_CREATOR_ERASER_EXECUTE

There is one step not shown in the sample SQL, which is creating the APL_SAMPLES schema, this is straightforward such as

     create schema APL_SAMPLES;

There is secondary SQL file that your USER needs to which creates the Table Types.  This is all within the apl_create_table_types.sql

You should run this and check that it is successful.  These are currently user specific so any user that requires access to the APL would need to execute this.

The table types can be found in HANA Studio under Procedures

If you created the schema you will already have SELECT permission on this APL_SAMPLES schema if not you need to request this.

The data now needs to be imported into the schema, this straight forward with HANA Studio.

Right click the schema APL_SAMPLES and choose import

We can now browse to the server location where the APL was extracted to.

Choose our sample data tables and import them.

The samples should now all be configured and available for use directly via SQL or using Predictive Analysis 2.0.

I came across an issue with the CENSUS data set and have attached a fix here.  When using the APL it supports INTEGER datatype but it does not support  TINYINT or SMALLINT, so if you are using PA 2.0 and not just the APL SQL scripts you will receive an error.

To fix this you can run the following SQL

SET SCHEMA APL_SAMPLES;

ALTER TABLE CENSUS ALTER ("age" INTEGER, "education-num" INTEGER, "capital-loss" INTEGER, "hours-per-week" INTEGER, "class" INTEGER);

Let me know how you get on, next I aim to show how these samples can be used with PA 2.0