SAP Analytics Cloud – How to drive Analytic Application based on user-defined URL Parameter

There may be a requirement when we have to link two documents across platforms like Webi Intelligence documents or SAP Analytics Cloud Story to Analytic Application as destination, we may face challenges with regard to passing the relevant information to the Analytic Application. We may also be challenged to use this information as basis to filter/display data in Analytic Application. This blog will address steps to handle both these challenges.

This blog post will demonstrate how you could drive a SAC Analytic Application based on a user-defined URL parameter set from another application.

This blog also describes how a URL parameter is defined and used as filter in Analytic application.

Analytic Application URL:

A URL for Analytic Application typically has following components:

https://<Tenant>/sap/fpa/ui/tenants/<Tenant-ID>/bo/application/<app_ID>?mode=<mode_type>&view_id=<view-type>&(list of parameters and values separated by &)

Defining a User-defined Parameter:

Create a new Scripting Variable by clicking on + and set other properties as below:

Create script variable

Note: Don’t give the prefix ‘p_’ in the name, even when you select Expose variable via URL parameter.

In the onInitialization() function of Canvas, add following code:

Code to enable dimension filtering based on parameter value

Save the application and Run the Analytic Application.

The analytic application runs in a new tab, add the following at the end of the URL generated:

&p_parameter1=<value>

URL with parameter

Note: Add prefix ‘p_’ in parameter name, even when it was not mentioned in script variable.

And you can see that the data is being filtered with the value set in URL.

To further, optimize the application so that it runs and returns full set of data even when the parameter is not set or when you execute the URL without the parameter suffixed, you can use following code:

Optimized code to run application without the parameter set

Then use the URL along with parameter to open the analytic application from other applications, like SAC story etc.

Please share your feedback how you like the post and whether it was helpful.

Thanks!