0% found this document useful (0 votes)
65 views33 pages

SAP SAC Document Design

Sap document analytics ⁷

Uploaded by

ksjoshisapcode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views33 pages

SAP SAC Document Design

Sap document analytics ⁷

Uploaded by

ksjoshisapcode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Contents

Introduction .................................................................................................................... 13

1 Introduction to Scripting 17

1.1 What Is Analytics? ......................................................................................... 17


1.2 Analytical Software ...................................................................................... 19
1.2.1 Reports ............................................................................................... 19
1.2.2 Dashboards ....................................................................................... 20
1.2.3 Self-Service Dashboards ............................................................... 22
1.2.4 Dashboards with Scripting .......................................................... 22
1.3 Positioning Dashboards with Scripting within
SAP’s Analytics Strategy ............................................................................. 23
1.3.1 SAP’s Analytics Strategy ............................................................... 23
1.3.2 SAP Analytics Cloud ....................................................................... 23
1.4 Summary ........................................................................................................... 26

2 Basics of SAP Analytics Cloud 27

2.1 Architecture of the System Landscape ................................................ 27


2.1.1 Three-System Landscape ............................................................. 28
2.1.2 Change to a Two-System Landscape ....................................... 28
2.2 Menu Navigation and Important Functions ...................................... 29

2.3 Data Integration ............................................................................................ 32


2.3.1 Live Data Connections .................................................................. 32
2.3.2 Data Import Connection .............................................................. 33
2.3.3 Creating a New Connection ........................................................ 34
2.4 Data Modeling ................................................................................................ 35
2.4.1 Datasets ............................................................................................. 35
2.4.2 Models ................................................................................................ 35
2.5 History of Scripting in SAP Analytics Cloud ....................................... 36

2.6 Difference between Stories and Advanced Mode .......................... 37


2.6.1 Differences for Consumers ......................................................... 38
2.6.2 Differences for Creators ............................................................... 38

7 7
Contents Contents

2.7 Development Environment ....................................................................... 38


2.7.1 General Structure ............................................................................ 40
2.7.2 Design of a Story ............................................................................. 43
2.7.3 Keyboard Shortcuts for Input Help ........................................... 45
2.8 Authorization for Scripting with SAP Analytics Cloud .................. 47

2.9 Conversion of a Classic Story or Analytic Application ................... 53

2.10 Summary ............................................................................................................ 56

3 Development of Business Intelligence


Applications 57

3.1 Widgets .............................................................................................................. 57


3.1.1 Panel Widgets .................................................................................. 58
3.1.2 Tab Strips ........................................................................................... 59
3.1.3 Page Books ........................................................................................ 60
3.1.4 Flow Layout Panel ........................................................................... 61
3.1.5 Input Field and Text Area ............................................................. 61
3.1.6 Dropdown Lists ................................................................................ 63
3.1.7 Checkbox Groups and Radio Button Groups ......................... 63
3.1.8 Buttons ............................................................................................... 64
3.1.9 Simple Sliders and Range Sliders ............................................... 64
3.1.10 Filter Line ........................................................................................... 65
3.1.11 List Boxes ........................................................................................... 66
3.1.12 Switch ................................................................................................. 66
3.1.13 Popups ................................................................................................ 66
3.2 Application Programming Interfaces .................................................... 69
3.2.1 Standard ............................................................................................. 70
3.2.2 Container ........................................................................................... 77
3.2.3 Chart .................................................................................................... 79
3.2.4 Datasource ........................................................................................ 80
3.2.5 Visualization Controls ................................................................... 81
3.2.6 Advanced Controls ......................................................................... 82
3.2.7 Input Controls .................................................................................. 83
3.2.8 Table .................................................................................................... 84
3.2.9 Export .................................................................................................. 85
3.2.10 Bookmark ........................................................................................... 85
3.3 Developing a Story with Scripting for Reporting ............................. 86
3.3.1 What Questions Do I Ask Myself Before Development? .... 86
3.3.2 How Do I Build a Story? ................................................................. 87

8 8
ContentsContents

3.4 Integration of Predictive Analytics Functions .................................. 110


3.4.1 Smart Discovery .............................................................................. 110
3.4.2 Search to Insight ............................................................................. 113
3.4.3 Data Change Insights .................................................................... 114
3.5 Best Practices ................................................................................................... 114

