When you want to create cool Analytical Fiori-like Apps then APF is the way to go. I blogged about it here: http://scn.sap.com/community/developer-center/front-end/blog/2015/04/01/analysis-path-framework-a-hidden-gem-for-creating-awesome-analytical-apps. So it is about advanced charting in analytical Fiori Apps. You can use APF when you have SAP UI5 resp. Fiori, you need HANA SPS08 or higher and „SAP HANA Analytics Foundation“ (SHAF)" which is part of SAP Suite-on-HANA.
If you don’t know what I mean I recommend to play around with the demo app: https://www.sapfioritrial.com/sap/hana/uis/clients/ushell-app/shells/fiori/FioriLaunchpad.html?helpset=trial&sap-client=001#DaysSalesOutstanding-analyzeDSO or an application in exploratory data analysis which is shown here:
In this blog entry I will describe how to get APF started. And I want to thank everyone at SAP who helped me: you get a free beer when we meet at Markstube in Walldorf
Prerequisites
You need the following for APF:
- AS ABAP – in the blog I describe a scenario for an AS ABAP 7.40 which is a Fiori Frontend Server.
- HANA – of course with XS Engine running
- Web Dispatcher
This is the easy task – you need following skills:
- HANA administration: skills of HANA Lifecycle Manager and granting roles and analytical privileges – SSO enablement is necessary if you want to avoid loggin screens which is of course necessary for production
- Web Dispatcher: an analytical app or the APF configuration modeler are JavaScript apps that also consume XSOData services.
- ABAP administration: installation of a software component and implementing the Fiori Launchpad and can grant ABAP Roles
I also recommend Google Chrome because of the developer tools.
The installation is described here: http://help.sap.com/saphelp_uiaddon10/helpdata/en/ec/f70adefd71445586b2fbe264306fdd/content.htm?frameset=/en/ec/699e0817fb46a0817b0fa276a249f8/frameset.htm&node_id=699
In the following I will describe some details at the installation process which might be interesting for you. At first check that XS Engine is running. Usually it is on port 80<instance number> of your HANA and you should see something like the following on your browser:
APF on FES and Fiori Lanchpad
After software component UISAFND1 is installed you need two roles on the Frontend Server: SAP_APF_DT_TCR_A (and later you also need SAP_APF_RT_TCR_A). Then you should see the following tile on your Launchpad:
HANA Content
You need also HANA Content: HANA CONTENT HBA APF CORE 100 (technical name: HCO_HBA_R_APF_CORE). The installation is described in OSS note: 2183947 - Smart Business for SoH (Suite on Hana) delivery. You find a new software component for the frontend server here for Smart Business which is useful in the future. On the HANA system you can find two software packages:
- HANA CONTENT HBA AF CORE 100 (HCOHBARSBCORE03P_1-20012110.ZIP)
- HANA CONTENT HBA AF TRANSP 100 (HCOHBARSBTP00_0-70000744.ZIP)
I am describing the installation using HANA Application Lifecycle Manager (HALM) which is described here: https://help.sap.com/saphelp_hanaplatform/helpdata/en/bd/b7a459c3144fcab1c5641c72c1158d/frameset.htm. Put the zip file on the database server and execute a command like the following:
/sapmnt/<system>/hdbclient/hdbalm -h sh021 -p 8066 -u <adminuser> install /SAPINST/HANA/HANA_AddOns/SAP_ANALYTICS_FOUNDATION/HCOHBARSBTP00_0-70000744.zip
The administration user need sufficent authorizations which are describes in the following knowledge base articels:
- 2086725 - HANA HALM is not working with error- 403 Forbidden
- 2147845 - 403 Forbidden Error when starting Hana Lifecyle Manager
Two roles are important for installation: sap.hana.xs.admin.roles:Administrator and sap.hana.xs.admin.roles:HTTPDestAdministrator.
After that execute SQL-Statements described in OSS note 2118742 - Analyzing HANA Live content package deployment problemsto control the installation.
As developer you should see the following content in HANA studio now:
On older HANA revisions you need the Application Lifecycle Manager but I won't describe the details here.
Web Dispatcher
Since APF Configuration Modeler as well as analytical apps consume resources both from the Frontend Server (Gateway Hub) but also from the HANA so you need the web dispatcher to overcome the cross origin policy restrictions.
There are many good documents that explain how a web dispatcher works:
- http://scn.sap.com/community/fiori/blog/2015/03/09/webdispatcher-faq
- http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0bc1e7a-0fae-3210-6cbe-eaf8d3e2b8d3?QuickLink=index&overridelayout=true&59983513345574
It is possible to install more than one web dispatcher. As developer you start the Launchpad and use a different HTTP port. This could be necessary in scenarios when there a more or different systems involved.
I describe a typical configuration with (frontend server fes.acme.com), a backend (be.acme.com) and a HANA XS (hana.acme.com).
wdisp/system_0 = MSHOST=https://fes.acme.com, MSPORT=????, SID=COT, NR=??, CLIENT=???, SRCSRV=*:*, SRCURL=/sap/opu;/sap/bc;/sap/public
wdisp/system_1 = MSHOST= https://be.acme.com, MSPORT=????, SID=CCT, NR=??, CLIENT=???, SRCSRV=*:*, SRCURL=/sap/es
wdisp/system_2 = SID=EXT, EXTSRV= https://hana.acme.com:?, SRCSRV=*:*, SRCURL=/sap/hba;/sap/hana
Also useful are the following parameters:
wdisp/system_conflict_resolution = 1
wdisp/add_clientprotocol_header = 1
wdisp/handle_webdisp_ap_header = 1
wdisp/add_xforwardedfor_header = true
I don’t want to discuss rewriteitign files and integration of Enterprise Search (/sap/es) which is necessary for Fiori factsheets. Please also note that this configuration has to be changed if you develop own XSOData services in own HANA packages.
If the web dispatcher has a wrong configuration then the configuration modeler won’t react if you start to develop a configuration and you will get messages like the one here with Chrome developer tools: “APF message (1): 10005 – Bad HTTP request returned status 404 with text Not found” and “APF message (2): 5101 – Unexpected internal error: No XSRF Tokel availanble. Contact SAP” and “APF message (3): 9000 – Unknown exception Uncaught Type Error: Cannot read property ‘setAndSave’”
Fight for your Rights!
You need HANA privileges that can be granted by your administrator. Then check them in HANA studio you should see at least the first two here:
You need also analytical privileges which is describe in the installation documentation mentioned above. But in a test scenario you should convince your administration to give you a kind of SAP_ALL for accessing all information views which is reasonable in test systems (only):
By the way, you see all your privileges in detail with an SQL statement:
If you don’t have enough privileges you will get the following messages in Chrome developer tools:
“APF message (1): 5001 Request /sap/hba/r/apf/core&odata/modeler/AnalyticalConfiguration.xsodata/$batch to server failed with http status code 403…”
Smoketest
Now you perform a smoketest. Enter the configuration modeler, and press "+". Now create a new application and after pressing "Save" it will be saved in the HANA database. When there is a problem then "Save" will not work. In this case open Chrome tools and check the error messages. The description of the errors above will help you to indentify the problem.
Summary
It’s not that difficult to install APF if you know how to do it. But you should have a sixpack of cold beer or some sparkling wine to captivate and win the hearts of your administrators. They deserve it.