Modelling with the AFM could be the Perfect 10 but SAP are staying with a 9!
This video gets you started with the Application Function Modeler in SPS09. The AFM has been available from SPS06 but has been rebuilt from the ground up for SPS09. The new version is much more powerful and flexible than previously.
Like his little bit of code later on, Philip starts by showcasing the resources that you may find useful. In this instance, he directs you to the AFM section of the SAP HANA Academy Youtube channel and the associated resources on Git Hub which include code snippets and source data.
Revision 90 or above
After showing you how to download the code snippets and source data from Git Hub, Philip reminds the viewer that the new version of AFM requires Revision 90 or above running on a server and SAP HANA Studio.
This video assumes that you have access to a vanilla version of SAP HANA Studio and are logged on as the System User.
Creating a Schema
Philip starts by creating a schema based on the sample snippets that can be downloaded from Git Hub as above. He walks you through the process a step at a time as shown.
After following these steps you will see a schema with three tables in it.
You now need to set up the authorizations so that you can start to work with the Application Function Modeler.
Open the code snippets downloaded earlier in SAP HANA Studio.
Whilst in Studio you need to change some of the settings as System User.
The settings are all documented in the Developer Guide for SAP HANA Studio which is available from www.help.sap.com/hana_appliance. These changes require a high level of user rights and associated privileges to make configuration changes. Make sure you either have these rights or that the configuration changes needed have been undertaken by your system administrator.
Packages that need to be installed
Philip then demonstrates logging on as the System User before itemising the packages that need to be installed.
1 The Predictive Analysis Library
2 The Business Function Library
You will also need to make sure that the Scripts Server is started. This is not something started by default. If it’s not started run the code on line 7.
If you go to System and select the Toolbox then the Configuration section you will see that the script server has an instance set to one.
If you go to the Landscape you will see the script server is set to green. This is not done by default but it’s required when you’re using PAL, BFL or AFM.
You will also need to check that you have an R server associated with your HANA server. The dialogue box below shows you where you check that the R server is up, running and configured.
Philip then goes onto to discuss how to use SQL to make a Development User and how to set up specific authorizations for that user to allow access the schema created earlier.
You can see the roles assigned to the DEV_USER below.
This includes the right to create R script.
The user also has been granted object privileges as shown.
The DEV_USER will also need the modeling rights within HANA to enable native HANA development.
Some of the things that actually happen when you’re using the AFM are executed not by the user himself but on his behalf by a technical system user called _SYS_REPO. This user will need read access to the input data and output tables.
When you run this code as the System User you can see under Roles, Object Privileges and Package Privileges shown.
Philip demonstrated how to assign authorizations through the code but could have done it under the menus as well. You also need to make sure that the SYS_REPO user can access the DEV_USER’s own schema because a lot of the output tables and procedures will be held in that schema. SYS_REPO needs rights to read, insert and delete from tables. This needs to be done as the DEV_USER.
Philip summarises by highlighting the key points in the process that are necessary to authorise the usage of the Application Function Modeler:
- Create a developer user
- Make sure that the scrip server is started
Philip has described in a high level technical video what you need to get started with AFM and ends by stating that you are now ready to start building in the AFM in the next video.