3.6 Summary ........................................................................................................... 116

4 Development of Planning Applications 117

4.1 Widgets .............................................................................................................. 117


4.1.1 Comment .......................................................................................... 118
4.1.2 Value Driver Tree ............................................................................ 120
4.1.3 Data Action Trigger ........................................................................ 122
4.1.4 Multi Action Trigger ....................................................................... 125
4.1.5 Recommendation for the Use of Data Actions and
Multi Actions .................................................................................... 127
4.1.6 SAP Business Planning and Consolidation Planning
Sequence Trigger ............................................................................ 128
4.2 Application Programming Interfaces ................................................... 128
4.2.1 DataAction ........................................................................................ 128
4.2.2 ODataService ................................................................................... 135
4.2.3 MultiAction ....................................................................................... 136
4.2.4 Planning ............................................................................................. 136
4.2.5 PlanningModel ................................................................................ 148
4.2.6 DataSourceComments ................................................................. 148
4.3 Data Connection for Writing Back Data .............................................. 150
4.3.1 OData in Stories .............................................................................. 150
4.3.2 Setting Up OData Services .......................................................... 152
4.3.3 Reading Data from an OData Service ...................................... 154
4.4 Developing a Story with Scripting for Planning .............................. 155
4.4.1 Preparation of the Sample Story ............................................... 156
4.4.2 Use Cases of Specific Methods of the Planning
Application Programming Interface ........................................ 157
4.4.3 Examples of Specific Methods of the PlanningModel
Application Programming Interface ........................................ 166
4.4.4 Examples of Individual Methods of the DataSource-
Comment Application Programming Interface ................... 173

9 9
Contents Contents

4.5 Best Practices ................................................................................................... 178


4.5.1 Entry into the Planning Story ...................................................... 178
4.5.2 Assistance for Users ....................................................................... 180
4.6 Summary ............................................................................................................ 182

5 Custom Widgets 183

5.1 What Are Custom Widgets? ...................................................................... 183


5.1.1 Restrictions ....................................................................................... 184
5.1.2 Hosting Custom Widgets ............................................................. 186
5.2 Setup of Custom Widgets .......................................................................... 188
5.2.1 JSON Custom Widget Reference Document .......................... 189
5.2.2 JavaScript Web Component ........................................................ 200
5.2.3 Styling Panel ..................................................................................... 207
5.2.4 Builder Panel ..................................................................................... 208
5.3 Creating, Uploading, and Removing a Custom Widget ................ 209
5.3.1 Creation of a Custom Widget ..................................................... 209
5.3.2 Hosting a Custom Widget ............................................................ 210
5.3.3 Uploading a Custom Widget ....................................................... 212
5.3.4 Deleting Custom Widgets ............................................................ 215
5.4 An Example of a Custom Widget: The Colored Box ....................... 215
5.4.1 JSON File of the Custom Widget ................................................ 217
5.4.2 JavaScript Web Component ........................................................ 222
5.4.3 Styling Panel JavaScript Web Component ............................. 226
5.4.4 Builder Panel JavaScript Web Component ............................. 231
5.5 Custom Widgets on Mobile Devices ...................................................... 236
5.5.1 Activation of Custom Widgets for Mobile Devices .............. 237
5.5.2 Recognizing the End Device ........................................................ 237
5.5.3 Useful Tips for Developing Custom Widgets for
Mobile Devices ................................................................................. 237
5.6 Exporting Custom Widgets ........................................................................ 239

5.7 Best Practices ................................................................................................... 240

5.8 Summary ............................................................................................................ 240

10 10
ContentsContents

6 Provision and Operation Stories with


Scripting 241

6.1 Sharing Stories within SAP Analytics Cloud ...................................... 241


