Professional Documents
Culture Documents
PUBLIC
Warning
This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 1/66
8/9/2020
Analytic Applications
An analytic application is a document that can contain visualizations such as tables, charts, and lters to allow navigation and
analysis of data. You can personalize the visualizations and interaction behaviors of the UI elements according to user
requirements. Analytic applications are created and consumed in SAP Analytics Cloud.
The major difference compared to stories is that in analytic applications, you can con gure the behavior of the UI elements with a
set of speci c script API events, and specify which actions should take place when events are triggered. This exibility lets you
create a variety of analytic applications, ranging from simple static dashboards to highly customized analytic applications with
numerous options to browse and navigate data.
Find more details about the basics here: About Analytics Designer
Required Licences
All SAP Analytics Cloud licenses include the creation and consumption of analytic applications. For planning applications, please
note the following:
If you only need read access to existing planning models and create private versions only, you can use the SAP Analytics
Cloud for business intelligence license.
If you need to create public versions and use all planning features, the SAP Analytics Cloud for planning, standard edition is
required.
If you need to create or update planning models for your planning applications, the SAP Analytics Cloud for planning,
professional edition license is required.
Make sure that the users who consume your applications have got the read rights for analytic applications in their roles.
Tasks
This image is interactive. Hover over each area for a description. Click highlighted areas for more information.
Related Information
Widget Reference
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 2/66
8/9/2020
Known Limitations to Analytics Designer
Features by License Type for Analytics Models
Features by License Type for Planning Models
Analytic applications can range from simple static dashboards showing static numbers to highly customized applications with
many options to browse and navigate data, change the visualization, navigate across multiple pages or areas, up to an extensively
customized look and feel according to customer branding.
There is a dedicated design environment in SAP Analytics Cloud in order to create such applications. The term design in analytics
designer doesn't refer speci cally to the UX or UI design aspect of an analytic application. It is the entire process of creating an
analytic application: de ning the data model, laying out the screen, con guring widgets, and wiring it all up with the help of
custom scripts.
The analytics designer offers you another way to create analytical content in SAP Analytics Cloud.
What can you do with analytic applications that you can't do with stories?
An analytic application typically contains some custom logic, expressed with the help of scripts. A story is created in a self-service
work ow and can comprise many laid-out widgets and a lot of con gured functionality. However, the amount of customization is
limited to the foreseen possibilities offered in the story design-time environment. With analytic applications there is much more
exibility to implement custom behavior. It also requires a higher skill level to create those.
However, analytic applications can use widgets, which do not exist for stories, and can have custom logic, which cannot be
implemented in stories since there is no scripting. In general, stories and applications share widgets and functionality to a large
extent, but some widgets can only be used in applications because they need to be scripted (dropdown boxes or buttons, for
example).
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 3/66
8/9/2020
In the story design environment, it's practically impossible for you to create a story that doesn't work. The expectation of self-
service design time for stories is that business users are guided (to some extent also limited) in what they do and can do. The
story design time is supposed to consist of multiple con guration steps that prevent business users from creating something
which breaks. With story design time, we ensure some level of consistency.
It's completely different with applications, especially with the added scripts. As soon as application designers add custom logic
with scripting, they have complete freedom to change the default behavior of the entire analytic application. The design
environment will provide everything to create correct applications, but it doesn't guarantee that the application is correct or won't
break.
In addition, an analytic application has a dedicated life-cycle. You start it and then there are certain steps which are performed, like
the startup event, for example. The story doesn't have that. You can switch the story between edit and view mode as often as
you like.
These are major differences. That is why we offer two artifacts and two corresponding design-time environments to create stories
and analytic applications.
As a rst step you decide whether you want to visualize your data in a table or a chart, and add a table or a chart to your analytic
application. This triggers another step for picking a model. In addition to widgets showing data, you add to the layout other
widgets that control data, such as lters, arrange and con gure them, and wire them up.
Almost all widgets expose events. In order to add custom logic to the analytic application, you can implement event handlers with
the help of the scripting language.
The application is comprised of a table, which consumes a large extent of the available screen real estate. Around the table,
typically above it, are many UI controls (buttons, checkboxes, dropdown boxes, and so on) to change the data display, such
as to lter the data,change the data view, or show different dimensions. The nature of this application is that there is only
one table, but many and potentially complex ways to show data differently.
Dashboard
The application is a dashboard visualizing a few data points with the help of tiles. There is no interactivity, but it gives users
an overview of highly aggregated data. A typical option of some dashboards is to use the tiles for further drilling into
details: clicking on a tile takes you to a more detailed page or an entirely new application showing more details for the
aggregated number on the tile.
Generic Application
Many applications are created for a speci c model. That means that the UI, the widgets, and the logic are done with
knowledge of the model and its available dimensions, members, and so on. Another category is generic applications. These
are applications which need to be provided with a model whenever the application is executed. These applications are more
complex to create as their logic needs to work with whatever model the end user selects at runtime. The advantage is that
customers don't need to create applications for each and every model they have maintained in their system.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 4/66
8/9/2020
Example
Let's say a dropdown box is populated with the available years in the data model - 2015 to 2019. The dropdown box exposes the
event OnSelect, which is triggered whenever a value is selected from the dropdown box. The implementation of that event
handler could read the selected value and set a lter for the selected year in the model. The numbers shown will re ect the
selected year.
Because you can add many event handlers using the scripting APIs of all widgets and other service APIs offered, the application
can be geared towards the speci c needs of a customer.
Example
Let's say that there is an API method available for ltering members: setFilter("YEAR", "2014"). The plain JavaScript
method expects two strings and this is also what is executed at runtime by the Web browser. However, our de nition of the API
method uses dedicated prede ned types for our problem domain, that is setFilter(Dimension, Member). With that
de nition, the system checks and validates that the passed strings are a valid dimension and a valid member.
The script editor also uses the type information. It doesn't just statically check the types, but uses the knowledge about the
underlying model and provides value help to offer dimensions and members existing in the model.
Procedure
1. To create an analytic application, do one of the following:
2. Choose whether you want to place the widget on the canvas or in the opups area in the Layout tree of the Outline. If you
want to place it in the popup area, select (Add Popup).
3. Choose how you want to visualize your data in the application: You can use charts and/or tables.
Select Insert (Table) from the toolbar to add a table on an existing model. In the Selct Datasource dialog box
you can choose whether you want to add a table based on an existing model or on no model. You can choose an
existing model in the dropdown Select an Existing Modell or just type in the name of a model.
You can choose an existing model in the dropdown Select an Existing Model or just type in the name of a
model. The table is displayed with the corresponding data.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 5/66
8/9/2020
If you choose No Model the table is displayed empty. You can add a data source at a later point in time.
Note
Once you have chosen an existing model, it will be used as primary default model whenever you add another
table or chart to the analytic application. You can change this data source by choosing (Change primary
model) in the Builder panel.
Select Insert (Chart) from the toolbar to add a chart on an existing model.
4. Add more widgets to your analytic application if needed, for example a dropdown, a lter line, an image, text, or button by
clicking on the button in the Insert menu and choosing a widget.
You can change the style of every widget in the Styling panel by clicking in the canvas right next to the widget on More
Actions Edit Styling .
5. Add scripts to your widgets if you want to enable user interaction with the UI elements at runtime and a custom-speci c
behavior:
b. Click on the button. If the widget supports multiple events, select one of the events and click on the button.
Note
You can also use the button in the quick action menu of each widget you have placed in your application.
A new tab is automatically created in the script editor, where you can add scripts for the widget.
c. Close the tab by clicking on the button at the right of the tab.
a. Specify the analytic application's path – you can save to your private les or to a public path.
Note
A public analytic application is visible to all users. A private analytic application is visible to its creator and the
users they have chosen to share it with.
Note
Valid characters are alphanumeric characters and underscores. Spaces can be included but not at the start or
end of a name.
Whenever you change your analytic application, you have to save your changes rst to see them at runtime.
7. Click on Run Analytic Application in the upper right corner of the Web browser window. The application opens in another
Web browser window.
Related Information
Creating a Table
Creating a Chart
Widget Reference
Analytics Designer API Reference
Using the Script Editor
Managing Analytic Applications
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 6/66
8/9/2020
Context
When you add widgets to the main canvas, the system automatically creates names for the widgets that are displayed in the
Outline. The name of a widget is important if you write scripts that refer to or address it. You can change the default widget name
and adjust it to your needs in the Anaytics Designer Properties area of the Styling tool. The change will also be re ected in the
Outline/Layoutand anywhere you use the widget.
Procedure
1. Insert a widget to the canvas or popups area in the Layout by clicking (Table), (Chart) or by clicking the (Add)
button in the toolbar.
The widget is displayed on the main canvas and its default name is shown in the Outline view.
Note
You can move a widget up and down within the Layout view via dragging and dropping. The widget listed higher will take
precedence over the ones below when displayed in the Canvas or Popups area.
Aligning Widgets
As an application designer, you can align the position of multiple widgets when designing an application to improve your work
efficiency and design accuracy.
To align widgets, rst select all the widgets that you want to reposition. Then, in the quick menu to the right of the selected area,
click the (Align Widgets) icon and select one of the following options from the quick menu according to your needs:
Align Left: align the left edge of each selected widgets to the leftmost edge of all selected widgets.
Align Right: align the right edge of each selected widgets to the rightmost edge of all selected widgets.
Align Top: align the top edge of each selected widgets to the topmost edge of all selected widgets
Align Bottom: align the bottom edge of each selected widgets to the bottommost edge of all selected widgets.
Align Middle: center the selected widgets horizontally by aligning their vertical center axis.
Align Center: center the selected widgets vertically by aligning their horizontal center axis.
Note
The height or width of the widget will not change whether you de ne it as auto, pixel or percentage values.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 7/66
8/9/2020
You can de ne the left, right, top or bottom margin of the widgets as auto, pixel or percentage values too. However, when you align
widgets, such settings of the widgets' position may change under different conditions. Take aligning widgets to the leftmost edge
as an example:
If the left margins of one or more widgets are de ned as pixel, or if the left margins of all widgets are de ned as auto, after
you align the left edges, the unit of the left margins of all widgets will be changed to pixel.
If no widget’s left margin is de ned as pixel and the left margins of one or more widgets are de ned as percentage, after
you align the left edges, the unit of the left margins of all the widgets will be changed to percentage.
This rule applies the same when you align widgets to right, top and bottom.
You can view and create comments on a widget or a table cell from planning models.
chart
table
geo map
image
shape
text
RSS reader
web page
R visualization
clock
Note
To enable or disable the comment option in the quick menu of a widget, you can go to the Quick Menus section of the widget's
Styling panel, then select or deselect the option Comment.
Note
If you create a story from an analytic application, comments in the application won’t be carried to the created story.
Code Syntax
Application.setCommentModeEnabled(isEnabled:bool)
All the comments added are also displayed in the Comments view of the Collaboration panel. But currently there's a
limitation that even if you hide a widget, all comments related to the widget will still be displayed in the Collaboration panel.
Example
For example, you’ve designed an input eld (InputField_1) and would like to allow end users to:
1. Click a button (Button_1) and get the comment created on one cell and input it into the input eld.
2. Click another button (Button_2) and post the comment in the input eld to any table cell they select.
Sample Code
var comments = Table_1.getDataSource().getComments().getAllComments(Table_1.getSelections()[0]);
console.log(comments);
var str = "";
for(var i = 0 ; i < comments.length; i ++){
var text = comments[i].text;
str = str + txt;
}
InputField_1.setValue(str);
Sample Code
var str = InputField_1.getValue();
Table_1.getDataSource().getComments().addComment(Table_1.getSelections()[0],str);
Related Information
Adding Comments to a Data Cell
Prerequisites
You have created an analytic application with widgets that contain scripts, or you have created scripting objects such as script
variables, script objects and OData services. Now you want to use one or more of these widgets or scripting objects with the
corresponding scripts in another application or even within the same application.
Context
The procedures of copying and pasting widgets and scripting objects are identical. In the procedure below, we will take widgets as
an example.
Procedure
1. Select the widget you want to reuse in the main canvas and click Copy on the short menu on the right side of the
widget.
2. Decide whether you want to use the widget/script within the same application or in another.
ii. Click in the main canvas where you want to paste the widget.
iii. Click Copy and Paste in the le menu and select Paste. The widget is added to the place you clicked to
insert it.
c. In the same browser tab page, open the application where you want to reuse the copied widget.
Note
Noted that currently you cannot paste copied widgets or scripting objects to application opened in a new
window or tab page.
d. Click on the main canvas where you want to paste the widget.
Note
Once you have clicked Copy and Paste in the le menu you can also use the keyboard shortcuts CTRL + C
and CTRL + V .
Results
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 10/66
8/9/2020
You can see that the assigned script has been copied from one widget to the pasted widget: the fx button next to the pasted
widget name in the outline of the analytic application is already active. Click on the fx button to see the copied script.
Context
You can only copy widgets from a story to an analytic application, but not the other way around, from an analytic application to a
story.
The places where you can copy widgets to can be the canvas, pop up or a widget container such as a panel or a tab page. You can
directly copy a chart or a table widget, or a chart or a table in the Smart Insight panel and the Examine panel to an analytic
application.
After successfully copying the widget, the state of the widgets, for example the lter, hierarchy, ranking and sorting states and so
on will look exactly like that in story, also all relevant settings such as the data binding, necessary variables and styling settings
and the other properties will be kept.
Note
Unsupported widgets and features:
Some story widgets which are not yet supported in analytic application, such as value driver tree and input control
won’t be pasted to the target analytic application.
Some story’s features which are not yet supported in analytic application, such as link analysis and dynamic image
won’t be copied to the application.
Other limitations:
The status of some speci c types of story lters, such as geo polygon lter and panning or zooming won't be copied to
the application.
When copying grouped widgets, all widgets will be copied to the application. However, the grouping information won’t
be copied.
Thresholds and colors assigned to a table or chart won't be copied to the application.
Data cell level comments will be copied to the application. However, widget-based comments won't.
If a story table’s dynamic text is referenced to other resource outside the copying scope, the dynamic text won't be
copied to the application.
Hyperlinks won’t be copied along with a widget if its type is not External Hyperlink.
Procedure
You can copy a widget either via Ctrl + C and Ctrl + V or follow the steps below:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 11/66
8/9/2020
1. In the story, select the widget or a group of widgets you want to copy.
2. Click the (More Actions) beside the widget, in the quick menu choose Copy.
3. Exit the story and go to the analytic application you want to copy the widget to.
4. Focus your mouse on the place where you want to copy the widget to, for example the canvas, popup or container widget.
5. From the tool bar, click the button (Copy and Paste) and choose Paste.
When you delete one or more widgets or scripting objects at one time, a Restore option will be displayed in the con rmation
dialog as below:
Click this restore option and the items you delete just now will be restored. Noted that only the widgets or scripting objects
deleted in last operation will be restored.
After you restore a widget, all its previous state, including ID, measure and dimension binding, lters, order and settings will be
kept, as well as the lter line bond to it. However, the position of the widget in the canvas or popup won't be kept.
And the system will try to keep the previous name of the widget or scripting object if the name hasn't been occupied elsewhere. If
the item name is occupied and will be changed, an information dialog will inform you of such changes.
Note
Restoring the deletion of a popup is currently not supported.
For singleton objects such as Bookmark and Export to PDF, if you add a same object right after the deletion, the previous one
won't be restored.
Prerequisites
Please assure that the following conditions are made:
To use SAP Analytics Cloud within the context of a SAP Data Warehouse Cloud space (Space Aware Connectivity), SAP
Data Warehouse Cloud and SAP Analytics Cloud need to be on the same tenant.
Context
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 12/66
8/9/2020
Procedure
1. In the Main Menu select Browse Files .
5. Choose the data set you would like to work with and choseOK.
8. Click on Run Analytic Application in the upper right corner of the Web browser window. The application opens in another
Web browser window.
Context
Scripts consist of one or more statements written in a JavaScript-based language that follow a speci c syntax. You write scripts in
the script editor. You can nd all objects, elds and functions available in scripts in the Analytics Designer API Reference on SAP
Help Portal at Analytics Designer API Reference.
Procedure
1. Add a widget to the canvas, for example a dropdown.
The speci c icon and name of the application is displayed in the Outline.
3. Click on the button. If the widget supports multiple events, select one of the events and click on the button.
Note
You can also use the button in the quick action menu of each widget you have placed in your application.
The script editor opens in a new tab which displays the name of the event (example: "onSelect") and the widget or
application to which the script will be assigned (example: "table_1 - onSelect").
Tip
You can activate the content assistance at any place in the script by pressing CTRL + + + Space on your keyboard.
5. You can change the order of the tabs by dragging and dropping a tab horizontally.
6. When you have nished your script, close the tab by clicking on the button at the right of the tab.
To reopen the script editor, again click the button next to the widget in the Outline.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 13/66
8/9/2020
Related Information
Adding a Script to a Widget
Using Script Variables
Using Popups
Analytics Designer API Reference
Known Limitations to Analytics Designer
Using the Value Help in the Script Editor
About Script Objects
Creating a New Script Object and Script Function
Modifying And Deleting Script Objects and Script Functions
Procedure
1. Add a widget to the canvas, for example a dropdown.
The speci c icon and name of the application are displayed in the Outline.
3. Click on the button. If the widget supports multiple events, select one of the events and click on the button.
Note
You can also use the button in the quick action menu of each widget you have placed in your application.
A new tab is automatically created in the script editor, where you can add scripts for the widget. For example, the following
code gets the selected text of a dropdown:
Sample Code
var selectedText = Dropdown_1.getSelectedText();
You can nd all objects, elds and functions available in scripts in the Analytics Designer API Reference on SAP Help Portal
at Analytics Designer API Reference.
4. Drag and drop a tab horizontally to change its display order if needed.
5. Close the tab by clicking on the button at the right of the tab.
Related Information
Using Script Variables
Note
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 14/66
8/9/2020
setVariableValue, for tables and charts, and addMeasure, for charts, only support single variable values. That's why the
member selector also allows only single selection.
Note
This value help dialog is only available for the chart function chart.addmeasure().
The result of metadata selection is displayed like this in the script editor:
If you work with a variable that is not a dimension, the value help is displayed in the following way:
And the selection result in the script editor looks like this:
This provides value help for the keys, which represent the dimensions of an associated data source, or for the values of keys, which
represent a dimension member of the corresponding key/dimension.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 15/66
8/9/2020
Note
To start the selection object you have to type in braces {} within the parentheses ( ).
You can also get value help for the corresponding dimension members of the dimension property when you try to assign or
compare the property.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 16/66
8/9/2020
goDocEnd CTRL + End Move the cursor to the end of the document.
goLineStart ALT + Left Move the cursor to the start of the line.
goLineEnd ALT + Right Move the cursor to the end of the line.
goGroupLeft CTRL + Left Move to the left of the group before the
cursor. A group is a stretch of word
characters, a stretch of punctuation
characters, a newline, or a stretch of more
than one whitespace character.
goGroupRight CTRL + Right Move to the right of the group after the
cursor. A group is a stretch of word
characters, a stretch of punctuation
characters, a newline, or a stretch of more
than one whitespace character.
delGroupBefore CTRL + Backspace Delete to the left of the group before the
cursor.
delGroupAfter CTRL + Delete Delete to the start of the group after the
cursor.
nd CTRL + F Find.
You use script variables in scripts. They are useful, for example, for storing intermediate results that are used repeatedly in a
script.
Script variables exist during the full execution time of the analytical application. The script variables you create in an application
are only available for that speci c application. You can de ne their values not only in the application, but also in the application
URL by adding a speci c URL parameter.
For each script variable, you can de ne a name, an optional description, the type, and a default value (which is optional and
depends on the variable type). A script variable can be de ned as an array, which means it represents a set of values of the
speci ed type. You can use the following primitive types by opening the Type list:
string
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 17/66
8/9/2020
represents a text as a sequence of characters
boolean
integer
Scienti c notation is not supported when you enter an integer. But when running an analytic application, the number will
be displayed in scienti c notation format if it is longer than 21 digits.
number
Can be entered in ordinary format or scienti c notation format such as "1e+20" or "1e20". If the number is longer than 21
digits, it will be automatically displayed in scienti c notation format.
In addition to the primitive types described above, you can select a wider variety of non-primitive types for the script variable from
the Type list, such as Button, Category, Chart, Clock, DataSource, Table, and so on.
Its icon and name are displayed beneath Script Variables and a new dialog, Script Variable, is opened.
2. In the dialog, you can change the name of the script variable.
3. (Optional)
4. Select the type of the script variable and whether it should be set as an array.
7. You can now use the script variable in the scripts within this application.
2. In the dialog, select the option Expose Variable via URL Parameter.
Note
For array type variables and non-primitive type variables (types other than string, boolean, integer and number), this
function is not applicable and the option is disabled by default.
3. Save the change to the analytic application and choose Run Analytic Application.
4. In the URL of the analytic application, enter a new parameter that starts with "p_" and is followed by the script variable's
name.
For example, if you want to set the value of ScriptVariable_1 to 3.14, add the following information to the original URL:
;p_ScriptVariable_1=3.14
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 18/66
8/9/2020
5. Reopen your application URL.
You will see the URL parameter value has been passed to corresponding script variables. In this way, you can initialize the
application based on your needs by simply making some changes to the URL parameters.
If you write scripts in the application, you can insert the script variable you have created by selecting it from the content
assistance in the script editor. You can activate the content assistance at any place in the script by pressing CTRL + + +
Space on your keyboard.
If you add a calculation to a dimension or measure, in the Calculation Editor you can insert the script variable you have created by
typing @ in the formula. All available script variables will be automatically displayed in the drop-down list. Note that only global
variables of type string, integer, and number can be referenced in the Calculation Editor. The array type is not supported.
Note
When you use the script variable as the judging expression in a IF instruction, and the expression returns a null value, the IF
instruction will also return a null result. For example, if you write a script like this:
And you set the script variable to unde ned when running the analytic application, the data returned and displayed in the chart
is not -100, but null.
You can also de ne script variables as the source of dynamic text in a text widget. For detailed information about this, refer to Text.
To delete an existing scripting variable, choose More Actions beside the script variable in the Outline view, and select Delete.
After deleting a script variable, you can add it again to the analytic application with the same variable name. If the type of the
script variable is number or integer and was previously used in a calculated measure, the calculated data won't resume
automatically. You need to go back to the calculated measures in the Builder panel and from the More Actions menu, select
Edit Calculation. Then click OK again. After that, corresponding calculated data will resume in the analytic application.
As an application designer you can use a function to encapsulate certain script logic that can be used in other script functions like
event handlers. This keeps you from duplicating code and makes maintenance of applications easier.
Once you have added a script object you can create functions on this object, which will be exposed as script functions. Each script
function has the following elements:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 19/66
8/9/2020
return type
You can access the script object in scripts with its name like other widgets. Inside a function of the script object you have access to
all objects in the application such as widgets, global variables, or popups.
Related Information
Creating a New Script Object and Script Function
Modifying And Deleting Script Objects and Script Functions
Procedure
1. To create a new script object, click the button in the Script Objects section in the Scripting area of the Layout in design
mode.
The new script object is displayed in this section. It can be renamed from the (More) menu or by double-clicking the
name as for widgets.
2. To create a new script function, click (More) for the script object and choose Add Script Function.
A new function is created and can be seen underneath the script object instance. The side panel for this new function is
displayed too. Here you can modify the function name, description, arguments, and the type of return value. Click Done to
close the side panel.
Element Description
Name of the function The name is mandatory and it validates according to the same
rules as for global variables (name cannot be empty, cannot be
a reserved keyword, cannot begin with a letter).
Return Type of the function Can be void, string, boolean, integer, number.
Besides the primitive types described above, you can also select
a wide variety non-primitive types in the dropdown box like
Button, Category, Chart, Clock, DataSource, Table, UrlType etc.
Click to create a new argument for the function. The argument dialog is displayed, where you can edit the following
elements:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 20/66
8/9/2020
Type of the argument
By default, the arguments panel is automatically completed with a suggested argument name.. If the argument should
represent a list of this type, set it to be an array.
To close the argument panel and return to the script function side panel, click Done.
Note
All modi cations take effect immediately without your having to click Done, for example when you press enter on an
input, or immediately after you switch the dropdown value or to an array. You can see the resulting signature in the
signature panel at the top of the editor and in the script function panel in the Arguments section.
4. Optional: You can reorder the arguments by dragging and dropping them inside the panel.
Example
The following example describes the return type and input parameters for the script function computeAverage.
Name: computeAverage
Related Information
Creating a New Script Object and Script Function
To change the name, description, arguments, and return type, click the function in the Scriptingarea of the Outline. It will open the
side panel for this script function where you can do your changes. After you have changed the function, click Done to close the
panel..
To edit arguments, click (Edit) next to the corresponding argument in the arguments section in the script function side panel.
To remove an argument, click (Remove) next to the argument.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 21/66
8/9/2020
Related Information
Creating a New Script Object and Script Function
Using Timer
Timer object enables application designers to start a timer to trigger timing events.
By leveraging the feature of a timer, you can realize different scenarios such as:
create simple animations that allow image or text widgets to change their content every couple of seconds.
Multiple timers can exist simultaneously, but each timer works independently from others.
Creating a Timer
1. In the Scripting section of the Outline, select right next to Timer to create a timer.
2. The side panel Timer opens with a default name Timer_1 displayed. You can change the name at will.
4. To invoke the timer, write the script Timer_1.start(delayInSeconds: number) for the triggering event of the
canvas or a widget. For example, if you want to invoke the timer when clicking a button, write the script for the onClick()
event of the button.
Note
When calling the start() API on a timer that is already running, it will override the rst start() API, that is, the
timer stops and immediately restarts to realize the delay set by the second start() API.
Note
The delay time set in the timer can be both a integer that's measured by seconds, or a decimal that's measured by a
smaller unit. For example, if you write start(0.1), then the delay time will be 100 milliseconds.
5. To repeatedly restart a timer once it’s time out, you can go to its onTimeout() event and write the script
Timer_1.start(delayInSeconds: number).
There are some other script APIs available for the onTimeout() event of a timer, such as Timer_1.stop() and
Timer_1.isRunning(). For detailed information, refer to Analytics Designer API Reference.
Example
Here is an example of leveraging the timer to automatically scroll some images horizontally from right to left in a certain
interval.
First, add three different images (Image_1, Image_2 and Image_3) and place them side by side in the canvas. Take notes of
their left margins, which are 112, 240 and 368 px.
Then add an image type script variable (Animation_Widgets) and an integer type script variable (LeftMargins). Enable the Set
As Array option for the two script variables.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 22/66
8/9/2020
After that, add a script object (Util_Animation) with a function (doAnimation) and then add a timer (Timer_1) .
Sample Code
console.log('onInitialization - begin');
console.log('onInitialization - end');
For doAnimation:
Sample Code
var num = 3;
For Timer_1:
Sample Code
//Run this script object once Timer_1 is time out.
Util_Animation.doAnimation();
After you save the application and choose Run Analytic Application, application users can see the images automatically scroll
from right to left in turn as expected.
The line breaks you've set will be kept if you use the API getPlainText().
Usage
In the script editor, you can use \n as control character to force a line break in a text widget via the widget's API applyText().
Example
Let's assume you use a button and a text widget in your application. When the user clicks on the button at runtime, a new text
line is displayed in the text widget, saying This is a new paragraph.. To achieve this, type in the following script in the button's
onClick event:
Sample Code
var currentText = Text_1.getPlainText();
Text_1.applyText(currentText + "\nThis is a new paragraph.");
Before:
After:
Prior to SAP Analytics Cloud 2019.18, calculations on the account dimension were not handled properly by script APIs such as
setDimensionFilter or getData on the DataSource type.
In addition, the value help returned incorrect member identi ers. Prior to the change, member IDs would look like this:
[Account_BestRunJ_sold].[parentId].&C4A#CALC0. After the change, the member identi ers are GUIDs and look
like this 25880968-9230-4045-b252-417449111942. As of version 2019.18, all script methods accepting or returning
member IDs use the new member IDs (GUID format) only. If you have used a hard-coded member ID of such a calculation in your
application, you need to change it to the correct format.
2. Adjust the script where calculated measures are used, for example for the API method addMeasure, by replacing the old
calculation measure ID with new one: In the script editor, click Ctrl + Space and select the calculated measure with the
new ID.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 24/66
8/9/2020
Example
Old calculated measure ID prior to version 2019.18:
Sample Code
Chart_1.addMeasure("[Account].[parentId].&[C4A#CALC0]",Feed.ValueAxis);
Sample Code
Chart_1.addMeasure("16387401-6533-4893-9825-833760248992", Feed.ValueAxis);
Once you add a widget or a technical object to the application, the associated type library is displayed as well. If you remove the
last widget or technical object associated with a type library, the library is also removed and not displayed any longer in the
content assistance.
2. Choose Settings Optimize Type Libraries . A dialog Optimize Script Libraries is displayed that informs you that you can
optimize the script type library in favor of design time scripting experience and the run time performance. With this
optimization only script types which are related to the widgets in your application will be available.
3. Click Optimize in the dialog. The type libraries will be cleaned up immediately. All scripts will immediately be checked and
any errors will be shown in the error list.
Note
If you have already used some type libraries that are not directly related to objects (like widgets) used in the application
(for example, you have used Feed enum values in scripts in the application that contains no charts), this could lead to
scripting errors. Please check the error list after the optimization and update your scripts as needed.
Note
If you don't save the application, it will behave as before.
For further information about the various type libraries, please refer to the Analytics Designer API Reference on SAP Help Portal at
Analytics Designer API Reference
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 25/66
8/9/2020
If you as an application designer want to rename some entity, various references to it have to be adapted (mainly scripts, dynamic
texts, and calculated measures). Previously, you had to do this work manually, which is a tedious job, especially for larger
applications.
The new automatic refactoring automates this process as much as possible. Ideally, you don't need to do anything: the rename
just works, keeping the application intact.
However, there are cases where blindly executing the rename would result in script errors. In such cases you'll be informed upfront
about any issues, and you can decide to either cancel the rename operation or continue.
When you rename an application entity (either by using the Outline view or by changing the name in the side panel / styling panel),
the software behaves as follows:
All scripts (both event handlers and script functions) without script errors will be adapted automatically.
Note
If the script declares a local variable with the same name as the new name speci ed during the rename operation, the
local variable will be automatically renamed, using the pattern <oldName>_$.
Example: The script declares var OkButton = Button_1;, and now you rename Button_1 to OkButton. Then the
script will be changed to var OkButton_$ = OkButton;
If the renamed entity is a script variable, two additional refactorings will be done automatically:
All dynamic texts that reference the script variable will be adapted to use the new name.
All calculations that reference the script variable (which in this case has to be of type number or integer) will be
adapted to use the new name.
In the following special cases, you have to interact with the system:
If the renamed entity is a script variable which is exposed via URL You can continue or cancel the refactoring.
parameter, a con rmation dialog will pop up to say this might break
links to this application (those links that set the script variable via
URL parameter).
If occurrences of the renamed entity have been found in scripts You can continue or cancel the refactoring.
which have script errors, a con rmation dialog will pop up to say
scripts with errors will be skipped, and that you'll have to manually
adapt the script.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 26/66
8/9/2020
If occurrences of the renamed entity have been found in a script that You can continue or cancel the refactoring.
has (read-only) input parameters which con ict with the new name,
a con rmation dialog will pop up to inform you that the script will be
skipped, and that you'll have to manually adapt it.
Example
The event handler for onPostMessageReceived has two event
parameters, message and origin. The script has an
occurrence of some application entity that should now be
renamed to message. This con icts with the event parameter,
and this con ict can't be resolved. Note that the same example
can also be applied to script functions, where the new name
con icts with a script function argument name.
If scripts use a built-in object (like console, ArrayUtils, You can continue or cancel the refactoring.
MemberDisplayMode) which con icts with the new name, a
con rmation dialog will pop up to inform you that the scripts will be
skipped, and that you'll have to manually adapt them.
Note
In this case the scripts do not need to contain a reference to the
renamed entity.
Debugging Scripts
To nd errors in your scripts, you can use the Web browser’s development tools to set breakpoints, or use the analytics designer
debug mode.
Debugging Scripts
Before you start debugging your scripts, learn how to nd and view Finding Your Scripts in the Web Browser's Development Tools
them in the development tools of the Web browser (Google
Chrome).
To pause a script while it is executed, you can set breakpoints at Setting Breakpoints in Your Scripts
certain points in your script.
Launch the analytics designer debug mode and use the debugger; Using the Analytics Designer Debug Mode
statement in your scripts.
To nd an authored script in the Web browser's development tools, you need to run the script at least once during the current
session.
Note
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 27/66
8/9/2020
Before executing your scripts in the runtime, the analytics designer transforms them. This is why the JavaScript in the Web
browser's development tools doesn't look exactly the same as the scripts you wrote in the script editor during design time.
The names of the scripts follow a speci c scheme: <WIDGET_NAME>.<FUNCTION_NAME>.js. The scripts are grouped in a
folder named <APPLICATION_NAME> where the components of the scripts' names have the following meaning:
Key Description
APPLICATION_NAME the name that you set for your application when you saved it
FUNCTION_NAME the name of the function/event handler that holds the script you
wrote
If you de ned a script for the onInitialization event of your application, the WIDGET_NAME will be automatically set to
"Application".
Note
Special characters in your application name will be replaced by "_", except "-" and "." which will be kept as they are.
Example
Let's assume you have an application called "My Demo Application" that contains a button called "Button_1" with an onClick
event handler. The name of the script would be Button_1.onClick.js and it would be located in a folder called
My_Demo_Application.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 28/66
8/9/2020
Procedure
1. Open the script you want to pause during its execution and, on the left side of the opened script in the development tools,
click the line number where you want the script to pause.
A blue marker appears that highlights the line number. This indicates that the script will be paused here the next time it is
executed.
2. Optional: Add more breakpoints in the same script to pause the script at different points during its runtime.
Next Steps
To reset a breakpoint, just click on the marker you want to remove and the script's execution won't stop at this point the next time
the script runs.
Note
If the debug parameter receives a different value than true or no value at all, it's ignored and the debug mode isn't enabled.
A valid URL of an analytic application at runtime with enabled debug mode looks like this: http://<HOST>:
<PORT>/sap/fpa/ui/app.html?tenant=<TENANT_NAME>#;mode=present;view_id=appBuilding;appId=
<APPLICATION_ID>;debug=true
Note
The names of the scripts are generated differently when the analytic application runs in debug mode. In debug mode, all script
names receive the suffix -dbg. For example: Button_1.onClick-dbg.js
This statement emulates the creation of a breakpoint in your script. You don't have to explicitly set a breakpoint in a script that
needs to be debugged, but the script will automatically halt its execution as soon as the debugger; statement in your script is
interpreted.
This lets you check at design time the points at which your script needs to be paused during runtime.
Example
You add the debugger; statement to your script at design time.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 29/66
8/9/2020
When you run your analytic application in debug mode, the script will automatically stop its execution at the debugger;
statement.
Context
After opening the reference list of an element, the information panel will display all the related elements referencing it. This is
especially helpful when you want to better understand the business logic of an application or want to change or delete a speci c
element in a complex analytic application.
Procedure
1. Hover the mouse over the name of the element (for example: Button_1) that you want to check its usage.
The information panel is opened at the button of the page showing the reference list of the element.
3. In the Reference List page, click any of the referencing element to highlight that element in the Main Canvas; and click any
script to directly go to the speci c script.
4. To expand or collapse all the components in the Reference List, click the button to the upper right corner of the Info
Panel.
5. After nishing checking the reference list, click the button (Info Panel) to hide or reopen the reference list.
Procedure
1. Click the button (Info Panel).
Note
The count number displayed by the (Info Panel) icon only indicates number of errors, but not includes warnings. The
number counts all errors in the application including those in the canvas and popups, even if you set lters for them in
the error panel later.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 30/66
8/9/2020
2. Click any error or warning item from the error panel and the corresponding script containing that error will open with the
error highlighted.
Once an error or warning is xed, it will no longer display in the error panel.
Note
To lter errors, for example, by the name of the corresponding widget, you can enter the key in the lter box.
To choose to display only errors or warnings, click the button to the upper right corner of the Info Panel and choose
corresponding options.
To expand or collapse all the components in the Error list, click the button to the upper right corner of the Info Panel
and choose corresponding options.
3. After xing all the errors, click the button (Info Panel) in the toolbar or choose in the Info Panel to hide the error
panel.
Besides the recent story tile, as an application designer or application user you can view recent analytic applications in another tile
on the Home screen.
Note
The Recent Analytic Applications tile is displayed by default on the Home screen of all customers using analytics designer
after the feature is generally available. For ramp-up customers, it's not displayed by default. In that case you need to follow the
steps in Customize Home Screen Tiles to enable the tile.
2. In the section Home Screen Tiles, enable the option Recent Analytic Applications.
2. In the section Home Screen Tiles, enable the option Recent Analytic Applications.
The 5 analytic applications you viewed or edited most recently are displayed in the tile.
3. To open the analytic application in View mode, click the application in the tile.
4. As an application designer, to open the analytic application in Edit mode for further editing, choose the button beside
the application and select Open in edit mode.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 31/66
8/9/2020
Browsing Applications
To access the le repository, select Browse Files in the main menu . Here you can nd:
lters
Applications saved in a public folder have read-only status for other users by default. You need to explicitly share your application
with other users and give them a create, read, update and delete access to allow them to edit the applications.
Related Information
Granting Permissions for Analytic Applications
With an analytic application open, choose (Edit Analytic Application) Analytic Application Details .
1. On the Files page, select the check box for the analytic application you want to copy and select (Copy to).
2. (Optional) Specify the analytic application's path – you can select public or samples.
Note
A public analytic application is visible to all users.
Note
Valid characters are alphanumeric characters and underscores. Spaces can be included but not at the start or end of a
name.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 32/66
8/9/2020
Share Applications
You can share analytic applications and change sharing settings.
Related Information
Translating Analytic Applications
De ning Themes for Analytic Applications
Sharing Analytic Applications
Modifying Sharing Settings
Context
Translation is used in both stories and analytic applications. Only the strings speci c for the analytics designer are listed here.
Note
As the values of widgets such as values in a dropdown box can be used as reference keys in scripts, they are not available for
translation.
Procedure
1. Enable an analytic application for translation.
c. Click the (Edit Analytic Application) button and choose Analytic Application Details.
e. Click OK.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 33/66
8/9/2020
Note
The Data Access Language you set up in the Profile Settings the moment you enable translation for an application
becomes the source language of new widgets. After you nish translating the text and switch the software to other
language via the Data Access Language, the application can only be opened in the view mode.
Note
If you disable Mark for translation for an analytic application that has been enabled for translation, all the relevant
translations will be removed accordingly from the translation dashboard.
After enabling translation for an analytic application, the application will be listed in the translation dashboard. For more
detailed information, see Translator Role and Translation Dashboard.
Translate in batch with the help of XLIFF les. You can start translating this application by exporting strings as XLIFF
le and then importing the translated XLIFF le. For more information, refer to Importing XLIFF Files and Exporting
XLIFF Files.
Ad-hoc inline translation in the translation dashboard. You can also directly translate strings in the translation
dashboard. For more information, see Editing Translated Text.
After you complete the translation, you can further manage the translated content or delete a particular language
translation. For more information, refer to Managing Translations and Deleting Translations.
Note
If you delete an analytic application, the relevant translations will still exist in the translation dashboard until the
analytic application is permanently deleted from Deleted Files.
When viewing an analytic application, you may want to come back to the same view of the data or directly enter different states of
data without having to spend time resetting all the widget states in the analytic application. In this case, you can save a speci c
view of data or different states of data as bookmarks.
In an analytic application, you can bookmark the changes of a widget itself and the display of the data in it, including but not
limited to the following:
show/hide of a grid, header, title, subtitle, unbooked members, total values in a table
items added to or removed from a dropdown, radio button group or checkbox group
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 34/66
8/9/2020
selected key in a dropdown, radio button group or checkbox group
max value, min value and current value of a slider and range slider
Note
You cannot bookmark translated contents, expect for the bookmark name.
Note
You cannot bookmark changes you make to the non-primitive type script variables (types other than string, boolean, integer
and number).
Note
For any new bookmark versions created after wave 2019.19, the settings of Unrestricted Drilling you've de ned when setting
date range for time dimension will take effect. However, this won't apply to the old bookmark versions created before this wave.
Tasks
Bookmarks Roles and Permissions
Managing Bookmarks
Procedure
1. In the Scripting section of the Outline, select right next to Bookmark Set.
The side panel Bookmark Set opens with the default name of the bookmark BookmarkSet_1. You can change the name if
you want to.
2. In the side panel, enter a Version number. The number must be an integer.
Note
To generate a new version of the bookmark set at any time, you change the version number.
After that, all the bookmarks you created based on the previous version will become invalid. To reopen the invalid
bookmarks, you need to change the version number back to the previous one.
3. In the side panel, select Included Components to choose the canvas, popups, widgets, and scripting objects to be included
in the bookmark set.
5. To allow application users to save a bookmark when viewing the analytic application, you need to add a widget such as a
button and write script for the widget, using the syntax below:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 35/66
8/9/2020
Code Syntax
// Save a bookmark of the current state of application with "Personal" or "Global" visibility
save (bookmarkName: string, isGlobal: boolean, override?: boolean): BookmarkInfo
Application users can now change the states of widgets in the analytic application at will and trigger the widget to save
different states as bookmarks.
Results
After saving the bookmark, both you and application users with proper authorizations can check it in the (Main Menu)
Browse Analytic Application Bookmarks menu. To view all bookmarks of a speci c application, go to the analytic application,
select (More actions) to the right of the application and choose Browse Bookmarks.
Note
A bookmark is valid only when its version is consistent with the current version of the bookmark set scripting object. If not, the
bookmark is invalid and cannot be opened.
To use a valid bookmark, click the bookmark and open it in the view mode.
Related Information
Managing Bookmarks
Managing Bookmarks
Application users can manage bookmarks either in the Files repository, or directly in the analytic application with the help of their
application designer.
Managing Bookmarks
To manage your bookmarks go to (Main Menu) Browse Analytic Application Bookmarks . You rst select a bookmark,
then follow these steps to edit, share, and delete a bookmark as needed:
Select (Edit) to change the name and type (Personal or Global) of the bookmark.
Select (Share) to share the personal bookmark with other application users or teams.
Note
When you share an analytic application with other users, only global bookmarks will be shared. Personal bookmarks won't be
included.
To search for a speci c bookmark, enter the bookmark name in the search box. To narrow down the lter scope, choose Valid
Bookmarks, Invalid Bookmarks, or All Bookmarks from the dropdown list to the left of the search box.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 36/66
8/9/2020
As an application designer you can also leverage the following APIs to allow application users to directly save, list, or delete
bookmarks in an analytic application:
Code Syntax
save(bookmarkName: string, isGlobal: boolean, override?: boolean): BookmarkInfo // Save bookmark b
getAll(): BookmarkInfo[] // Returns all valid bookmarks of current application.
getAppliedBookmark(): BookmarkInfo // Returns the bookmark which is applied to current application
getVersion(): integer // Returns current bookmark version of application.
deleteBookmark(bookmark: string|BookmarkInfo): boolean // Deletes specified bookmark of applicatio
Here are some script examples that show how to enable application users to save, list, and delete bookmarks in view mode.
Example
In this example, you want to design an application that allows application users to capture the states of their application and
save them as bookmarks.
First, in addition to the scripting object BookmarkSet_1, add an input eld (InputField_1) and a button (Button_1) to the
Canvas.
Sample Code
var name = InputField_1.getValue();
BookmarkSet_1.save(name, true, true); // Create a bookmark with the name input in the input field.
Example
Furthermore in this example, you want to allow application users to list all the available bookmarks and remove any bookmark.
First, in addition to the scripting object BookmarkSet_1, add a dropdown (Dropdown_1) and another button (Button_2) to the
Canvas.
For Dropdown_1:
Sample Code
var bookmarks = BookmarkSet_1.getAll();
Dropdown_1.removeAllItems();
for (var i=0; i < bookmarks.length;++i)
{
Dropdown_1.addItem(bookmarks[i].id, bookmarks[i].name);
}
if (bookmarks.length > 0)
{
Dropdown_1.getSelectedKey();
}
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 37/66
8/9/2020
For Button_2:
Sample Code
BookmarkSet_1.deleteBookmark(Dropdown_1.getSelectedKey());
When application users select the dropdown box, all the available bookmarks will be listed. And if they click the
Remove Bookmark button, the bookmark chosen in the dropdown will be deleted.
Related Information
Bookmarking Current State
A theme is a one-stop solution to your enterprise's branding. It provides you with a consistent look and feel that complies to the
corporate standard, while differentiating itself from hundreds of other apps. As an application designer, you can de ne a theme to
store your favorite styles of canvas, pages, popups, and different types of widgets, or choose an existing theme to change the
application's look and feel instantly.
After you create a theme, it's saved to the Files repository. You can reuse it in any other analytic applications according to your
needs.
In the following topics, you will learn how to create, use, modify, and delete a theme, and how to override the theme settings of a
speci c widget.
Tasks
Creating a Theme
Creating a Theme
As an application designer, you can follow the steps below to create a new theme.
Prerequisites
To create a theme, you must have the appropriate permissions for this analytic application item. For example, the Application
Creator and Admin roles contain these permissions.
Procedure
1. Select (Theme) in the Display section and select Create Theme….
2. In the Theme Preferences dialog, change the background color of canvas or popups and different style settings of widgets
as you wish.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 38/66
8/9/2020
4. In the Save As New Theme dialog, choose a folder to store the theme and enter a name and optionally a description.
5. Click OK.
Results
The new theme is created and applied to the analytic application. You can also reuse it in any other analytic applications.
Prerequisites
To create and use a theme, you must have the appropriate permissions for the analytic application item. For example, the
Application Creator or Admin roles contain these permissions.
If the theme is created by another user, make sure you have access to the theme in the Files repository.
Procedure
1. Select (Theme) in the Display section and choose a theme:
Or you can click Browse for More Themes… to choose another theme from Files repository.
Once you have selected a theme, it applies to the analytic application instantly.
2. If you want to delete the theme, go to the Files repository to select the theme and click the (Delete) button.
3. (Optional) To override the theme preferences, you can select a widget, canvas, or popup and change its styles in the Styling
panel.
Note
Even if you change to another theme, the widget style you de ned in the Styling panel will be kept. But you can select
(Restore to Theme Preferences) on the upper-right corner of the Styling panel to restore to the current theme's
default setting.
a. Select (Preferences) to the right of the theme in the Theme dropdown list.
If you want to save these changes in the current theme, select Save Save and Apply .
Note
Theme updates will not only apply to your current theme, but also apply to all analytic applications using
the theme.
If you want to save these changes to a new theme, select Save as.
Results
If you open an analytic application whose theme is changed:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 39/66
8/9/2020
In edit mode, you can decide whether to apply the updated theme or keep the current theme settings by saving as a new
theme.
In view mode, the analytic application will display the latest theme settings.
In edit mode, you can decide whether to apply the default theme or keep the current theme settings by saving as a new
theme.
In view mode, the analytic application will display the Light Theme (Default) setting.
To specify a theme, use the syntax Application.setTheme(), type Ctrl + Space and the theme selector will
automatically pop up for you to choose the theme you want to apply from the Files repository. After you choose a theme, the
corresponding theme ID will be displayed in the syntax. If you choose not to de ne a theme in the syntax, then the application will
apply the default light theme instead.
Note
Currently, there's a limitation that calling the setTheme() API in a popup does not affect the theme settings in the popup. To
solve this, you can add a panel to a popup and include all widgets in it. Then, when you trigger the setTheme() API in a
popup, all widgets added to the panel will apply the new settings.
Here's an example that shows how to leverage the theme API to allow end users to switch between different themes for your
application.
Example
First add a drop-down widget Theme_Dropdown to the canvas. In the builder panel of the drop-down, ll the value column
with the theme IDs and the text column with corresponding theme names.
Sample Code
var themeId = Theme_Dropdown.getSelectedKey();
Application.setTheme(themeId);
Now, when users run the application, they can select a theme from the drop-down list to change to a different theme.
As well as using the theme API, you can also enable end users to apply a speci c theme when loading an analytic application by
directly adding the theme ID to the application's URL address. For example, like this:
https://master-app-building /sap/fpa/ui/bo/application/4FA12EC04829FDC682399273A7A3A0C?
mode=embed;themeId=D991AAEEC518947626D749EDFF57D64C
Busy indicator that displays automatically when loading is longer than the prede ned delay. Once it’s triggered, the entire
application is blocked.
Busy indicator that’s owned by an application, a pop up or a container such as a tab strip or panel. It’s de ned using APIs
and when it’s triggered, only the speci c container you de ne busy indicator for is blocked.
The busy indicator is by default not enabled, to enable an automatic busy indicator, do as follows:
2. In Loading Indicator Settings of the Application Settings, check the option Enable loading indicator when necessary.
3. (optional) Enter an information text that you want to display along with the loading indicator icon.
4. In Loading Indicator Delay, de ne when a loading activity is executed longer than how many milliseconds, the loading
indicator will show up.
Besides enabling an automatic busy indicator in the Styling panel, you can also choose to enable or disable such busy indicator
whenever needed using the API:
Code Syntax
Application.setAutomaticBusyIndicatorEnabled (enabled: boolean)
If you set a busy indicator to enabled via the API, its information text and loading indicator delay time will follow the corresponding
settings de ned in the Loading Indicator Settings of the Styling panel.
After a loading activity is completed, the loading indicator will automatically disappear.
an application
a pop up
Code Syntax
// Show busy indicator. And if the text parameter is specified, show the text along with the busy i
Application.showBusyIndicator(text?: string) // cover the whole page
Popup_1.showBusyIndicator(text?: string) // cover the pop up only
TabStrip_1.showBusyIndicator(text?: string) // cover the tab strip only
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 41/66
8/9/2020
Panel_1.showBusyIndicator(text?: string) // cover the panel only
The automatic busy indicator is fully independent of the busy indicators owned by each widget, which means that when automatic
busy indicator is enabled, it won’t affect calls to Application.showBusyIndicator() or
Application.hideBusyIndicator().
Example: Configure the show or hide of busy indicator when using PostMeassage API to send requests
Sample Code
In this example, you can write scripts to show the indicator when using PostMessage to send a request and hide the indicator
when getting the response from outside page.
button.onClick() {
Application.showBusyIndicator(); // Show application manual indicator
Application.postMessage(PostMessageReceiver.Parent, message, "http://localhost:8080");
}
Context
Only visible content on your application page can be exported to the PDF le. Therefore, the following invisible elements will not be
exported:
Besides these invisible elements, custom widgets and web page widgets won’t be exported.
For a popup, only a popup that’s visible in an analytic application, namely a popup a user has triggered to pop up when running an
application will be exported as a separate page in the PDF le.
Note
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 42/66
8/9/2020
Same as that in a story, for a R visualization widget, static plots will be exported. But if the R widget is written in RHTML
(iFrame) instead, it won’t be exported.
Procedure
1. In the Scripting section of the Outline, select right next to Export to PDF to create a technical object.
2. The side panel Export to PDF opens with a default name ExportToPDF_1 displayed. You can set the following properties
according to your needs:
Select the paper size of the exported PDF as Auto, A2, A3, A4, A5, Letter or Legal.
Select the orientation of the exported PDF as Landscape or Portrait. The Orientation option is disabled when the
paper size is set to Auto.
Edit the le name, the header, the footer for the exported PDF.
Choose whether or not to export the appendix. The appendix will be exported as separate page.
Choose whether or not to export the comments. Comments of invisible widget will not be exported. The comments
will be exported as separate pages.
Note
If you haven't enable the option Commenting in Embedded Mode via System Administration System
Configuration , the commenting related settings and APIs won’t take effect.
4. To invoke the Export to PDF function, write the script ExportToPDF_1.exportView() for the triggering event of the
canvas or a widget. For example, if you want to invoke the function when clicking a button, write the script for the
onClick() event of the button.
Note
Similar to exporting to PDF in a story, the API that triggers the export is supported only in Microsoft Edge and Google
Chrome, but not in Internet Explorer.
5. As an application designer, the properties you de ned in the Export to PDF panel will be the default export settings for all
users running the application. To offer end users the exibility to customize the export settings, you can design a new
settings panel or dialog by leveraging relevant APIs. For detailed information about the APIs, refer to Analytics Designer API
Reference.
Results
An exported PDF is saved to your local machine, which shows exactly what appears on the application running page.
Prerequisites
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 43/66
8/9/2020
To be able to schedule a publication, you must have the appropriate permission and turned on the mandatory system
con guration settings. For detailed information, refer to Schedule Publication Roles and Permissions.
Besides that, to be able to generate PDF for the publication, you must add an ExportToPDF technical object to the analytic
application.
Context
You can schedule a publication for both stories and analytic applications. Same as for a story, you can create a single schedule or a
recurring schedule. You can later view, modify, or delete an occurrence or a recurrence of the schedule in Calendar.
In this chapter, only the publication settings and con gurations speci c for the Analytics Designer are listed.
There are two ways of triggering PDF export when scheduling a publication for an analytic application:
Automatically generate PDF export. This is the default setting, PDF will be generated automatically when the render of
application is considered to completed. In this case, you don’t have to write scripts. An application will be considered fully
rendered when the last line of script in the onInitialization event is executed. Any event scripting happened after
that will be bypassed.
Manually generate PDF export via API. This is the advanced setting that we recommend if you want to control the timing of
the PDF export more accurately and not to miss any relevant event scripting happened after the onInitialization
event is completed.
In this case, we recommend you write the following script as the last line of code for the onInitialization event of
the Canvas:
If (Application.isRunBySchedulePublication()) {
Scheduling.publish();
The two schedule publication settings can be con gured in the Styling panel of the Canvas.
Procedure
1. Use either of the two ways to schedule publication for an analytic application:
On the Files page (from main menu, Browse Files ), select the analytic application that you want to schedule and
from the toolbar, select Schedule Publication from (Share).
In the application’s run time, from the toolbar, select Schedule Publication from (Share).
2. In the Schedule Publication dialog, by default, the name of the application is automatically lled as the name of the
schedule. You can edit the name as you wish.
3. In the Start eld, click to specify the start date and the time you want the schedule to run. Then click Add Recurrence if
you want to schedule publication based on a certain recurrence pattern.
6. Select the Include Analytic Application Link option, if you want to include in the email a link to navigate email recipients to
the analytic application.
7. To enable application users to customize the values of script variables when opening the application, turn on the option
Customize Script Variable.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 44/66
8/9/2020
Then you can add one or more script variables for application users to customize, as well as de ne a default value for each
of them.
Note
Only the variables that are exposed via URL parameters and can be con gured via URL will be included.
8. Add one or more views in the Distribution part to schedule and share customized views of your application or bookmarks of
the analytic application. You can specify same or different SAP Analytics Cloud recipients or non-SAP Analytics Cloud
recipients for each view.
Note
For each view, you’ll have up to 60 seconds to generate PDF export. If the time exceeds that limit, scheduling will skip
current task and continue to publish the next view.
9. (Optional) Edit the name of the PDF le from the File Name eld.
10. Click PDF Settings to con gure the PDF settings such as the paper size and choose whether to include appendix or
comment or not.
12. You can view, modify, or delete an occurrence or a recurrence of the schedule in the Calendar.
Procedure
1. On the Files page, select the check boxes for all analytic applications that you want to share and select
(Manage) Share .
You can either type a username or select (Add Usernames) to open a list of available users.
3. Under Access, select the permissions you want to grant the selected users. By default Read only access is selected.
Note
Users with read-only access are able to change the variables for the model in the analytic application. Changing the
model variables updates all the charts and tables in the application unless they were overridden.
Related Information
Modifying Sharing Settings
Context
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 45/66
8/9/2020
You can only modify the sharing settings for a single analytic application at a time. To set permissions for multiple applications,
select applications, then set permissions in the Access list in the Share dialog for analytic applications.
Procedure
1. On the Files page, select a check box beside an application.
4. (Optional) Select Add Users and Teams, and choose individual teams or users from the list, then assign permissions to
teams or users.
5. Select Save.
Results
When you share the selected analytic application, the settings you saved will be applied.
Note
The settings are only saved for an individual analytic application. If you select a different application, you will need to save new
share settings.
Using the posting message API, you as the application developer can realize either of the following scenarios:
Then you can trigger bi-direction communication between the host HTML page and analytic application using the provided
functions.
postMessage
This is to post messages from the analytic application to the host HTML page.
When an end user triggers a callback function in the analytic application side, the callback function sends out data to notify the
parent receiver page which hosts the iFrame, or, when there are multiple levels of web pages embedded in one another, to the top-
level HTML page of a speci c target origin.
You de ne whether to send data to a parent or the top HTML page by means of the parameter of the PostMessageReceiver.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 46/66
8/9/2020
postMessage (receiver: PostMessageReceiver, message: string, targetOrigin: string): void
onPostMessageReceived
This is to handle messages sent from the host parent or top HTML page in the analytic application. In scenario 2 below, the event
can also handle messages sent from an HTML page embedded via the web page widget in an analytic application.
Caution
We advise you always check the origin when receiving an event-triggered message, because a malicious site can change the
location of the window and therefore intercept the data you sent using the postMessage event without your knowledge.
In the current scenario, the parent window which hosts the iFrame can post messages to the analytic application's iFrame window
of speci c target origin. The messages posted are then retrieved by the analytic application and trigger changes accordingly, such
as updating some input data.
A Code Example
You embed an analytic application in a host HTML page. The URL of the host HTML page is http://localhost:8080.
First, you want to allow end users to post the company selection in the analytic application to the host HTML page. Write the script
below for the sending button:
Sample Code
var message = RadioButtonGroup_Company.getSelectedText();
Application.postMessage(PostMessageReceiver.Parent, message, "http://localhost:8080");
Then you want to allow end users to display the message received from the Host HTML page in a text box of the embedded
analytic application. Click the button beside Main Canvas, choose onPostMessageReceived and write the script below for the
application:
Sample Code
If (origin == “http://localhost:8080”) {
Text_ReceivedMessage.applyText(message);}
When the host analytic application's web page widget embeds a web application, you can post messages from the embedded
application to the host analytic application or the other way around.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 47/66
8/9/2020
Note
The target origin is optional. If left empty, the URL de ned in the web page widget will be taken as the target origin by default.
Case 1. Posting messages from the host analytic application to the embedded application
postMessage()
The event for handling messages sent from the host analytic application depends on the type of the embedded application:
If the embedded application is an SAP Analytics Cloud application, once the message is received, the embedded
application can use the event onPostMessageReceived() to handle the message.
If the embedded application is another web application, once the message is received, the embedded application can use
the event window.on("message") to handle the message.
Case 2. Posting messages from the embedded application to the host analytic application
The event for posting messages depends on the type of the embedded application:
If the embedded application is an SAP Analytics Cloud application, use the event Application.postMessage() to
post messages.
If the embedded application is another web application, use the event window.parent.postMessage to post
messages.
The event for handling messages sent from embedded application is:
Once the messages is received, the host application can use the event onPostMessageReceived() to handle the messages.
Context
You can transport your analytic applications with data, or choose other options. For more information, see Importing and
Exporting Content.
Note
The SAP Analytics Cloud software release versions installed on the source and target tenants need to match (same version) or
may differ in only one version.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 48/66
8/9/2020
The styling option is available in both stories and analytic applications. Only the styling options speci c to the analytics designer
are listed.
In the Size and Position, Left de nes the widget's distance to the left border of its parent container. The value of left margin can be
de ned as auto, pixel or percent. When a widget is smaller than its parent container, the sum value of its left margin, right margin
and the widget's width should be no bigger than the width of the parent container. But when the parent container is a panel or tab
strip, a widget's width alone can be bigger than the width of the parent container. This equally applies to the Top and bottom
margin and the widget's height.
When you select the Dynamic option, the Canvas Content Layout option displays, from which:
If you select the option Center Aligned, all contents in the canvas will always be center aligned horizontally after running
the application.
If you select the option Fit to Device, the canvas size will be automatically adjusted to the certain device size. If the size or
position of canvas’ contents position are de ned as auto or percent, their size or position will automatically t to the device
size. You can also enable the Live device preview bar to preview the contents on different devices as shown below.
Note
Before wave 2019.20, the canvas content layout of an analytic application is by default center aligned, now it's t to
device.
Configure Whether the Quick Menu Is Visible or Not During Application Runtime
In the Styling panel of a widget, the section Quick Menus controls whether the quick menu bar itself and the options in it are
visible or not when running the analytic application. Quick menu here refers to both the quick menu of a widget and data points in
a table or chart widget (see the example below).
To disable an option in a quick menu – for example, if you don’t want end users to export a chart for security reasons – you can go
to the Styling panel of the chart and uncheck the option Export as CSV in Quick Menus. Then the option won't be available when
running the analytic application.
Edit notification
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 49/66
8/9/2020
If you edit an application simultaneously with one or more different users at design time, you will get a system noti cation telling
you that there are other users editing the analytic application. This noti cation will also provide a link to save the application.
Save notification
If another user has already saved the application you are editing, you will get a system noti cation that the application has been
updated by another user. Additionally, you can save a copy of the application or open the last revision.
Note
At this time, you cannot use the keyboard shortcuts for saving the application because they are disabled.
To save the application under a new name, click Save a Copy. This will open the dialog for saving the application under a
name that you choose.
To open the newest version of the application, click Open Latest Revision. This will load the application that the other user
has saved.
Note
If you have made changes to the application and click Open Latest Revision, your changes will be lost.
If you ignore this noti cation, or close it, you are able to continue the work on your application. You may, however, only save a copy
of the application.
Note
The edit and save noti cations are displayed only if you use the supported Web browsers. As of today, these are Google
Chrome and Microsoft Edge.
To activate the query merge for SAP BW queries in your application, click (Edit Analytic Application) Query Settings . Select
Enable Query Merge.
Note
To activate the merge for SAP HANA calculation views in your application, click (Edit Analytic Application) Query Settings
and select Enable Query Batching. Here you can also determine the number of queries to be merged (at least 4 and at most
20).
Queries contain the same dimensions with the same hierarchies and drill.
The application does not have lters de ned inside the threshold panel.
The widget does not have a local lter on a dimension that is also used in a restriction in SAP BW.
Queries are part of the same receiver group if they use linked analysis.
The widget does not have a local lter on a member of the secondary structure of a query..
Bar/Column
Stacked Bar/Column
Stacked Area
Line
Bullet
Numeric Point
Context
Note
Lazy loading in analytics designer is currently only available for selected Beta customers. If you are interested in the Beta
program, please contact your SAP account manager.
Please note that the following conditions apply during the Beta period:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 51/66
8/9/2020
Your company acknowledges that the software is a preliminary version and not subject to any productive use license
agreement or any other agreement with SAP.
SAP has no obligation to include or remove any functionality from the software in any future version or in any SAP
standard product.
To run lazy loading for your application, you can do the following:
Procedure
1. For data-bound widgets in your application (tables or charts), check the widget property Disable Initial Load in the Builder
panel.
2. Call the script function getDataSource().load() of data-bound widgets at the point in time when the widgets should
be loaded. Usually this script is part of an event handler script triggered by a user interaction; for example, the onClick
handler of a button widget.
Example
Chart_1.getDataSource().load();
Please note that directly opening the analytic application from the Files Repository is not supported.
Prerequisite
First mark an application as mobile enabled. To do this, from the File in the toolbar, choose (Edit Analytic Application) Analytic
Application Details , and turn on the option Access the app from mobile device.
Before viewing an analytic application in Safari, go to Safari browser’s setting Preference Privacy and uncheck two options:
Prevent cross-site tracking and Block all cookies.
Also make sure you've met the minimum requirements for iOS and iPad. For details, refer to the Mobile Requirements section in
System Requirements and Technical Prerequisites.
Restrictions
When working with an analytic application on a mobile device, the widgets below are not supported:
Geo map
R visualization
Custom widget
When working with an analytic application on mobile devices, the SAP Analytics Cloud features below are not supported:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 52/66
8/9/2020
Creating a story from a widget
Smart discovery
Smart insight
Data explorer
API support
There's an API that indicates whether the app is in mobile mode or not:
Application.isMobile(): Boolean
Using Popups
You can use popups to design interactive analytic applications and dashboards.
Context
The popup helps application users to quickly enter information, perform con gurations, or make selections. You can also use
them to display more speci c data for a selected item displayed on the main page of the application. Because the popup acts as a
container widget, you can put any other widget into the popup, such as a table, button, or checkbox.
As an application designer, you can choose to design a popup starting from scratch, or enable the header and footer setting to
turn the popup directly into a popup dialog that has a consistent look and feel compared to other dialogs in SAP Analytics Cloud
stories.
Procedure
1. In the Outline panel, expand Layout and click the button right next to Popups to create a new popup.
Its icon and a default name are displayed under the Popups.
3. If you want to turn the popup into a dialog, go to the Designer panel and choose the Builder tab. In the Popup Settings, turn
on the Enable header & footer option. Otherwise, skip to step 5.
4. Optional: If you want to change the dialog title, add or remove buttons, change the IDs and descriptions of the buttons, or
customize the button details such as visible or not, enabled or not, and highlighted or not, do so in the Builder panel, then
click Apply to apply all the settings.
5. Design the popup by adding widgets to the popup, such as dropdown boxes, tables, or charts. These widgets are the
visualization of the popup. If no widgets are added, even if you save the empty popup to the analytic application you won't
see the popup displayed when you trigger it while running the analytic application.
For pop-up dialogs, you can only add widgets to areas other than the header and footer.
6. Edit the style of the popup in the Styling panel; for instance, to change the popup's height and width.
Note
The height and width you set won't take effect if you add only one widget to the popup. To run the popup as designed,
make sure you add more than one widget to the popup.
7. Add a script to the popup by clicking the widget corresponding to the popup in the Outline panel and selecting the
button.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 53/66
8/9/2020
The script editor opens in a new tab where you can add scripts.
Note
In the script editor you can use the value help for data-related values when writing scripts. Consider the following points
when using this value help:
The value help is always available for data-related widgets, such as tables and charts, in the main canvas.
For widgets in popups, the value help is only available after the popup has been opened at least once:
If you save an analytic application with tables or charts in a popup and reopen it, the value help is not
available in the popup for these widgets unless you open the popup at least once in design time.
8. To return to the popup itself or to the main canvas, click the button and choose your popup or the main canvas.
9. To delete the popup, choose the button next to your popup in the Outline panel and choose (Delete).
Related Information
Known Limitations to Analytics Designer
Context
As an application designer, you can follow the steps below to add and con gure an input eld.
Procedure
1. On a canvas or popup page, select Input Field .
2. In the Styling panel, enter a name for the input eld widget. By default, the name is InputField_1.
If you disable this option, no hint will be displayed either in the analytic application design time or at runtime. After
enabling this option and entering a hint, when application users later start to enter a value in the text box during the
analytic application runtime, the hint will be overwritten by the user-entered text automatically.
4. In InputField Style, con gure the style of the input eld such as border, background, and font size.
5. After you create and con gure the input eld widget, you can leverage existing APIs to receive user input for further
processing:
To get and set the value, use the APIs getValue() and setValue().
To tell whether an input eld is enabled or not and set an input eld to enabled, use the API isEnabled() and
setEnabled() respectively.
To tell whether an input eld is editable or not and set an input eld to editable, use the API isEditable() and
setEditable() respectively.
Note
The difference between a disabled status and not editable status is that when you set the API setEnabled()
to false, the input eld will be grayed out during analytic application runtime, while the status not editable is not.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 54/66
8/9/2020
To trigger certain actions when the focus is no longer in the input text box during analytic application runtime, for
example, when users type Enter in the keyboard after entering a text, use the API onChange().
These planning applications support both manual and automated data entry and changes to data. You can enter the planning data
manually in the table (in cells or rows) or use data actions to enter data automatically.
Note
At design time you cannot enter values in the table.
Entering Data
You can enter data by clicking in the cell and entering values. After you have entered data, the changed cells are highlighted in the
table. For more information, see Entering Values in a Table.
This menu entry is displayed at design time and runtime. It is only shown if the table is based on a planning model that
supports backend data locks.
If you click the entry, the button toggles between the two states. By default the data locks are enforced, so Ignore Data
Locks will be shown.
Data Locks
This menu entry is used to display data locks if there are any. It is only displayed at runtime and only if the table is based on
a planning model that supports backend data locks.
This menu entry is only displayed at runtime. It is used to enter data to multiple cells, without causing a round trip. For
more information, see Entering Multiple Values in a Table.
This menu entry is only displayed at runtime. It is used to lock cells in the frontend whose values should not change. For
more information, see About Value Lock Management.
The Data Action Trigger cannot be executed at design time, only at runtime. For more information, see the following chapters:
Data Actions
You can add theBPC Planning Sequence from the Insert section of the toolbar: In the toolbar, click Add BPC Planning
Sequence to open the BPC Planning Sequence Trigger dialog box. In the dialog box select an existing SAP BPC model and a
planning sequence.
After having added the BPC Planning Sequence, also add a table with the same model as the BPC Planning Sequence to the
application. The planning sequence is applied to the table when the application user clicks on the BPC Planning Sequence widget
at runtime.
The BPC Planning Sequence widget cannot be executed at design time, only at runtime. For more information, see the following
chapter:
Add and Trigger Planning Sequence for a BPC Live Data Connection Model
The Plan section in the toolbar is only shown if there is a planning-enabled table available in the application. If not, the section is
hidden. The planning toolbar buttons are only available at runtime:
Publish Data
Version Management
History
Allocate values
spreading a value
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 56/66
8/9/2020
For more information, see Spreading a Value.
distributing a value
assigning values
execute allocation
Note
If you use BPC live data connections you can switch between read-only and input mode for tables at runtime by using the
table's quick actions menu (Switch to Read-Only Mode and Switch to Input Mode)..
At design time, you can program whether the table should be switched to input or read-only mode with the help of the
setEnabled( API:
If you use the script (for example for a button) Table.getPlanning().setEnabled(false), the table is switched
to read-only mode when the application user clicks the button..
If you use the script Table.getPlanning().setEnabled(true), the table is switched to input mode.
Note
If you set the setEnabled() API to false, on a table with BPC Live Data Connection with an input-ready query, two cases can
occur:
If no data cells have been changed, the table will be set to read-only and the according locks in BPC will be released.
If data cells have been changed, no publish dialog will be shown. The table will be set to read-only mode and the locks
and the changed data are kept in the BPC System. If the data is published or reverted with the help of APIs, the kept
data is removed, and the BPC locks are deleted.
For enabling the predictive forecasts at runtime you as an application designer have to use a planning model for the table in the
application. Besides you need planning rights and a planning license to run a predictive time series forecast: either SAP Analytics
Cloud for planning, standard edition or SAP Analytics Cloud for planning, professional edition.
At runtime the application user selects a single cell that can be edited and selects the (Predictive Forecast) button in the
toolbar.
Related Information
Predictive Time Series Forecasting
Running a Predictive Time Series Forecast
Features by License Type for Planning Models
After adding a time-series forecast chart, you as an application designer can leverage the APIs provided to let end users customize
forecast periods and enable automatic forecast in a line chart. For example:
Sample Code
Chart_1.getForecast().setType(ForecastType.Auto);
For more detailed information about the API, refer to Analytics Designer API Reference in the SAP Help Portal.
Related Information
Running a Forecast in a Time Series or Line Chart
Features by License Type for Planning Models
Explorer
When you run an analytic application, you can launch the Explorer for a chart or table to select different dimensions and
measures, experiment with lters, and more.
Note
Before running an application and initiating the explorer, you need to enable the explorer for the charts or tables in the Builder
tab of the Designer panel as you do for an ordinary story.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 58/66
8/9/2020
There are two ways to launch the explorer:
Save the application and choose Run Analytic Application. Just as you do in a story, select the chart, and then select
(Explore).
Leverage the script API to launch the explorer mode in the application to generate charts or tables for data exploring. The
script API can set additional dimensions and measures to the current data source in explorer mode and trigger launching
of explorer. For example:
Sample Code
//Add Travel_Date and Traveler dimensions to current dimension scope for data exploration.
Chart_1.getDataSource().getDataExplorer().setAdditionalDimensions([“Travel_Date”, “Traveler”])
For more detailed information about the APIs, refer to Analytics Designer API Reference in the SAP Help Portal.
In the Explorer, you see a faceted view of your data, which you can manipulate to generate charts for preview. To be able to save a
chart to a new story directly from the Explorer, select the option Create Story from Widget in the section Quick Menus of the
chart widget's Styling panel when you design the analytic application. You'll then be able to select the icon in the Explorer's
visualization area and choose Create a New Story.
Smart Insights
Smart insights automatically discovers key insights, including correlations, exceptions, clusters, links, and predictions of data, and
brings you straight to the results instead of requiring time-consuming manual data exploration.
You also need to make sure you have selected Smart Insights in the Quick Menu section of the Styling panel of the corresponding
chart or table widgets.
There are two places you can trigger smart insights for a chart or a table:
After you run the analytic application, trigger smart insights by selecting a data point in a chart or right clicking a data cell
in a table.
After you run the analytic application and enter the Explorer mode of a certain data point, go to the visualization area and
trigger smart insights by selecting a certain data point in the chart or right clicking a data cell in a table.
Note
You cannot trigger smart insights for charts and tables in a popup.
Furthermore, you can continue to run smart insights with generated data in the smart insights panel or create a story based on the
visualization generated in smart insights if you've enabled creating story for the chart or table widget when designing the
application. To do this, in the Quick Menus section of the chart or table widget's Styling panel, select the option Create Story from
Widget.
In the analytics designer, you can only provide access to Smart Discovery functionality via Script APIs.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 59/66
8/9/2020
version (optional)
For more detailed information about the APIs, refer to the component SmartDiscoveryDimensionSettings and
SmartDiscoveryMeasureSettings in Analytics Designer API Reference in the SAP Help Portal.
Launching via user interaction events such as clicking a button or selecting a chart. These cause a dialog with the Smart
Discovery URL to pop up. Application users can click it to launch Smart Discovery in a new browser page.
Generating a URL and set the URL to a widget’s hyperlink property. The application users can then click the widget to
launch Smart Discovery in a new browser page. Widgets can be an image, shape, or text.
For more detailed information about the APIs, refer to the component SmartDiscovery in Analytics Designer API Reference in the
SAP Help Portal.
After you trigger Smart Discovery, you will see the Smart Discovery con guration panel displayed and lled with prede ned
settings. Con rm the settings and click Run. Smart Discovery will be automatically executed and display the results in a newly
created story.
Note
In the same way as for a story, the interface can only identify and work with words in English.
Search to Insight displays query results for indexed live HANA data models and acquired data models that you have access to, or
any dimensions that do not have Data Access Control or have granted Data Access Control to you.
Simple mode – this is designed for application users with little knowledge of the models behind Search to Insight who want
to perform searches by simply asking questions.
Advanced mode – this is designed for application users who have some knowledge of the models and dimensions behind
the data and want to switch models and select dimensions according to their needs when querying data.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 60/66
8/9/2020
1. In the Scripting section of the Outline, select right next to Search to Insights to create a Search to Insight.
The side panel Search to Insight opens with a default name of the Search to Insight displayed. You can change the name at
will.
2. In Models to Search, select Add Model to add one or more models you want to query.
Note
Only models supported by Search to Insight can be added to the Search to Insight component. For live data models,
only indexed live HANA data models are supported. Acquired data models don’t need to be indexed manually. Indexing
is automatically triggered for acquired data models when you perform a query on the models for the rst time.
Related APIs
After adding the widget to the canvas or popup, as an application designer you can leverage the following APIs to open or close a
Search to Insight dialog:
Code Syntax
//Display the Search to Insight dialog. If the dialog is already open, the query interface and mode
SearchToInsight_1.openDialog(question: string, mode: string, ?cleanHistory:boolean, ?autoSearch: bo
//Can be called by PostMessage API when a Search to Insight dialog is open to close the dialog
SearchToInsight_1.closeDialog(): void;
You can also apply search to insight results to a chart using applySearchToChart() API and leverage the following variable related
APIs to save variable value in a Search To Insight component and apply to chart when calling applySearchToChart():
Code Syntax
//get model variable
SearchToInsight_1.getVariables(modelId: string): VariableInfo[]
// Search by input question within selected search to insight model and apply the results to a char
SearchToInsight_1.applySearchToChart(question: string, chart: chart): boolean
Example
In this example, you can design a simple application to let application users trigger different modes of Search to Insight for the
questions they enter.
First, in addition to the scripting object SearchToInsight_1, add an input eld (InputField_1), a button (Button_1)
and a checkbox group (CheakboxGroup_1) to the Canvas as below:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 61/66
8/9/2020
Then write the following script for the button widget Button_1:
Sample Code
var mode = SearchToInsightDialogMode.Simple;
if (CheckboxGroup_1.getSelectedKeys().length !== 0)
{
mode = SearchToInsightDialogMode.Advanced;
}
var inputText = InputField_1.getValue();
SearchToInsight_1.openDialog(inputText, mode, false, true);
Result: After you save the application and choose Run Analytic Application, application users can either trigger simple mode by
entering a question and clicking the Search to Insight button, or trigger advanced mode by entering a question, selecting the
Advanced mode, then clicking the Search to Insight button.
Example 2: Receive Question from Host HTML Page and Apply Search to Insight Results to a Chart
Example
In this example, you can build your own search to insight user interface and integrate search to insight results to your own
portal.
First, embed your analytic application in your own portal via iFrame and maintain corresponding code to get the message users
input in the portal and post it to the embedded analytic application.
Then go back to the analytic application, besides adding the scripting object SearchToInsight_1, write the following script
for the onPostMessageReceived event of the application:
Sample Code
SearchToInsight_1.applySearchToChart(message, Chart_1);
Chart_1.setVisible(true);
Result: After that in your own portal, users can ask a question and see the chart of the embedded analytic application appear
and display corresponding search to insight results.
Using OData
You can de ne OData Services in SAP Analytics Cloud, analytics designer based on an existing on-premise SAP S/4HANA live
connection in your system which was created using CORS (Cross-origin resource sharing) connectivity. Additionally, you can also
de ne OData Services based on SAP BW systems, SAP HANA systems, and SAP Business Planning and Consolidation (BPC)
systems (that were also created using CORS).
You can create an OData service, de ne the endpoint URL and trigger the execution of the action by using scripts.
OData services can be used to trigger transactional actions at the backend like lling out an order form or other forms.
In analytics designer, OData actions can be called from and executed in the backend system via scripting inside an analytic
application. Furthermore, it is also possible to read and use the data of entity sets (exposed via OData services) by using APIs.
OData action imports, also called unbound actions are not associated with any OData entity set or entity. They generally
expose simple parameters. All parameters are set via POST body.
OData bound actions are actions which may be invoked on a speci c entity. They always contain a rst parameter which is
set via URL (to resolve the binding to the entity within the relevant entity set), and all other parameters are set via POST
body.
In general, actions can be bound on every type, but in analytics designer only binding on single entities is supported.
For OData you should con gure the CORS (direct) connection at the backend. Please follow the instructions for the
connection con guration in this chapter Live Data Connections to SAP S/4HANA.
In the documentation chapter for the connection con guration (see link above) the CORS connection is referred to as
direct connection.
Note
Note the following important additional con guration information:
The service path that you con gure should correspond to the end-point URL of the OData service.
In addition to the service path listed in the documentation, you need to add another service path:
/sap/opu/odata4/
Only parameters of simple types are supported. Actions with mandatory parameters of unsupported types are not
available. For actions with optional parameters of unsupported types, the action itself is supported but those parameters
are not.
In case of bound actions, actions which are bound to an entity collection are not supported. Only actions which are bound
to a single entity are supported. It is only possible to set this binding parameter by specifying the key of the entity on which
the action should be carried out.
Edm.Stream
Edm.Untyped
Related Information
Adding an OData Service
Example 1: Using OData Actions in an Application
Example 2: Using OData Actions in an Application
Reading Data from OData Services
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 63/66
8/9/2020
Prerequisites
Have ready the end-point URL of the OData service. You'll need to enter it manually when creating the service.
Procedure
1. In the Scripting section of your analytic application, click (Add OData Services).
A new entry with the default name ODataService_1 appears below the OData Services node. A side panel opens on the
right.
a. Change the default name of the new service to a meaningful name, if you want.
b. Select the system from the list of available SAP S/4HANA systems whose connections were already created in SAP
Analytics Cloud under Connections.
c. Manually enter a valid end-point URL of the OData Service, in the format /some/end_point/url/.
You need to know the URL because there is no browse catalog available.
3. Click the refresh button next to Metadata to review the metadata of the new OData service.
Results
Now you can use the OData action. For further information, please see Example 1: Using OData Actions in an Application
Related Information
Using OData
Example 2: Using OData Actions in an Application
This lets you use the data of the entity sets for any purpose except data visualization in a table or a chart. For example, you can
read and display one member in a text widget. To access entity sets exposed via OData Services, you can use two APIs in your
script:
getEntity: for retrieving a single OData entity from an entity set, by specifying the key to the entity. This is similar to
selecting a single row from a SQL table via SELECT * FROM T1 WHERE ID = <id>.
getEntitiesFromEntitySet: for retrieving all entities from an OData entity set. This is similar to SELECT TOP <N> *
FROM T1. With this API you can use the OData system query options filter, orderby, select, count, top and skip.
Note
The number of entities is limited to 1000 if no system query options have been used. If system query options are set,
the number of retrieved entities is not limited, unless you set a value for the system query option top. top.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 64/66
8/9/2020
getEntitiesCountFromEntitySet: for retrieving the number of entities from an OData entity set. This API works
like the getEntitiesFromEntitySet API and you can also use the OData system query options filter, orderby,
select, count, top and skip.
Example
The parameters lter, orderby, and select have string values which will be 1:1 used in the OData request. This allows you to use
all features supported by the query options. The parameters skip and top have integer values, that will be used in the OData
request. The second parameter in both API methods is passed as object, in which the system query options can be combined
in an arbitrary way.
Sample Code
// returns a list of entities, filtered by the given system query option(s)
ODataService_1.getEntitiesFromEntitySet("Departments", {filter: "contains(Sector,'Consulting')", or
// returns a list of entities, not filtered
ODataService_1.getEntitiesFromEntitySet("Equipments");
// returns the number of entities in the entity set "TEAMS"
ODataService_2.getEntitiesCountFromEntitySet("TEAMS");
// returns the number of entities in the entity set "EMPLOYEES", filtered by the given system query
ODataService_2.getEntitiesCountFromEntitySet("EMPLOYEES", {skip: 5, top: 10});
Note
When you want to read data from OData services, note the following feature limitations:
When you open an application in present mode, at rst you don't see the toolbar. However, when you hover the mouse cursor at
the top of the page, the toolbar appears. To switch to view mode, click the Display button in the toolbar. In view mode the
toolbar is xed and always displayed in the application.
data section
The Data section is always shown and contains two toolbar buttons, which are also available during design time.
Refresh data
Edit Prompts
display section
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 65/66
8/9/2020
The Display section is always shown in present and view mode. It contains the (fullscreen) button, which is not available
during design time.
plan section
The Plan section is only shown if there is a planning-enabled table available in the application. If not, the section is hidden.
See Working with Planning Applications.
ul
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 66/66