6.1.1 Sharing and Managing Content ................................................ 241
6.1.2 Lifecycle Management ................................................................. 249
6.2 Embedding Stories in Websites .............................................................. 252
6.2.1 Embedding a Story ......................................................................... 252
6.2.2 Embedding a Web Application .................................................. 253
6.3 Performance Monitoring ............................................................................ 254
6.3.1 Performance Analysis Tool .......................................................... 255
6.3.2 Benchmark Tool .............................................................................. 257
6.3.3 Statistics and Analysis .................................................................. 258
6.3.4 Data Action Statistics and Analysis .......................................... 259
6.3.5 Popup to Analyze the Script Performance ............................. 260
6.3.6 Browser Development Tools and Debuggers ........................ 261
6.4 Best Practices for Performance ............................................................... 264
6.4.1 Pausing Updates ............................................................................. 264
6.4.2 Loading in the Background ......................................................... 265
6.4.3 Widget Initialization at Startup ................................................. 265
6.5 Summary ........................................................................................................... 266

7 Outlook 267

7.1 Roadmap ........................................................................................................... 267


7.2 Joule .................................................................................................................... 269

7.3 Summary ........................................................................................................... 270

Appendices 271

A Important Literature .................................................................................... 271

B The Authors ...................................................................................................... 273

Index .................................................................................................................................. 275

11 11
Chapter 6
Provision and Operation Stories with
Scripting
This chapter looks at various options for providing stories in general, the
6
enhancement of stories through scripting, and operational issues such as
performance monitoring and notifications of updated data.

In Section 6.1, “Sharing Stories within SAP Analytics Cloud,” we’ll look with What you can
you at the various options for sharing stories with other users. You can expect

share stories via the file system or via the SAP Analytics Cloud catalog, and
there are additional setting options for the mobile app. In Section 6.2,
“Embedding Stories in Websites, we’ll explain how you can embed your
story in other websites. Section 6.3, “Performance Monitoring,” takes up a
large part of this chapter and is dedicated to performance monitoring.
Since scripting is much more complex and specialized than simple stories,
performance problems are more likely to occur. Finally, in Section 6.4, “Best
Practices for Performance,” we provide some onboard tools and options for
detecting and limiting potential performance problems.

6.1 Sharing Stories within SAP Analytics Cloud


First, we’ll take a closer look at sharing and managing stories in SAP Analyt- Sharing stories
ics Cloud. In particular, we’ll look at the various management and provi-
sioning options via the catalog or the file system in SAP Analytics Cloud,
and then, we’ll take a look at lifecycle management. A multilevel system
landscape is particularly important for scripting, which means that content
must also be transported between these systems.

6.1.1 Sharing and Managing Content


There are basically two ways to share stories: via the file system and via the
analytics catalog. There’s also a third option, in which you don’t share the
story itself but instead send the content of your story as a PDF file. We’ll
now take a closer look at these three options.

241 241
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

File system File System


In the Files area of SAP Analytics Cloud, you have the option of sharing your
story with other users (see Figure 6.1), who can be individuals or teams.

Prerequisite for Sharing Stories


Stories can only be shared with users if they have been granted the appro-
priate authorization in advance.

Figure 6.1 Suboptions for Story Access

There are four different authorization options:


 View
With this authorization, a user can read and copy the story as well as
view and add comments.
 Edit
With this authorization, a user can update and edit the story.
 Full Control
With this authorization, a user can delete and share the story and delete
the comments in the story.
 Custom…
With this authorization, a user can adjust the individual predefined
authorizations (see Figure 6.2).

Figure 6.2 Setting Options for User-Specific Access

242 242
6 Provision6.1
andSharing
Operation Stories
Stories withSAP
within Scripting
Analytics Cloud

If you share a story in the file system, you also have the option of customiz-
ing the URL to be shared by using the Customize link button.
You can enter URL parameters and partially replace the URL with keywords Creating your own
so that it’s shorter and therefore easier to remember. You can see an exam- URL

ple in Figure 6.3.


The URL https://demo.eu10.sapanalytics.cloud/sap/fpa/ui/tenants/9c5ff/
bo/application/1AB01886262CB3AD71215EF548463BB0?mode=present becomes 6
https://demo.eu10.sapanalytics.cloud/link/Demo. The new URL is significantly
shorter and therefore easier to remember.

Figure 6.3 Customizing URL

You also have the option of informing the recipient by email about sharing
the application or specifying a global bookmark as the default. As the appli-
cation designer, you can also give your users the option of opening the
dialog box for sharing the runtime:

Application.openShareApplicationDialog();

Analytics Catalog
You can also share your story via the analytics catalog of SAP Analytics Share stories with
Cloud. This can be activated by your administrator, and if it’s activated, the analytics
catalog
you’ll find a corresponding Catalog tab on your start page (see Figure 6.4).
The catalog is the central access point within SAP Analytics Cloud. You can
customize the individual catalog tiles, add tabs, and define your own filter
criteria.

243 243
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Figure 6.4 Overview of Catalog

If you want to publish your story in the catalog, you can release it at team
level but not at user level. You can also specify whether you want to grant
or deny read access (see Figure 6.5), which has the following effects:
 Granting read access
If you grant read access, teams with it can open the tile and the story
behind it.
 Denying read access
If you deny read access, users from the team will see the tile in your cat-
alog but won’t be able to access the story. However, they can send access
requests to you via this tile.

Figure 6.5 Publishing Story in Catalog

244 244
6 Provision6.1
andSharing
Operation Stories
Stories withSAP
within Scripting
Analytics Cloud

All Authorizations Must Be Assigned Correctly


In addition to read permission in the catalog, users need permission to
read the story and the associated models.

Publication of Stories
6
Another way to share your story is to publish it. This involves converting Sending story
your story into a PDF document and sending it by email to SAP Analytics
Cloud users and external persons.
The frequency of the possible dispatch times depends on your licensed
number of SAP Analytics Cloud users. You can check the current number of
available releases in your system overview (see Figure 6.6).

Figure 6.6 Overview of Available Publications

You can schedule this publication at a single predefined time or repeatedly


at regular intervals, and you can also adjust available script variables.

Limited Dispatch to External Persons


You can send publications to external persons at no more than three email
addresses.

To be able to use this function in your story, you must create a technical
object for PDF export (see Figure 6.7). In this object, you can select the
included widgets and make the following general settings:

245 245
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

 Name field
You can use this field to assign a name to the exported file.
 Paper Size field
This field allows you to choose between predefined sizes, or you can use
the Automatic option.
 Orientation field
This field allows you to choose between landscape and portrait format.
 Page Details field
You can use this field to select whether page numbers should be dis-
played and, if so, whether they should be displayed in the header or
footer.
 Enable Export in the Background indicator
You can use this indicator to decide whether the export should take
place in the background. This may result in longer waiting times.
 Fully Display the Exported Widgets indicator
You can use this indicator to activate printing as a report. Only the table
is currently supported. You can also decide whether you want to activate
the Header, Footer, Appendix, and Comments elements.

Figure 6.7 Exporting Object as PDF File

246 246
6 Provision6.1
andSharing
Operation Stories
Stories withSAP
within Scripting
Analytics Cloud

To send a story via a publication, you have the following two setting options,
which can be found in the Format section of your graphics area (see Figure
6.8):
 Automatically generate PDF export
This option is the default setting, in which the PDF document is gener-
ated automatically as soon as the rendering of the story has been com-
pleted. A story is fully rendered as soon as the last line of the 6
onInitialization event has been executed. With this option, you don’t
need to write a script.
 Manually generate PDF export via API
You can use this option if you want to make advanced settings with
scripts and control the time of the export more precisely. Here, you can,
for example, insert a script in your onInitialization event at the desired
point:

if (Application.isRunBySchedulePublication()) {
Scheduling.publish();
}

Figure 6.8 Setting Options for Publication

Mobile App
In addition to using the aforementioned three options, you can make your
story available in a mobile app.

Translation
If you share your story with many different people, it’s likely that you’ll
want to make it available in different languages. This option is available to
you for your story.
To enable translation for a story, you must activate the Enable translation
switch in the story details (see Figure 6.9).

247 247
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Figure 6.9 Activating Translation

As soon as you activate this option, you’ll find your story in the Translation
menu of SAP Analytics Cloud, and you can store the desired translations for
the various elements (see Figure 6.10).

Figure 6.10 Translating Story

Scope of a Translation
Please note that only the elements of the story are translated; you must
configure the translation of your data in your data source.

248 248
6 Provision6.1
andSharing
Operation Stories
Stories withSAP
within Scripting
Analytics Cloud

6.1.2 Lifecycle Management


Having many customization options increases the need for a multilevel Transports in SAP
system landscape in SAP Analytics Cloud. This ensures that changes to sto- Analytics Cloud

ries work correctly without affecting productive stories.

Suitable Release Versions


The target system must use either the same release version or a newer ver- 6
sion of the source system. If the target system uses an older version, sto-
ries may not be supported.

There are two different ways of transporting objects between the different
systems in SAP Analytics Cloud, and we’ll look at them in more detail in the
following sections. You can find both options in your SAP Analytics Cloud
menu under Transport, where you have an area for Export and another area
for Import (see Figure 6.11).

Figure 6.11 Menu Options for Transporting Objects

Transport via the Content Network


You can use the Export option to move your content via the cloud and
share it with other systems.

Storage Space
A system can store up to 300 MB of exported content free of charge.

You must first create a new export. To do this, go to the Transport • Export
path and create a new package there in the Content network storage area,
using the + icon. You can now select which content should be included in
the package (see Figure 6.12).
In the next step, you can enter a name, a description, and detailed informa-
tion for your package. The destinations of this content are also defined
here, where you can set which accesses each target should have (see Figure
6.13).

249 249
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Figure 6.12 Selecting Content for Export

In the last step, you’ll receive another overview of your content and set-
tings so that you can check them. If everything is set correctly, you can start
your export.

Figure 6.13 Setting Package Properties

250 250
6 Provision6.1
andSharing
Operation Stories
Stories withSAP
within Scripting
Analytics Cloud

You can track the progress of each export in your notifications. As soon as
the export is complete, you’ll receive a notification.
To import the content in this way, select Import under Transport. Here,
you’ll see all available content, as well as the name and a description of the
content plus the URL of the tenant that provides the content (see Figure
6.14).
When you select content, you have the same options that you already know 6
from importing from the public content network.

Figure 6.14 Importing Content via Private Content Network

Transport via the File System


Another option is transport via the file system, where the contents are
moved between the systems via TGZ files. Here, you’ll also see an overview
of previous exports and information. Use the + icon to create a new export.
In the next step, you can select the desired content to be included in the
export in an overview.

Selectable Contents
You can only access the public folder in the Files area.

251 251
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

The selected objects are now displayed in an overview on the right-hand


side. You can start the export via the icon in the top right-hand corner, and
you can then assign a name to your export (see Figure 6.15). The result is a
TGZ file that you can import into your target system.

Figure 6.15 Export via File System

6.2 Embedding Stories in Websites


Integration with In SAP Analytics Cloud, you have the option of embedding your story in
other websites websites, and you can also embed websites in your story. To do this, you use
the website widget, which you can use to establish message communica-
tion between the specific host and the embedded object. These two scenar-
ios can be implemented using the APIs for sending messages, as we’ll
discuss in the following sections.

6.2.1 Embedding a Story


To embed a story in an HTML page, use an iFrame (see Figure 6.16), which is an
HTML element that is used to structure websites. First, you must add the story

252 252
6 Provision and Operation Stories withStories
6.2 Embedding Scripting
in Websites

as a trusted source address, and you can find the corresponding settings
under System Administration • App Integration • Trusted Origin Addresses.
You can now trigger communication between the HTML page and the story.
To do this, use the postMessage method:

Application.postMessage (receiver: PostMessageReceiver, message:


string, targetOrigin: string);
6

Hosting Website
Processes Messages
Embedded Story
Transmits Messages

Figure 6.16 Embedding Application in Website

You can also use the onPostMessageReceived event to process messages that
have been sent from the hosted website.

Checking the Address


Check the source address when receiving messages; you could be receiving
data from a malicious website.

6.2.2 Embedding a Web Application


You can also embed web applications in your story and establish communi-
cation via the website widget (see Figure 6.17).

Hosting Application

Bidirectional
Web Application
Communication

Figure 6.17 Embedding Website in Application

You can use the postMessage method to send messages from your story to
the web application:

WebPage_1.postMessage(message: string, targetOrigin: string)

253 253
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

If you send the messages via the hosting story, their processing depends on
the embedded application:
 In an SAP Analytics Cloud application, the receipt is processed via the
onPostMessageReceived event.
 In a web application, you can process the message via the win-
dow.on("message") event.

However, if the hosting story wants to be received by the embedded web-


site, processing takes place with the onPostMessageReceived event.
For an embedded story, messages can be sent using the postMessage
method; for a web application, you must use the window.parent.postMes-
sage event.

6.3 Performance Monitoring


Monitoring There are many customization options in your dashboards related to creat-
performance ing stories with scripting in SAP Analytics Cloud. However, customization
can lead to performance losses due to poorly written code or interactions
between different lines of code. In this section, you’ll learn how to find out
where you lose your performance step by step and get to know some best
practices.
SAP Analytics Cloud offers various tools to check the performance of your
story and to uncover potential “brakes.” Of course, you can also use the
underlying models of this application to build your own stories or adapt
existing applications, and we’ll take a look at those in the following sec-
tions. Go to System • Performance in the navigation bar to open the tools
(see Figure 6.18).

Figure 6.18 Performance Tools Menu

254 254
6 Provision and Operation Stories with Scripting
6.3 Performance Monitoring

6.3.1 Performance Analysis Tool


We start with the performance analysis tool, which can help you resolve per- Performance
formance problems. You can use the following decision path for orienta- analysis

tion (see Figure 6.19).

Start
6

High Frontend Time Optimization in the Browser,


Story, or Planning Process

High Network Time Network Optimizations

High Backend time Backend Optimizations

Start

Figure 6.19 Decision Path for Optimization

To find the point at which you can or should make optimizations, go Making
through the decision path. There are three main categories in which there optimizations
may be a need for optimization:
 Browser, story, application, or planning process
 Network
 Backend

If the front-end time is particularly high, you should first check your
browser and client. Check whether the problem persists once you’ve closed
all other tabs and applications. Are you using a virtual machine? If so, check
whether the problem also exists on a physical computer. Your bandwidth
or a third-party proxy can also have a negative impact.
Once you’ve made sure that the slow performance is not due to your browser
or client, you should take a look at your story. If you’ve acted in accordance
with best practices, or if, for example, a large number of widgets are already
loaded when the story is initialized, then even though they are not needed
here, you should optimize them and just load the needed widgets.
If the network time is particularly high, you should check your reverse Network
proxy, the VPN, and your network. If possible, check whether the problem
is reproducible if you access the network without a VPN. Problems in your
SAP data center can also lead to delays, so check the status in SAP Trust Cen-
ter too.

255 255
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Backend If your workload on the backend is particularly high, you won’t have a prob-
lem arising in SAP Analytics Cloud, and you need to take a closer look at
your data source. The best way to do this is to make several queries and try
to narrow down the problematic query. Once you’ve found a critical query,
look through it join by join and then make optimizations where necessary.
Application When you enter the story, you first have the option of limiting the upcom-
ing results set by using various filter criteria (see Figure 6.20). In addition to
the date of the session, you can filter the search by resource or user. Click
the Search button to display the sessions that match your search criteria.

Figure 6.20 Getting Started with Performance Analysis Tool

You can now select the desired session from this results list.
In the view that appears, you’ll see detailed information about this session
(see Figure 6.21). You can then use this information to identify weaknesses
or problems in your story. Among other things, the start time of the story,
the five most time-consuming charts, and the models with the longest
backend time will be displayed.
The lower section of the overview provides you with detailed information
on the individual areas. You can take a closer look at the page load times,

256 256
6 Provision and Operation Stories with Scripting
6.3 Performance Monitoring

widgets, and general runtime. You can also filter these areas further (e.g., for
a specific action or page, for a specific widget).

Figure 6.21 Detailed View of Performance Analysis

6.3.2 Benchmark Tool


The benchmark tool helps you determine whether your client or network is Benchmark
responsible for your performance problems (see Figure 6.22). To make this comparisons

determination, you can run a client test or a network test.

Figure 6.22 Benchmark Comparison

The result of the client test is a benchmark score, which is calculated on the Benchmarking
basis of several benchmark measurements. Benchmark scores fall into limits

three categories:

257 257
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

 More than or equal to 75: Excellent


 Less than 75 but more than or equal to 50: Good
 Less than 50: Bad

To improve your benchmark score, you should pay attention to the CPU-
intensive applications and processes on your computer that have a nega-
tive impact on the performance of SAP Analytics Cloud.

Optimal Conditions
Don’t switch between browser tabs or minimize them during the test.

After the client test, you can run the network test, which returns three key
figures:
 Network latency
This key figure is the result of a calculation based on your latency and
system bandwidth. The latency corresponds to the time that elapses
between the request and the response from the SAP Analytics Cloud
server.
 Download bandwidth
This key figure indicates the amount of data transferred from the SAP
Analytics Cloud server to the client in megabits per second.
 Upload bandwidth
This key figure corresponds to the amount of data transferred from the
client to the SAP Analytics Cloud server in megabits per second.

Activities during the Test


Bear in mind that several hundred megabytes can be downloaded during
the performance test. Other download activities in the background can
also have a negative impact on the analysis.

6.3.3 Statistics and Analysis


Statistics and This overview not only helps you to answer questions about your backend,
analysis but it also sheds light on some frontend topics. In the SAP Analytics Cloud
Performance KPIs section, you’ll find information on general KPIs for your
system, such as active users, models, and the use of resources (see Figure
6.23).
The Backend KPIs section provides an overview of the backend KPIs. Here,
you’ll find information on average runtimes or the number of queries. The
Frontend KPIs area is very focused on the number of logins.

258 258
6 Provision and Operation Stories with Scripting
6.3 Performance Monitoring

Figure 6.23 Overview of Performance Statistics

You can use a dropdown list to jump to other pages where you can find
more detailed information.

6.3.4 Data Action Statistics and Analysis


This story is very similar to the previously highlighted statistics and analy- Statistics on data
ses, but the focus here is on planning and the data actions it contains (see actions

Figure 6.24).

Figure 6.24 Performance Overview of Data Actions

259 259
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Here, you’ll find an overview of the active planning users and the models
they use, as well as an overview of the number of data actions in different
contexts, such as in the calendar or stories.

6.3.5 Popup to Analyze the Script Performance


Checking script Another way to check the performance of your applications is via the script
performance performance popup, which you can use to check the performance of your
scripts at runtime. To be able to use this popup, you must run your story in
an appropriate mode (see Figure 6.25).
There are two ways to access this mode:
 By customizing the URL
To call up the story via the URL in this mode, you must add the APP_PERFOR-
MANCE_LOGGING=true parameter to your application URL. Place the parame-
ter before the # in your URL and precede the parameter with a question
mark, as shown here:/app.html?APP_PERFORMANCE_LOGGING=true#/.
 With the Script Performance icon
The Script Performance icon performs the manual steps just
described for you. You can access this button via the change mode of
your story, which you can find in the Tools area.

Figure 6.25 Calling Up Performance Popup

If you have entered the parameter in the URL or called up the story using
the button and the application has finished loading, you can call up the
popup using the key combination (Ctrl)+(Shift)+(A) or (Ctrl)+(Shift)+(Z).

260 260
6 Provision and Operation Stories with Scripting
6.3 Performance Monitoring

The popup with the loading times for the various scripts will then open (see
Figure 6.26). If you move the mouse cursor over the bar, the exact execu-
tion time will be displayed.

Figure 6.26 Displaying Performance Popup

If there are performance-relevant events, they are displayed in a red bar


below the triggering event. There are currently two cases that can be dis-
played:
 Waiting for another widget in the background
 Calling up the description for an element of a dimension

6.3.6 Browser Development Tools and Debuggers


You have the option of searching for and displaying your scripts in the Use of the browser
development tools of your web browser, and we’ll now show you how to do developer tools

this, using the Google Chrome browser as an example. For a script to be


found, it must have been executed at least once in the current session. You
can open the Google Chrome development tools either by pressing (F12) or
via the Google Chrome menu. There, you’ll find the development tools
under More Tools • Developer Tools (see Figure 6.27).

261 261
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

Figure 6.27 Opening Developer Tools

You are now in the developer tools of Google Chrome, where you can
search for your scripts, either via a search field or via the tree structure (see
Figure 6.28). To open the search field, press (Ctrl)+(P) on your keyboard,
and you can then search for the name of your widget or function. Name
suggestions are displayed during the search.
You can also search for your script using the tree structure on the left-hand
side (see Figure 6.29). You can find it under sandbox.worker.main, and
below it, you’ll see your story and its elements.
You can also use the debug mode in the development tools of SAP Analytics
Cloud. You start debug mode by adding the debug=true URL parameter to
your story, and the script will be automatically stopped as soon as you
reach a defined point. To include a breakpoint in your story, add the debug-
ger; instruction to your code.

262 262
6 Provision and Operation Stories with Scripting
6.3 Performance Monitoring

Figure 6.28 Search Bar in Developer Tools

Figure 6.29 Menu Structure

You can find another option for defining a breakpoint in the developer
tools. To do this, open the script to be stopped and select the line in the
developer tools where it should stop. To remove a breakpoint, click on it
again (see Figure 6.30).

Figure 6.30 Stopping at Breakpoint

263 263
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

6.4 Best Practices for Performance


Recommendation Now, we provide you with best practices in the area of story performance
that you should consider when creating stories. In principle, all best prac-
tices from the simple SAP Analytics Cloud story are relevant.

6.4.1 Pausing Updates


When creating a story, you have the option of making settings for data
updates (see Figure 6.31).

Figure 6.31 Data Updates in Builder

You can make these settings either in the builder or via an API. In this way,
you can improve the performance of your story and avoid unnecessary
data updates. Three different modes are available for this purpose:
 Always Refresh
This is the default setting in every story, and in this mode, the chart is
always updated.

264 264
6 Provision and Operation
6.4 Stories with Scripting
Best Practices for Performance

 Refresh Active Widgets Only


This mode offers the option of avoiding unnecessary data updates. Only
visible widgets are updated, and the updating of invisible widgets is
paused. As soon as an invisible widget becomes visible, all previously
executed actions that lead to a data update are applied to this widget.
 Always Pause
In this mode, no data is updated during runtime. 6
You can use the RefreshPaused API to give your users the option of starting
and stopping data refreshes. The scripting overwrites the settings in the
builder area.

Inactive Widgets
Widgets that are located in inactive tabs, book pages, and popups are
treated as invisible.

6.4.2 Loading in the Background


You can improve the performance of your story by setting widgets to load Loading behavior of
in the background. If this option is activated, it can improve the start per- widgets

formance of your story. As a result, all widgets visible at the start of the
story are loaded. In the next step, the invisible widgets are initialized in the
background.
The loadInvisibleWidgets URL parameter offers another option for calling
up a story in the corresponding mode. It overwrites the setting in the story.
The loadInvisibleWidgets URL parameter can contain two different values:
 loadInvisibleWidgets=onInitialization
This value forces the standard mode and loads all widgets at the begin-
ning.
 loadInvisibleWidgets=inBackground
This value activates the mode to load the invisible widgets in the back-
ground.

6.4.3 Widget Initialization at Startup


With this option, you can decide whether each individual widget should be Initialization of
loaded directly when the story is initialized. This allows you to force the ini- widgets

tialization of a widget at startup to use it in the onInitialization event


without having to wait for the widget to initialize in the background (see
Figure 6.32).

265 265
6 Provision and Operation Stories with Scripting 6 Provision and Operation Stories with Scripting

The widget is now initialized with all other visible widgets at startup, even
if it’s in the background. You can find the setting for this in the designer in
the Format area.

Figure 6.32 Forcing Initialization of Widget

6.5 Summary
In this chapter, you’ve learned different ways to provide your stories and
how to interact with a web application or embed stories into a web applica-
tion. The most important parts of this chapter were the sections where you
learned how to detect performance pain points in your stories and scripts
and follow best practices to avoid performance issues. In the next and final
chapter, we’ll give you our outlook on the SAP Analytics Cloud roadmap.

266 266
Josef Hampp, Jan Lang

Application
Development with
SAP Analytics Cloud
■ Use scripting to develop custom
analytical applications in SAP
Analytics Cloud
■ Create complex dashboards and
applications tailored to your business
■ Extend your applications with
standard widgets, custom widgets,
and APIs

www.sap-press.com/5944

We hope you have enjoyed this reading sample. You may


recommend or pass it on to others, but only in its entirety,
including all pages. This reading sample and all its parts
are protected by copyright law. All usage and exploitation
rights are reserved by the author and the publisher.

Josef Hampp works as a customer advisor for SAP Business Technology Plat-
form at SAP SE, with a specific focus on SAP’s data and analytics solutions. Jan
Lang is a leading expert for data management and reporting at FC Bayern
Munich, where he works with BI technologies from SAP.

ISBN 978-1-4932-2640-5 • 277 pages • 11/2024


E-book: $84.99 • Print book: $89.95 • Bundle: $99.99

You might also like