SAP HANA XS JavaScript Reference
SAP HANA XS JavaScript Reference
SAP HANA XS Javascript (XSJS) is a language that can be used by application developers to create native SAP
HANA applications that expose data to UI clients on request.
The application developer defines the business logic that is used to expose data in response to client requests
via HTTP. This guide takes you through the tasks required to use the XS JavaScript syntax to define the
services that comprise your business logic, for example:
This SAP HANA XS JavaScript Reference also provides code examples that illustrate how to use the XS
JavaScript classes and methods.
Building the data model is the first step in the overall process of developing applications that provide access to
the SAP HANA database. When you have created the underlying data persistence model, application
developers can build the application services that expose selected elements of the data model to client
application by means of so-called “data end-points”. The client applications bind UI controls such as buttons
or charts and graphs to the application services which in turn retrieve and display the requested data.
Prerequisites
Before you can start using XS JavaScript to define the applications that represent your business logic, you
need to ensure that the following prerequisites are met:
In SAP HANA, native applications use the technology and services provided by the integrated SAP HANA XS
platform.
The term “native application” refers to a scenario where applications are developed in the design-time
environment provided by SAP HANA extended application services (SAP HANA XS) and use the integrated
SAP HANA XS platform illustrated in the following graphic.
The server-centric approach to native application development envisaged for SAP HANA assumes the
following high-level scenario:
Each of the levels illustrated in the graphic is manifested in a particular technology and dedicated languages:
Note
SAP recommends you use SQL rather than the Calculation Engine functions.
The development scenarios for native application development are aimed at the following broadly defined
audiences:
Database developers SQLScript, CDS, hdb* ● SAP HANA studio Database tables, views, procedures;
SAP ● SAP HANA Web- user-defined functions (UDF) and trig
based Workbench gers; analytic objects; data authoriza
tion…
Application developers: XS JavaScript, OData, ● SAP HANA studio Control-flow logic, data services, calcula
SQLScript, … ● SAP HANA Web- tion logic…
● Professional (XS JS)
● Casual/business based Workbench
UI/client developers SAPUI5, JavaScript, … ● SAP HANA studio UI shell, navigation, themes (look/feel),
● SAP HANA Web- controls, events, …
based Workbench
Related Information
To enable application-developers to start building native applications that take advantage of the SAP HANA
Extended Application Services (SAP HANA XS), the SAP HANA administrator must ensure that developers
have access to the tools and objects that they need to perform the tasks required during the application-
development process.
Before you start developing applications using the features and tools provided by the SAP HANA XS, bear in
mind the following prerequisites. Developers who want to build applications to run on SAP HANA XS need the
following tools, accounts, and privileges:
Note
The following privileges can only be granted by someone who has the required authorizations in SAP HANA,
for example, an SAP HANA administrator.
Note
To provide access to the repository for application developers, you can use a predefined role or create your
own custom role to which you assign the privileges that the application developers need to perform the
everyday tasks associated with the application-development process.
To provide access to the repository from the SAP HANA studio, the EXECUTE privilege is required for
SYS.REPOSITORY_REST, the database procedure through with the REST API is tunneled. To enable the
activation and data preview of information views, the technical user _SYS_REPO also requires SELECT
privilege on all schemas where source tables reside.
In SAP HANA, you can use roles to assign one or more privileges to a user according to the area in which the
user works; the role defines the privileges the user is granted. For example, a role enables you to assign SQL
privileges, analytic privileges, system privileges, package privileges, and so on. To create and maintain
artifacts in the SAP HANA repository, you can assign application-development users the following roles:
Before you start using the SAP HANA Web-based Development Workbench, the SAP HANA administrator
must set up a user account for you in the database and assign the required developer roles to the new user
account.
Tip
The role sap.hana.xs.ide.roles::Developer grants the privileges required to use all the tools included in the
SAP HANA Web-based Development Workbench. However, to enable a developer to use the debugging
features of the browser-based IDE, your administrator must also assign the role
sap.hana.xs.debugger::Debugger. In addition, the section debugger with the parameter enabled and the
value true must be added to the file xsengine.inifile, for example, in the SAP HANA studio Administration
perspective.
The developer information road map is designed to help developers find the information they need in the
library of user and reference documentation currently available for SAP HANA development projects.
The development environment for SAP HANA supports a wide variety of application-development scenarios.
For example, database developers need to be able to build a persistence model or design an analytic model;
professional developers want to build enterprise-ready applications; business experts with a development
background might like to build a simple server-side, line-of-business application; and application developers
need to be able to design and build a client user interface (UI) that displays the data exposed by the data
model and business logic. It is also essential to set up the development environment correctly and securely
and ensure the efficient management of the various phases of the development lifecycle.
The following image displays essential information sources for people planning to develop applications in SAP
HANA Extended Application Services classic model.
The following image displays the essential information sources for developing applications in SAP HANA
Extended Application Services advanced model.
With such a wide variety of people needing to find such a broad range of information about so many different
tasks, it is sometimes not easy to know what information is available or where to look to find it. This section is
designed to help you navigate the documentation landscape by looking at the information available for the SAP
HANA developer from the following perspectives:
Related Information
The SAP HANA developer information set includes a selection of guides that describe the complete
application-development process, from defining user roles, privileges, and data models through application
setup to UI design and testing; the information available covers background and concepts, task-based
tutorials, and detailed reference material. The following tables illustrate which guides are available for the
developer who wants to build applications for SAP HANA, what information the guide contains, and which
typical high-level tasks the selected guide covers:
Developer Quick Start Guide (for XS Contains a selection of tutorials which Build data-persistence models
classic) teach the basic steps required to build
Write procedures and user-defined
data models and the native applica
tions that run on SAP HANA XS classic functions (UDF)
model.
Build applications with SAP HANA XS
JavaScript or OData.
Developer Guide (for XS classic) Describes the complete application-de Build a data model
velopment process for SAP HANA Ex
Build XS classic applications (XS Java
tended Application Services Classic
Model. Script)
Developer Guide (for XS advanced) Describes the complete application-de Build a data model
velopment process for SAP HANA Ex
Build XS advanced applications
tended Application Services Advanced
Model. (Node.js, JavaScript, Java, ...)
Modeling Guide (for XS classic) Explains how to use the SAP HANA Create attribute, analytic, and calcula
modeler to create information models tion views
based on data that can be used for ana
Create decision tables
lytical purposes.
Import/Export data
SAPUI5 Demo Kit (version 1.28) Describes how to develop SAPUI5 ap Build client UI models
plications based on SAP HANA, a user
Design UI view (buttons/boxes)
interface technology for building and
adapting client applications Bind UI views to data
The SAP HANA developer information set also includes a selection of reference guides that describe the
various languages that you use to define the underlying data model (for example, SQL, CDS, or HDBTable) as
SQL System Views Describes all SQL data types, predi Query state of SAP HANA using SQL
cates, operators, expressions, func commands
tions, statements, and error codes.
Alter system configuration/initializa
tion services *
SQLScript Reference Describes how to use the SQL exten Build SQL scripts
sion SAP HANA SQLScript to embed
Create UDFs
data-intensive application logic into
SAP HANA. Build SQL procedures
SQLScript Command Network Protocol Describes the SQL Command Network Define routes for SQL statements
Protocol that is used by SAP HANA cli
Set up authentication (SAML…)
ents to communicate with SAP HANA.
Handle large data objects
Spatial Reference(*) Describes how to store, manipulate, Store and manage spatial data
and manage spatial data, for example,
Access and manipulate spatial data
geographic locations, routing informa
tion, and shape data. Calculate the distance between geome
tries
XS JavaScript Reference Describes how to use XS JavaScript to Create XSJS services (for XS classic)
build native SAP HANA applications for
Create XSJS libraries
XS classic, explains the underlying con
cepts, and lists the various APIs that Build application logic
are available.
XS JavaScript API Reference Describes the API functions, methods, Use the XS JavaScript API
and classes provided for use with
Search for XSJS API classes
server-side JavaScript code running in
side (SAP HANA XS). Locate XSJS methods
XSUnit JavaScript API Reference Describes the API functions, methods, Test server-side (XS) JavaScript code
and classed provided with the XSUnit
Test SQLScript code (stored proce
test framework to automate the tests
that you want to run for SAP HANA XS dures, views)
applications.
Test modeled calculation view
XS DB Utilities JavaScript API Refer Describes the API that provides access Call a stored procedure
ence to a library of JavaScript utilities, which
Query a CDS entity
can be used to enable server-side Java
Script applications to consume data Update a CDS entity
models that are defined using Core
Data Services or call stored procedures
as if they were JavaScript objects.
SINA Search JavaScript Reference * Describes the SAP HANA simple infor Create a search query
mation access (SINA) API, a client-side
Create a suggestion query
JavaScript API for developing browser-
based search UIs Create a bar- or line-chart query
Core Data Services (CDS) Reference Explains how to use Core Data Services Create CDS Documents (for XS clas
(for XS classic) (CDS) to build design-time data-persis sic)
tence models in SAP HANA Extended
Define tables, table types, and SQL
Application Services (for XS classic).
The data-persistence model defines views
the data to expose in response to client
Define associations between data ob
requests via HTTP, for example, from
jects
an SAPUI5-based application.
Import data into a table
HDBTable Syntax Reference Explains how to use the hdbtable Define schemas and sequences (for XS
syntax to build design-time data-per classic)
sistence models in SAP HANA XS (for
Define tables, SQL views, and table
XS classic). The data-persistence
model is used to define the data to ex types
pose in response to client requests via Import data into a table
HTTP, for example, from an SAPUI5-
based application.
SAP HANA REST API (for XS classic) Describes the REST API for SAP HANA Maintain repository workspaces
(for XS classic), which enables devel
Maintain projects and files
opment tools to access SAP HANA
platform components such as the for Interact with the SAP HANA repository
XS classic repository using REST-
based calls. Access catalog objects
BFL Reference Describes the SAP HANA Business Assign AFL user roles/privileges
Function Library (BFL), which contains
pre-built financial functions. Create the AFL wrapper procedure
PAL Reference Describes the SAP HANA Predictive Assign AFL user roles/privileges
Analysis Library (PAL), which contains
Create the AFL wrapper procedure
functions that can be called from within
SAP HANA SQLScript procedures to Generate and call a BFL procedure
perform analytic algorithms.
Create input/output tables
Caution
(*) SAP HANA server software and tools can be used for several SAP HANA platform and options scenarios
as well as the respective capabilities used in these scenarios. The availability of these is based on the
available SAP HANA licenses and the SAP HANA landscape, including the type and version of the back-end
systems the SAP HANA administration and development tools are connected to. There are several types of
licenses available for SAP HANA. Depending on your SAP HANA installation license type, some of the
features and tools described in the SAP HANA platform documentation may only be available in the SAP
HANA options and capabilities, which may be released independently of an SAP HANA Platform Support
Package Stack (SPS). Although various features included in SAP HANA options and capabilities are cited in
the SAP HANA platform documentation, each SAP HANA edition governs the options and capabilities
available. Based on this, customers do not necessarily have the right to use features included in SAP HANA
options and capabilities. For customers to whom these license restrictions apply, the use of features
included in SAP HANA options and capabilities in a production system requires purchasing the
corresponding software license(s) from SAP. The documentation for the SAP HANA optional components is
available in SAP Help Portal at http://help.sap.com/hana_options. If you have additional questions about
what your particular license provides, or wish to discuss licensing features available in SAP HANA options,
please contact your SAP account team representative.
The design and organization of the SAP HANA developer documentation library enables easy access to
information according to the particular development task to be performed, for example, creating a view or
procedure, or setting up an application project.
The SAP HANA developer can make use of a large number of guides that include information describing the
complete application-development process. The following figure shows the information that is available from
the perspective of the development tasks that must be performed in a particular development area, for
example, setting up the persistence model; creating an XSJS or OData service, or managing the development
lifecycle. Each of the tasks described is supported by information covering the underlying concepts and
detailed reference material. The figure also indicates where to find information based on the development task
you want to perform. The tasks are split according to development area, for example, database development,
application development, or UI design.
Caution
(*) SAP HANA server software and tools can be used for several SAP HANA platform and options scenarios
as well as the respective capabilities used in these scenarios. The availability of these is based on the
available SAP HANA licenses and the SAP HANA landscape, including the type and version of the back-end
systems the SAP HANA administration and development tools are connected to. There are several types of
licenses available for SAP HANA. Depending on your SAP HANA installation license type, some of the
The design and organization of the SAP HANA developer documentation library enables easy access to
information according to the underlying development scenario, for example, lifecycle management, or
application development.
The SAP HANA developer can make use of a large number of guides that include information describing the
complete application-development process from the perspective of the development scenario, for example,
database development, application development, or client UI design and testing; the information available
covers background and concepts, task-based tutorials, and detailed reference material. The following table
indicates where to find information based on the development scenario you choose, for example:
The particular scenario you select can be based on the underlying development area you are assigned to, the
choice of programing language, the required development objects, or the tools you want to use:
A database developer uses a variety of languages to develop a data model that can be exposed to a UI client,
for example by HTTP (with an application service) or SQL (with a client interface such as ADBC or JDBC). In a
database-development scenario, developers typically use languages such as SQLScript, the .hdbtable
syntax family (hdbview, hdbsequence,...), or Core Data Services (CDS) to define the data-persistence model
to which you add the corresponding analytic model. If you want to develop a data model that can be exposed
to client requests, use the following table to help find the information you need to complete the most common
development tasks.
Using features available in additional optional components (*), you can develop applications that perform the
following tasks:
● Manage data streams, for example, to filter, aggregate or enrich data before it is committed to the
database
SQL Database elements, serv Eclipse (SAP HANA studio) SQL and System Views Ref
ices, policies, extended stor erence
SAP HANA Web Workbench
age/index, adapters and
Text Analysis Developer
agents, remote sources and SAP Web IDE for SAP HANA
subscriptions, search, text Guide *
mining and analysis, data
Text Mining Developer Guide
streams (filters aggregators,
*
and enrichment), informa
tion management, geo-spa Smart Data Streaming De
tial data *
veloper Guide *
SQLScript Tables, SQL Views, Proce Eclipse (SAP HANA studio) SQLScript Reference
dures, UDFs, application &
SAP HANA Web Workbench BFL Reference
business functions…
PAL Reference
SAP HANA DB (.hdb* syn Tables, SQL Views, Proce Eclipse (SAP HANA studio) Developer Guide (XS classic)
tax; hdbtable, hdbview...) dures, Search index (InA) ...
SAP HANA Web Workbench SQLScript Reference
SAP HANA DB (CDS syntax) Entities, data types, con Eclipse (SAP HANA studio) Developer Guide (XS classic)
texts, SQL views, geo-spatial
SAP HANA Web Workbench Developer Guide (for XS ad
*, …
vanced)
SAP Web IDE for SAP HANA
Spatial Reference
SAP HANA HDI Tables, indexes, data types, SAP Web IDE for SAP HANA Developer Guide (for XS ad
procedures, SQL views, trig vanced)
gers, calculation views, ana
lytic privileges, …
SAP HANA DB Analytic and calculation Eclipse (SAP HANA studio) Developer Guide (XS classic)
views, decision tables, …
SAP HANA Web Workbench Developer Guide (for XS ad
vanced)
SAP Web IDE for SAP HANA
Modeling Guide
Caution
(*) SAP HANA server software and tools can be used for several SAP HANA platform and options scenarios
as well as the respective capabilities used in these scenarios. The availability of these is based on the
available SAP HANA licenses and the SAP HANA landscape, including the type and version of the back-end
systems the SAP HANA administration and development tools are connected to. There are several types of
licenses available for SAP HANA. Depending on your SAP HANA installation license type, some of the
features and tools described in the SAP HANA platform documentation may only be available in the SAP
HANA options and capabilities, which may be released independently of an SAP HANA Platform Support
As an application developer, you use a variety of languages to develop applications that expose a SAP HANA
data model to requests from UI clients. In an application-development scenario, developers typically use
languages such as server-side JavaScript (XSJS) or an OData service to define the application business model
that exposes the data model built by the database developer. You can call the application service from a client
interface, for example, a browser or UI client. If you want to develop an application service that exposes an
SAP HANA data model to client requests, use the following table to help find the information you need to
complete the most common development tasks.
XSJS (server-side Java Server-side JavaScript serv Eclipse (SAP HANA studio) Developer Guide (for XS
Script) ices, libraries, API classic)
SAP HANA Web Workbench
XS JavaScript API Reference
Node.js Server-side services, mod SAP Web IDE for SAP HANA Developer Guide (for XS ad
ules, libraries, API vanced)
Java Server-side services, libra SAP Web IDE for SAP HANA Developer Guide (for XS ad
ries, API vanced)
OData OData services, query op Eclipse (SAP HANA studio) Developer Guide
tions, parameters
SAP HANA Web IDE OData Reference
As a developer of client applications, you use a variety of languages to develop a user interface (UI) client that
displays permitted elements of an SAP HANA data model. In a UI-client development scenario, developers
typically use languages such as SAPUI5 (HTML5) or JavaScript to define the UI client application. The UI client
binds interface controls to actions that request data and display it in the required format. If you want to
develop a UI client application that can be used to display an SAP HANA data model, use the following table to
help find the information you need to complete the most common development tasks.
SAPUI5 JS, UI5 Library, View, Con Eclipse (SAP HANA studio) Developer Guide
trol, ...
SAPUI5 Demo Kit (version
1.28)
JavaScript Search queries, results, sug Eclipse (SAP HANA studio) Developer Guide
gestions
SINA Search JavaScript Ref
erence *
Caution
(*) SAP HANA server software and tools can be used for several SAP HANA platform and options scenarios
as well as the respective capabilities used in these scenarios. The availability of these is based on the
available SAP HANA licenses and the SAP HANA landscape, including the type and version of the back-end
systems the SAP HANA administration and development tools are connected to. There are several types of
licenses available for SAP HANA. Depending on your SAP HANA installation license type, some of the
features and tools described in the SAP HANA platform documentation may only be available in the SAP
HANA options and capabilities, which may be released independently of an SAP HANA Platform Support
Package Stack (SPS). Although various features included in SAP HANA options and capabilities are cited in
the SAP HANA platform documentation, each SAP HANA edition governs the options and capabilities
available. Based on this, customers do not necessarily have the right to use features included in SAP HANA
options and capabilities. For customers to whom these license restrictions apply, the use of features
included in SAP HANA options and capabilities in a production system requires purchasing the
corresponding software license(s) from SAP. The documentation for the SAP HANA optional components is
available in SAP Help Portal at http://help.sap.com/hana_options. If you have additional questions about
what your particular license provides, or wish to discuss licensing features available in SAP HANA options,
please contact your SAP account team representative.
The possibility to run application specific code in SAP HANA creates several possibilities for developing SAP
HANA based applications, representing various integration scenarios, and corresponding development
processes.
Application developers can choose between the following scenarios when designing and building applications
that access an SAP HANA data model:
The following diagram shows the scope of the languages and the environment you use in the various phases of
the process of developing applications that harness the power of SAP HANA. For example, if you are
developing native SAP HANA applications you can use CDS, HDBtable, or SQLSscript to create design-time
representations of objects that make up your data persistence model; you can use server-side JavaScript
(XSJS) or OData services to build the application's business logic; and you can use SAPUI5 to build client user
interfaces that are bound to the XSJS or OData services.
If you are developing non-native SAP HANA applications, you can choose between any of the languages that
can connect by means of the client interfaces that SAP HANA supports, for example, ABAP (via ADBC) or Java
(JDBC).
The professional application developer creates server-side applications that define the business logic required
to serve client requests, for example, for data created and exposed by the database developer. The following
table lists some of the tasks typically performed by the professional application developer and indicates where
to find the information that is required to perform the task.
Create an OData service (for example, Context, service syntax, examples, li Developer Guide
to bind a UI control/event to existing braries, debugging, implementation, …
data tables or views)
SAP HANA Extended Application Services (SAP HANA XS) provide applications and application developers
with access to the SAP HANA database using a consumption model that is exposed via HTTP.
In addition to providing application-specific consumption models, SAP HANA XS also host system services
that are part of the SAP HANA database, for example: search services and a built-in Web server that provides
access to static content stored in the SAP HANA repository.
The consumption model provided by SAP HANA XS focuses on server-side applications written in JavaScript.
Applications written in server-side JavaScript can make use of a powerful set of specially developed API
functions, for example, to enable access to the current request session or the database. This section describes
how to write server-side JavaScript code that enables you to expose data, for example, using a Web Browser
or any other HTTP client.
In SAP HANA Extended Application Services, the persistence model (for example, tables, views and stored
procedures) is mapped to the consumption model that is exposed via HTTP to clients - the applications you
write to extract data from SAP HANA.
You can map the persistence and consumption models in the following way:
● Application-specific code
Write code that runs in SAP HANA application services. Application-specific code (for example, server-
side JavaScript) is used in SAP HANA application services to provide the consumption model for client
applications.
Applications running in SAP HANA XS enable you to accurately control the flow of data between the
presentational layer, for example, in the Browser, and the data-processing layer in SAP HANA itself, where the
calculations are performed, for example in SQL or SQLScript. If you develop and deploy a server-side
JavaScript application running in SAP HANA XS, you can take advantage of the embedded access to SAP
HANA that SAP HANA XS provides; the embedded access greatly improves end-to-end performance.
SAP HANA application services (XS server) supports server-side application programming in JavaScript. The
server-side application you develop can use a collection of JavaScript APIs to expose authorized data to client
requests, for example, to be consumed by a client GUI such as a Web browser or any other HTTP client.
The functions provided by the JavaScript APIs enable server-side JavaScript applications not only to expose
data but to update, insert, and delete data, too. You can use the JavaScript APIs to perform the following
actions:
JavaScript programs are stored in the repository along with all the other development resources. When the
programs are activated, the code is stored in the repository as a runtime object.
Tip
To enable the Web Browser to display more helpful information if your JavaScript code causes an HTTP
500 exception on the SAP HANA XS Web server, ask someone with administrator privileges to start the
SAP HANA studio's Administration Console perspective and add the parameter developer_mode to the
xsengine.ini httpserver section of the Configuration tab and set it to true.
Related Information
SAP HANA Extended Application Services (SAP HANA XS) supports server-side application programming in
JavaScript. The server-side application you develop uses JavaScript APIs to expose authorized data to client
requests, for example, for consumption by a client GUI such as a Web browser, SAPUI5 applications, or mobile
clients.
Prerequisites
Context
Since JavaScript programs are stored in the SAP HANA Repository, the steps in this task description assume
that you have already created a workspace and a project (of type XS Project), and that you have shared the
project with other members of the development team. To write a server-side JavaScript application, you must
perform the following high-level steps.
Tip
File extensions are important. If you are using SAP HANA studio to create artifacts in the SAP HANA
Repository, the file-creation wizard adds the required file extension automatically and, if appropriate,
enables direct editing of the new file in the corresponding editor.
Procedure
The application descriptor is the core file that you use to describe an application's availability within SAP
HANA XS. The application-descriptor file has no contents and no name; it only has the file
extension .xsapp.
Note
For backward compatibility, content is allowed in the .xsapp file but ignored.
a. In the Project Explorer view, right-click the folder where you want to create the new application
descriptor and choose New Other SAP HANA Application Development XS Application
Descriptor File in the context-sensitive popup menu.
b. Save the application-descriptor file.
Note
Saving a file in a shared project automatically commits the saved version of the file to the
repository, To explicitly commit a file to the repository, right-click the file (or the project containing
the file) and choose Team Commit from the context-sensitive popup menu.
{
"exposed" : true,
"authentication" : { "method": "Form" },
"prevent_xsrf" : true,
}
Note
These settings allows data to be exposed, require logon authentication to access the exposed data,
and help protect against cross-site request-forgery (XSRF) attacks.
$.response.contentType = "text/plain";
$.response.setBody( "Hello, World!");
.
\
helloxsjs
\
.xsapp
.xsaccess
.xsprivileges // optional
hello.xsjs
You can write server-side JavaScript using the SAP HANA studio JavaScript editor, which provides syntax
validation, code highlighting and code completion.
The SAP HANA studio's JavaScript editor includes the JSLint open-source library, which helps to validate
JavaScript code. The editor highlights any code that does not conform to the JSLint standards.
To configure the JSLint library and determine which validations are performed, go to: Window Preferences
SAP HANA Application Development JSLint . In the preferences window, each JSLint setting is followed
by the corresponding JSLint command name, which you can use to lookup more information on the JSLint
Web site.
Tip
To disable all JSLint validations for files in a specific project, right-click the project and choose Disable
JSLint.
Related Information
http://www.jslint.com/lint.html
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) external attacks such as cross-site scripting and forgery, and insufficient
authentication.
The following list illustrates the areas where special attention is required to avoid security-related problems
when writing server-side JavaScript. Each of the problems highlighted in the list is described in detail in its own
dedicated section:
● SSL/HTTPS
Enable secure HTTP (HTTPS) for inbound communication required by an SAP HANA application.
● Injection flaws
In the context of SAP HANA Extended Application Services (SAP HANA XS) injection flaws concern SQL
injection that modifies the URL to expand the scope of the original request.
● Cross-site scripting (XSS)
Web-based vulnerability that involves an attacker injecting JavaScript into a link with the intention of
running the injected code on the target computer.
● Broken authentication and session management
Leaks or flaws in the authentication or session management functions allow attackers to impersonate
users and gain access to unauthorized systems and data.
● Insecure direct object references
An application lacks the proper authentication mechanism for target objects.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) external attacks such as cross-site scripting and forgery, and insufficient
authentication. You can set up SAP HANA to use secure HTTP (HTTPS).
SSL/HTTPS Problem
Incoming requests for data from client applications use secure HTTP (HTTPS), but the SAP HANA system is
not configured to accept the HTTPS requests.
SSL/HTTPS Recommendation
Ensure the SAP Web Dispatcher is configured to accept incoming HTTPS requests. For more information, see
the SAP HANA Security Guide.
Note
The HTTPS requests are forwarded internally from the SAP Web Dispatcher to SAP HANA XS as HTTP
(clear text).
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) injection flaws. Typically, injection flaws concern SQL injection and involve modifying
the URL to expand the scope of the original request.
The XS JavaScript API provides a number of different ways to interact with the SAP HANA database by using
SQL commands. By default, these APIs allow you to read data, but they can also be used to update or delete
data, and even to grant (or revoke) access rights at runtime. As a general rule, it is recommended to write a
query which is either a call to an SQLScript procedure or a prepared statement where all parameters specified
in the procedure or statement are escaped by using either setString or setInt, as illustrated in the
examples provided in this section. Avoid using dynamic SQL commands with parameters that are not escaped.
In the context of SAP HANA XS, injection flaws mostly concern SQL injection, which can occur in the SAP
HANA XS JavaScript API or SQL script itself (both standard and dynamic). For example, the URL http://
xsengine/customer.xsjs?id=3 runs the code in the JavaScript file customer.xsjs shown below:
Note
SAP HANA XS applications rely on the authorization provided by the underlying SAP HANA database.
Users accessing an SAP HANA XS based application require the appropriate privileges on the database
objects to execute database queries. The SAP HANA authorization system will enforce the appropriate
authorizations. This means that in those cases, even if the user can manipulate a query, he will not gain more
access than is assigned to him through roles or privileges. Definer mode SQL script procedures are an
exception to this rule that you need to take into consideration.
To prevent injection flaws in the JavaScript API, use prepared statements to create a query and place-holders
to fill with results of function calls to the prepared-statement object; to prevent injection flaws in standard SQL
Script, use stored procedures that run in caller mode; in caller mode, the stored procedures are executed with
the credentials of the logged-on HANA user. Avoid using dynamic SQL if possible. For example, to guard
against the SQL-injection attack illustrated in the problem example, you could use the following code:
Prepared statements enable you to create the actual query you want to run and then create several
placeholders for the query parameters. The placeholders are replaced with the proper function calls to the
prepared statement object. The calls are specific for each type in such a way that the SAP HANA XS
JavaScript API is able to properly escape the input data. For example, to escape a string, you can use the
setString function.
Related Information
If you use server-side JavaScript to write your application code, bear in mind the potential for (and risk of)
cross-site scripting (XSS) attacks. Cross-site scripting is a Web-based vulnerability that involves an attacker
injecting JavaScript into a link with the intention of running the injected code on the target computer.
● Reflected (non-persistent)
Code affects individual users in their local Web browser
● Stored (persistent)
Code is stored on a server and affects all users who visit the served page
A successful cross-site scripting attack could result in a user obtaining elevated privileges or access to
information that should not be exposed.
Since there are currently no libraries provided by the standard SAP HANA XS JavaScript API to provide proper
escaping, the best solution for generating HTML on SAP HANA XS is to use the ESAPI JavaScript libraries as a
starting point. In addition, we recommend not to write custom interfaces but to rely on well-tested
technologies supplied by SAP, for example, OData or JSON together with SAPUI5 libraries.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) attack against authentication infrastructure. Leaks or flaws in the authentication or
Authentication Problem
Leaks or flaws in the authentication or session management functions allow attackers to impersonate users;
the attackers can be external as well as users with their own accounts to obtain the privileges of those users
they impersonate.
Authentication Recommendation
Use the built-in SAP HANA XS authentication mechanism and session management (cookies). For example,
use the "authentication" keyword to enable an authentication method and set it according to the
authentication method you want implement, for example: SAP logon ticket, form-based, or basic (user name
and password) in the application's .xsaccess file, which ensures that all objects in the application path are
available only to authenticated users.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) attacks using insecure references to objects.
An SAP HANA XS application is vulnerable to insecure direct object reference if the application lacks the
proper authentication mechanism for target objects.
Make sure that only authenticated users are allowed to access a particular object. In the context of SAP HANA
XS, use the "authentication" keyword to enable an authentication method and set it according to the
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) cross-site request forgery (XSRF). Cross-site scripting is a web-based vulnerability
that exploits the trust boundaries that exist between different websites running in the same web browser
session.
Since there are no clear trust boundaries between different Web sites running in the same Web-browser
session, an attacker can trick users (for example, by luring them to a popular Web site that is under the
attacker's control) into clicking a specific hyperlink. The hyperlink displays a Web site that performs actions on
the visitor's behalf, for example, in a hidden iframe. If the targeted end user is logged in and browsing using an
account with elevated privileges, the XSRF attack can compromise the entire Web application.
SAP HANA XS provides a way to include a random token in the POST submission which is validated on the
server-side. Only if this token is non-predictable for attackers can one prevent cross-site, request-forgery
attacks. The easiest way to prevent cross-site, request-forgery attacks is by using the standard SAP HANA XS
cookie. This cookie is randomly and securely generated and provides a good random token which is
unpredictable by an attacker ($.session.getSecurityToken()).
To protect SAP HANA XS applications from cross-site request-forgery (XSRF) attacks, make sure you always
set the prevent_xsrf keyword in the application-acess (.xsaccess) file to true, as illustrated in the following
example:
{
"prevent_xsrf" : true
}
The prevent_xsrf keyword prevents the XSRF attacks by ensuring that checks are performed to establish that
a valid security token is available for given Browser session. The existence of a valid security token determines
Note
The default setting is false, which means there is no automatic prevention of XSRF attacks. If no value is
assigned to the prevent_xsrf keyword, the default setting (false) applies.
The following client-side JavaScript code snippet show how to use the HTTP request header to fetch, check,
and apply the XSRF security token required to protect against XSRF attacks.
<html>
<head>
<title>Example</title>
<script id="sap-ui-bootstrap" type="text/javascript"
src="/sap/ui5/1/resources/sap-ui-core.js"
data-sap-ui-language="en"
data-sap-ui-theme="sap_goldreflection"
data-sap-ui-libs="sap.ui.core,sap.ui.commons,sap.ui.ux3,sap.ui.table">
</script>
<script type="text/javascript" src="/sap/ui5/1/resources/jquery-sap.js"></
script>
<script>
function doSomething() {
$.ajax({
url: "logic.xsjs",
type: "GET",
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRF-Token", "Fetch");
},
success: function(data, textStatus, XMLHttpRequest) {
var token = XMLHttpRequest.getResponseHeader('X-CSRF-Token');
var data = "somePayLoad";
$.ajax({
url: "logic.xsjs",
type: "POST",
data: data,
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRF-Token", token);
},
success: function() {
alert("works");
},
error: function() {
alert("works not");
}
});
}
});
}
</script>
</head>
<body>
<div>
<a href="#" onClick="doSomething();">Do something</a>
</div>
</body>
</html>
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) attacks against the security configuration in place, for example, authentication
mechanisms and authorization processes.
Applications should have proper authentication in place, for example, by using SAP HANA built-in
authentication mechanisms and, in addition, the SAP HANA XS cookie and session handling features.
Application developers must also consider and control which paths are exposed by HTTP to the outside world
and which of these paths require authentication.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) attacks against the insecure or lack of encryption of data assets.
Storage-Encryption Problem
To prevent unauthorized access, for example, in the event of a system break-in, data such as user logon
credentials must be stored in an encrypted state.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) unauthorized access to URLs.
Unauthenticated users have access to URLs that expose confidential (unauthorized) data.
Make sure you have addressed the issues described in "Broken Authentication and Session Management" and
"Insecure Direct Object References". In addition, check if a user is allowed to access a specific URL before
actually executing the code behind that requested URL. Consider putting an authentication check in place for
each JavaScript file before continuing to send any data back to the client's Web browser.
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) insufficient protection of the transport layer.
Without transport-layer protection, the user's network traffic can be monitored, and attackers can steal
sensitive information such as logon credentials or credit-card data.
Turn on transport-layer protection in SAP HANA XS; the procedure is described in the SAP HANA security
guide.
Related Information
If you use server-side JavaScript to write your application code, bear in mind the potential for (and risk of)
redirection and internal fowarding from the requested Web page.
Web applications frequently redirect users to other pages or use internal forwards in a similar manner.
Sometimes the target page is specified in an invalid (not permitted) parameter. This enables an attacker to
choose a destination page leading to the possibility of phishing attacks or the spamming of search engines.
To prevent invalidated redirects or forwards, application developers should validate the requested destination
before forwarding, for example, by checking if the destination is present in a white list. If the destination URL
specified in the redirection request is not present in the white list, the redirection is refused.
Tip
Avoid using redirection if you cannot control the final destination.
Alternatively, you can refuse to allow any direct user input; instead, the input can be used to determine the
final destination for the redirection, as illustrated in the following example:
Related Information
If you choose to use server-side JavaScript to write your application code, you need to bear in mind the
potential for (and risk of) attacks aimed at the process used to parse XML input and generate the XML output.
There are several potential security issues related to processing XML as input or to generating XML as output.
In addition, problems with related technologies (for example, XSL Transformations or XSLT) can enable the
inclusion of other (unwanted) files.
Turn on transport-layer protection in SAP HANA XS; the procedure is described in the SAP HANA security
guide.
● When processing XML that originates from an untrusted source, disable DTD processing and entity
expansion unless strictly required. This helps prevent Billion Laugh Attacks (Cross-Site Request Forgery),
which can bring down the processing code and, depending on the configuration of the machine, an entire
server.
● To prevent the inclusion (insertion) of unwanted and unauthorized files, restrict the ability to open files or
URLs even in requests included in XML input that comes from a trusted source. In this way, you prevent
the disclosure of internal file paths and internal machines.
● Ensure proper limits are in place on the maximum amount of memory that the XML processing engine can
use, the amount of nested entities that the XML code can have, and the maximum length of entity names,
attribute names, and so on. This practice helps prevent the triggering of potential issues.
Related Information
The elements defined in normal server-side JavaScript programs cannot be accessed from other JavaScript
programs. To enable the reuse of program elements, SAP HANA Extended Application Services support
server-side JavaScript libraries.
Server-side JavaScript libraries are a special type of JavaScript program that can be imported and called in
other JavaScript programs. You can use JavaScript libraries to perform simple, repetitive tasks, for example,
to handle forms and form date, to manipulate date and time strings, to parse URLs, and so on.
Note
JavaScript libraries are internally developed extensions for SAP HANA.
The following example shows how to import a JavaScript mathematics library using the import function:
● Package name
Full name of the package containing the library object you want to import, for example, sap.myapp.lib
● Library name
Name of the library object you want to import, for example, math
The standard JavaScript limitations apply to the characters you can use in either the name of the XSJS library
you create or the name of the package where the library is deployed. For example, you cannot use the hyphen
(-) in the name of an XSJS library or, if you are referencing the library, the name of a package in the application
package path. To prevent problems with activation of the object in the SAP HANA repository, you must follow
the standard rules for accessing JavaScript property objects by name. The following example, shows how to
use square brackets and quotes (["<STRING>"]) to access an object whose name uses non-permitted
characters such as a hyphen (-):
Related Information
Server-side JavaScript libraries are a special type of JavaScript program that can be imported and called in
other JavaScript programs. You can use JavaScript libraries to perform simple, repetitive tasks, for example:
handle forms and form date, manipulate date and time strings, parse URLs, and so on.
Context
JavaScript libraries are internally developed extensions for SAP HANA. The libraries exist in the context of a
package, which is referenced when you import the library. The following example of a JavaScript library
displays the word "Hello" along with a name and an exclamation mark as a suffix.
To import a JavaScript library for use in your server-side JavaScript application, perform the following tasks
Procedure
$.import("<path.to.your.library.filename>","greetLib");
var greeting = $.<path.to.your.library.filename>.greet("World");
$.response.setBody(greeting);
$.path.to.your.library.greetLib
$.path.to.your.library.greetLib.greet()
$.path.to.your.library.greetLib.greetingSuffix
$.path.to.your.library.greetLib.greetingPrefix
○ Pre-import checks:
○ It is not possible to import the referenced library if the import operation would override any
predefined runtime objects.
○ Do not import the referenced library if it is already present in the package.
○ Library context
Imported libraries exist in the context defined by their repository location.
Server-side JavaScript libraries are a special type of JavaScript program that can be imported and called in
other JavaScript programs. You can use JavaScript libraries to perform simple, repetitive tasks, for example,
to handle forms and form date, to manipulate date and time strings, to parse URLs, and so on.
Context
JavaScript libraries are internally developed extensions for SAP HANA. However, you can write your own
libraries, too. JavaScript libraries exist in the context of a package, which is referenced when you import the
library. To write a JavaScript library to use in your server-side JavaScript application, perform the following
steps:
Procedure
1. Create the file that contains the JavaScript library you want to add to the package and make available for
import.
In SAP HANA XS, server-side JavaScript libraries have the file extension .xsjslib, for example
greetLib.xsjslib.
a. In the Project Explorer view, right-click the folder where you want to create the new XSJS file and
choose New Other SAP HANA Application Development XS JavaScript Library File in the
context-sensitive popup menu.
b. Type a name for the new XS JavaScript libary file, for example greetLib and choose Finish.
If you are using SAP HANA studio to create artifacts in the SAP HANA Repository, the file creation
wizard adds a separator (.) and the required file extension automatically, for example, .xsjslib.
c. Enter the following content in the greetLib.xsjslibXSJS library file for your new XSJS application.
The following example creates a simple library that displays the word “Hello” along with a supplied
name and adds an exclamation point (!) as a suffix.
The SAP HANA XS JavaScript Reference lists all the functions that are available for use when programing
interaction between your application and SAP HANA. For example, you can use the database API to invoke
SQL statements from inside your application, or access details of the current HTTP request for SAP HANA
data with the request-processing API.SAP HANA XS includes the following set of server-side JavaScript APIs:
Database Enables access to the SAP HANA by means of SQL statements. For example, you can open a
connection to commit or rollback changes in SAP HANA, to prepare stored procedures (or SQL
statements) for execution or to return details of a result set or a result set's metadata.
Outbound connectivity Enables outbound access to a defined HTTP destination that provides services which an appli
cation can use. For example, you can read the connection details for an HTTP destination, re
quest data, and set details of the response body. You can also set up an SMTP connection for
use by outgoing multipart e-mails.
Request processing Enables access to the context of the current HTTP request, for example, for read requests and
write responses. You can use the functions provided by this API to manipulate the content of
the request and the response.
Session Enables access to the SAP HANA XS session, for example, to determine the language used in
the session or if a user has the privileges required to run an application.
Job Schedule Enables access to the job-scheduling interface which allows you to define and trigger recurring
tasks that run in the background. The XS jobs API allows you to add and remove schedules from
jobs.
Security Enables access to the $.security.crypto namespace and the classes AntiVirus and
Store, which provide tools that allow you to configure a secure store, set up anti-virus scans,
and generate hashes..
Trace Enables access to the various trace levels you can use to generate and log information about
application activity. You can view trace files in the diagnosis Files tab of the SAP HANA studio's
Administration perspective.
Utilities Enables access to utilities that you can use to parse XML and manipulate Zip archives, for ex
ample, to zip and unzip files, add and remove entries from Zip archives, and encrypt Zip ar
chives with password protection.
XS Data Services Provides access to a library of JavaScript utilities, which can be used to enable server-side Java
Script applications to consume data models that are defined using Core Data Services.
XS Procedures Provides access to a library of JavaScript utilities, which can be used to enable server-side Java
Script applications to call SAP HANA stored procedures as if the procedures were JavaScript
functions.
Database API
The SAP HANA XS Database API ($.hdb) provides tools that enable simple and convenient access to the
database.
You can use the Database API for the following operations
● $.hdb.Connection
Estalish a connection to the SAP HANA database
● $.hdb.ProcedureResult
Represents the result of a stored procedure call to the SAP HANA database
● $.hdb.ResultSet
Represents the result of a database query
The following example shows how to use the database API to connect to the SAP HANA database, commit
some changes, and end the current transaction.
Note
By default, auto-commit mode is disabled, which means that all database changes must be explicitly
commited.
The following example of usage of the SAP HANA XS database API shows how to establish a connection with
SAP HANA and return a result set from the specified procedure call. The example code assumes that a
procedure exists with the following signature:
PROCEDURE 'DB_EXAMPLE'.icecream.shop::sell(
IN flavor VARCHAR,
IN quantity INTEGER,
IN payment DECIMAL,
OUT change DECIMAL)
Note that the result can be accessed as if it were a JSON object with a structure similar to the following
example: {change: 1.50, $resultSets:[....]} .
Tip
$resultSets is not enumerable; it does not show up in a for-each loop.
The Outbound API ($.net) provides tools that you can use to perform the following actions:
● $.net.SMTPConnection
For sending $.net.Mail objects by means of an SMTP connection
● $.net.Mail
For constructing and sending multipart e-mails
● $.net.http
HTTP(s) client (and request) classes for outbound connectivity and an HTTP(s) destination class that hold
metadata, for example: host, port, useSSL.
The following example shows how to use the $.net.SMTPConnection class to send e-mail objects
($.net.Mail) by means of an SMTP connection object:
The following example shows how to use the $.net.Mail class to create an e-mail from an XS JavaScript
object and send it to the named recipients:
Note
If mandatory information is missing or an error occurs during the send operation, the mail.send() call
fails and returns an error.
The following example of server-side JavaScript shows how to use the outbound API to get (read) an HTTP
destination. You can also set the contents of the response, for example, to include details of the header, body,
and any cookies. For HTTPs connections you need to maintain a certificate (CA or explicit server certificate) in
a Trust Store; you use the certificate to check the connection against.
Tip
You define the HTTP destination in a text file using keyword=value pairs. You must activate the HTTP
destination in the SAP HANA repository. After activation, you can view details of the HTTP destination in the
SAP HANA XS Administration tool.
Request-Processing API
The Request-Processing API ($.web) provides access to the body of HTTP request and response entities. For
example, you can use the following classes:
● $.web.Body
Represents the body of an HTTP request entity and provides access to the data included in the body of the
HTTP request entity
● $.web.EntityList
Represents a list of request or response entities; the EntityList holds WebEntityRequest or
WebEntityResponse objects.
● $.web.TupelList
Represents a list of name-value pairs. The TupelList is a container that provides tuples for cookies,
headers, and parameters. A “tuple” is a JavaScript object with the properties “name” and “value”.
● $.web.WebRequest
Enables access to the client HTTP request currently being processed
The following example shows how to use the request-processing API to display the message “Hello World” in a
browser.
$.response.contentType = "text/plain";
$.response.setBody( "Hello, World !");
In the following example, you can see how to use the request-processing API to get the value of parameters
describing the name and vendor ID of a delivery unit (DU) and return the result set in JSON-compliant form.
In the following example of use of the request-processing API, we show how to access to the request's meta
data (and body) and, in addition, how to set and send the response.
// send response
$.response.contentType = "plain/test";
$.response.setBody("result: " + result);
$.response.status = $.net.http.OK;
} else {
// unsupported method
$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
}
Session API
Enables access to the SAP HANA XS session, for example, to determine the language used in the session or
check if a user has the privileges required to run an application.
You can use the XS JavaScript $.session API to request and check information about the currently open
sessions. For example, you can find out the name of a user who is currently logged on to the database or get
the session-specific security token. The $.session API also enables you to check if a user has sufficient
privileges to call an application. The following example checks if the user has the execute privilege that is
if (!$.session.hasAppPrivilege("sap.xse.test::Execute")) {
$.response.setBody("Privilege sap.xse.test::Execute is missing");
$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
}
In SAP HANA XS, a scheduled job is created by means of an .xsjob file, a design-time file you commit to (and
activate in) the SAP HANA repository. The .xsjob file can be used to define recurring tasks that run in the
background; the Job Schedule API allows developers to add and remove schedules from such jobs.
● Job
$.jobs.Job represents a scheduled XS job
● JobLog
$.jobs.JobLog provide access to the log entries of a scheduled job
● JobSchedules
$.jobs.JobSchedules enables control of an XS job's schedules.
Note
It is not possible to call the $.request and $.response objects as part of an XS job.
The XS jobs API $.jobs.Job enables you to add schedules to (and remove schedules from) jobs defined in
an .xsjob file.
The following example of server-side JavaScript shows how to use the Job Schedule API to add a schedule to a
existing job and delete a schedule from an existing job.
If the XS job file referred to in the URI is not in the same package as the XS JavaScript or SQLScript function
being called, you must add the full package path to the XS job file specified in the URI illustrated in line 1 of the
example above, for example, </path/to/package.>MyXSjob.xsjob.
Note
The path specified in </path/to/package.> can be either absolute or relative.
To understand the cron-like syntax required by the xscron job scheduler, use the following examples:
● 2013 * * fri 12 0 0
Run the job every Friday in 2013 at 12:00.
● * * 3:-2 * 12:14 0 0
Run every hour between 12:00 and 14:00 every day between the third and second-to-last day of the
month.
● * * * -1.sun 9 0 0
Run the job on the last Sunday of every month at 09:00.
Security API
The SAP HANA XS JavaScript security API $.security includes the $.security.crypto namespace and
the following classes:
● $.security.AntiVirus
Scan data with a supported external anti-virus engine
● $.security.Store
Store data securely in name-value form
The $.security.crypto namespace includes methods (for example, md5(), sha1(), and sha256()) that
enable you to compute an MD5 or SHA1/256 hash (or HMAC-MD5, HMAC-SHA1, and HMAC-SHA256).
The AntiVirus class includes a method scan() that enables you to set up a scan instance using one of the
supported anti-virus engines. The Store class enables you to set up a secure store for an SAP HANA XS
application; the secure store can be used to store sensitive information either at the application level
(store()) or per user (storeForUser()).
The following code example shows how to use the SAP HANA XS virus-scan interface (VSI) to scan a specific
object type: a Microsoft Word document.
Note
For more information about which antivirus engines SAP HANA supports, see SAP Note 786179.
The following code example shows how to set up a simple scan for data uploads using the SAP HANA XS virus-
scan interface.
Note
The design-time secure store is a file with the file extension “.xssecurestore”, for example,
localStore.xssecurestore; the secure-store file must include only the following mandatory content:
{}.
SAP HANA XS looks after the encryption and decryption of data and also ensures the persistency of the data.
For the stored data, you can choose between the following visibility options:
function store() {
var config = {
name: “foo”,
value: “bar”
};
var aStore = new $.security.Store("localStore.xssecurestore");
aStore.store(config);
}
function read() {
var config = {
name: “foo”
};
try {
var store = new $.security.Store("localStore.xssecurestore");
var value = store.read(config);
}
catch(ex) {
//do some error handling
}
}
Trace API
Enables access to the various trace levels you can use to generate and log information about application
activity. The specified error message is written to the appropriate trace file.
● $.trace.debug(message)
Note
If tracing is enable, messages generated by the $.trace API are logged in the SAP HANA trace file
xsengine_<host>_<Instance>_<#>.trc on the SAP HANA server, for example, in
<installation_path>/<SID>/HDB<nn>/<hostname>/trace. Trace messages with severity status
“warning”, “error” and “fatal” are also written to a similarly named alert file, for example,
xsengine_alert_<host>.trc.
Utilities API
The SAP HANA XS JavaScript Utilities API includes the $.util namespace, which contains the following
classes
● $.util.SAXParser
Tools for parsing XML content (for example, strings, array buffers, and the content of Web response body
objects)
● $.util.Zip
Compression tools for building, modifying, extracting, and encrypting archives
With the XS JavaScript Utilities API$.util.SAXParser class, you can create a new parser object and parse
the XML content of an XMLstring, an XML array buffer, or a $.web.Body object. The following example shows
how to use the XML parsing capabiliites of the $.util.SAXParser class:
Note
You can stop, reset, and resume a parsing operation. If the content to be parsed does not contain XML, the
parser throws an error.
The following code snippet shows how to use the $.util.SAXParser tools to parse the content of a
$.web.Body object.
● UTF-8 (default)
● UTF-16
● US-ASCII
The SAP HANA XS JavaScript Utilities API also includes the$.util.Zip tool, which enables you to perform a
series of actions on Zip archives, for example:
● Compress files into (zip) and extract files from (unzip) a Zip archive
● Add new entries to, update existing entries in, and remove entries from a Zip archive
● Encrypt Zip archives with password protection
The following code snippets show how to use the $.util.Zip tools to work with Zip file content, for example,
by adding, updating, extracting, and deleting entries. When modeling folder hierarchies, the Zip object behaves
like an associative array; the entry names are the keys (the full paths to the indicated files). In the following
example, we add an entry to a Zip file:
Note
“zip["entry1"]” is equivalent to “zip.entry1”.
In the following example, we extract an entry from a Zip file: if the entry does not exist, this returns undefined.
In the following example, we delete an entry from a Zip file: if the entry does not exist, nothing happens.
Note
There is a restriction on the amount of uncompressed data that can be extracted from a Zip archive using
the XS JS utilities API.
When using the XS JS utilities API to extract data from a Zip archive, the maximum amount of uncompressed
data allowed during the extraction process is defined with the parameter
max_uncompressed_size_in_bytes, which you can set in the zip section of the xsengine.ini
configuration file for a given SAP HANA system. If the zip section does not already exist, you must create it
and add the parameter to it, for example, using the SAP HANA Administration Console in SAP HANA studio. If
the parameter max_uncompressed_size_in_bytes is not set, a default value is assumed. The default value
is the value assigned to the property max_runtime_bytes in section jsvm section of the xsengine.ini file.
You can deactivate the global check on the amount of uncompressed data. If the global system
parametermax_uncompressed_size_in_bytes is set to -1, no check is performed on the amount of
uncompressed data generated by an extraction process using the Utilities API, unless there is a specific user
limitation in the XS JavaScript code, for example, with the maxUncompressedSizeInBytes parameter.
With the $.util.Zip class or the $.util.compression namespace, you can use the property
maxUncompressedSizeInBytes to override the global setting and reduce the amount of uncompressed data
allowed.
Note
Note that the parameter max_uncompressed_size_in_bytes cannot be used to increase the amount of
uncompressed data allowed beyond the value specified in the global setting.
SAP HANA XS Data Services (XSDS) is a collection of tools that includes a native client for Core Data Services
(CDS) and a query builder for SAP HANA Extended Application Services (SAP HANA XS) JavaScript. The
XSDS API provides a high-level abstraction of the database API ($.db, $.hdb) and gives access to SAP HANA
artifacts such as CDS entities or stored procedures. XSDS enables server-side JavaScript applications to
consume data models that are defined using Core Data Services more efficiently.
The following example shows how to query the database using CDS model data in XSDS unmanaged mode.
XS Procedures API
SAP HANA XS Procedures is a library of JavaScript tools which enable you to call SAP HANA stored
procedures from server-side JavaScript (XS JS) as if the stored procedures were native JavaScript functions.
The following example shows how to consume a stored procedure using the XS Procedures API.
The application package you put together in this tutorial includes all the artifacts you need to enable your
server-side JavaScript application to use the Outbound Connectivity API to request and obtain data via HTTP
from a service running on a remote host.
Prerequisites
Since the artifacts required to get the JavaScript application up and running are stored in the repository, it is
assumed that you have already performed the following tasks:
Context
SAP HANA Extended Application Services (SAP HANA XS) includes a server-side JavaScript API that enables
outbound access to a defined HTTP destination. The HTTP destination provides services which an application
can use, for example, to read live data. In this tutorial, you create a JavaScript application that queries financial
services to display the latest stock values. The financial services are available on a remote server, whose
details are specified in an HTTP destination configuration.
Procedure
1. Create a package for the SAP HANA XS application that will use the HTTP destination you define in this
tutorial.
For example, create a package called testApp. Make sure you can write to the schema where you create
the new application.
a. Start the SAP HANA studio and open the SAP HANA Development perspective.
b. In the SAP HANA Systems view, right-click the node in the package hierarchy where you want to
create the new package and, in the pop-up menu that displays, choose Packages...
Caution
Place the HTTP destination configuration in the same package as the application that uses it. An
application cannot reference an HTTP destination configuration that is located in another application
package.
You can use the file-creation wizard in the Project Explorer view to create this file, for example, New
Other XS HTTP Destination Configuration .
b. Enter the following code in the new file yahoo.xshttpdest.
host = "download.finance.yahoo.com";
port = 80;
description = "my stock-price checker";
useSSL = false;
pathPrefix = "/d/quotes.csv?f=a";
authType = none;
useProxy = false;
proxyHost = "";
proxyPort = 0;
timeout = 0;
Note
Saving a file in a shared project automatically commits the saved version of the file to the
repository.
Note
To make changes to the HTTP Destination configuration, you must use a text editor, save the changes
and reactivate the file.
Note
Access to details of HTTP destinations in the SAP HANA XS Administration Tool requires the
credentials of an authenticated database user and one of the following SAP HANA roles:
c. In the XS Artifact Administration screen, expand the nodes in the Application Objects tree to locate the
application testApp.
d. Choose yahoo.xshttpdest to display details of the HTTP destination .
e. Check the details displayed and modify if required.
4. Create a server-side JavaScript application that uses the HTTP destination you have defined.
The XSJS file must have the file extension .xsjs, for example, sapStock.xsjs.
Caution
You must place the XSJS application and the HTTP destination configuration it references in the same
application package. An application cannot use an HTTP destination configuration that is located in
another application package.
http://<XS_Webserver>:80<SAPHANA_InstanceNr>/testApp/sapStock.xsjs?
amount=100&stock=SAP.DE
○ <XS_Webserver>
Name of the system hosting the Web server for the SAP HANA XS instance where your
sapStock.xsjs application is located.
○ <SAPHANA_InstanceNr>
Number of the SAP HANA instance where the SAP HANA XS Web server is running, for example,
00
6. Change the details specified in the URL used to run the application.
You can enter different values for the parameters &amount and &stock in the URL:
○ amount=250
Change the number of stocks to check from 100 to 250
○ &stock=SAP.DE
Change the name of stock to check from SAP.DE to MCRO.L
Related Information
You can use the XS Procedures library to call stored procedures as if they were JavaScript functions.
Prerequisites
● The delivery unit HANA_XS_DBUTILS contains the XS procedures library. The content is available in the
package sap.hana.xs.libs.dbutils.
● Create a new (or use an existing) development workspace in the SAP HANA repository.
● Create a new (or use an existing) shared project in the workspace.
● Create a new (or use an existing) stored procedure.
This tutorial refers to the stored procedure get_product_sales_price, which is included in the
demonstration content provided with the SAP HANA Interactive Education (SHINE) delivery unit (DU). The
SHINE DU is available for download in the SAP Software Download Center.
Note
Access to the SAP Software Download Center is only available to SAP customers and requires logon
credentials.
Context
You can call stored procedures by using the contents of the XS Procedures library as if they were JavaScript
functions. For example, the library allows you to pass arguments as a JavaScript object to a stored procedure
that expects table arguments; XS Procedures manages the creation and use of the temporary tables needed
to pass arguments to a table-valued procedure. You can use the functions provided with the XS procedures
library to enable programmatic access to stored procedures in the SAP HANA database from an XS JavaScript
service; the access is provided by binding the stored procedure to a JavaScript function. The result of the call
to the bound function is a JavaScript object, whose properties are the outbound parameters of the procedure.
Procedure
2. Specify a schema where temporary tables can be created and filled with the values that are passed as
arguments to the stored procedure.
Note
The application code using XS procedures must ensure that the necessary privileges have been granted
to enable the creation and update of (and selection from) temporary tables in the specified schema.
XSProc.setTempSchema($.session.getUsername().toUpperCase());
Note
XS procedures uses the connection {connection: conn} passed in a configuration object as a
parameter. If no connection object is passed, the XS procedure library opens a separate connection for
the call and closes the connection after the call completes.
Table-valued input arguments are passed to the stored procedure using a Javascript array that
corresponds to the rows of the table containing the values to pass. The row objects should contain the
properties of the name of the columns. Skipped columns are filled with NULL; properties without a same-
named column are ignored.
Example
Related Information
http://help.sap.com/hana/SAP_HANA_XS_DBUTILS_JavaScript_API_Reference_en/index.html
Call stored SAP HANA procedures from XS server-side JavaScript (XSJS) and process the results of the calls
in JavaScript.
XS procedures provide a convenient way to call stored procedures in SAP HANA from XS server-side
Javascript (XSJS) and process the results of the calls in JavaScript. The XS procedures library extends the
features already available with the SAP HANA XS JavaScript database API. Using XS procedures, SAP HANA
stored procedures can be considered as simple XS JavaScript functions for anyone developing XS JavaScript
services.
For example, where an SAP HANA stored procedure uses a table as input parameter and a table as output, XS
Procedures use JavaScript objects (or an array of objects) which can be passed to the procedure. Similarly,
the result of the procedure call is provided as an array of JavaScript objects. You declare a stored procedure
as an XS JavaScript function and then call the stored procedure as if it were a JavaScript function delivering a
JavaScript object.
To use a stored procedure as an XS JavaScript function, the following steps are required:
Table 9:
Step Action Description
2 Specify a schema for temporary tables Temporary tables are used to store the JavaScript argu
ments provided for the function.
3 Import the procedure Create the XS JavaScript functions, which can later be used
to call the stored SAP HANA procedure. You can define func
tions which map your call arguments to the parameters of
the stored procedure.
4 Call the procedure Use the imported procedure in the same way as any normal
JavaScript function, for example, using JavaScript object ar
gument lists.
Use Arguments that Reference an Exist (Optional) Write the results or a procedure call into a physi
ing Table [page 61] cal table and pass the table as an argument rather than a
JavaScript object
Use Table-Valued Arguments [page (Optional) Call a procedure with arguments stored as values
61] in a table
If you want to pass a table as an argument rather than a JavaScript object, you must specify the name of the
table (as a string) in the call statement as well as the name of the schema where the table is located. The
following example shows how to reference the table rating_table.
getRating('schema.rating_table', 3);
The SAP HANA database enables you to materialize the results of a procedure call; that is, to write the results
into a physical table using the WITH OVERVIEW expression. In the WITH OVERVIEW expression, you pass a
string value to the output parameter position that contains the result you want to materialize. The value
returned is not the rating itself, but a reference to the table into which the results have been written. The
results of the procedure call can now be retrieved from the specified table, in this example, OUTPUT_TABLE.
The WITH OVERVIEW expression also allows you to write the results of a procedure into a global temporary
table; that is, a table that is truncated at session close. To use XS Procedures to write the results of a
procedure into a global temporary table, you do not specify a name for the result table; you include an empty
string (''), as illustrated in the following example:
The returned reference points to a global temporary table which can be queried for the procedure results with
the same connection.
Note
To ensure access to the global temporary table, it is necessary to specify the connection object conn.
XS Procedures enables you to call procedures with arguments stored as values in a table, as illustrated in the
following example. Table-valued input arguments are passed using a JavaScript array that corresponds to the
rows of the table to pass. These row objects must contain properties that correspond to the name of the
Related Information
You can use the SAP HANA XS Data Services (XSDS) library to query CDS entities as if they were JavaScript
objects.
Prerequisites
Note
Access to the SAP Software Download Center is only available to SAP customers and requires logon
credentials.
XS Data Service queries are used to build incrementally advanced queries against data models that are
defined with Core Data Service. Query results are arrays of nested JSON objects that correspond to instances
of CDS entities and their associations.
Procedure
In addition to the basic CDS definition, the code in the example above shows how to extend the definition
of soHeader by an explicit association called items. This is done by using the keyword $association
together with the referenced entity (soItem) and the type of the association. In this case, $viaBacklink
is used as type, that is; the items of soHeader stored in soItem have a foreign key SALESORDERID
referencing the key of the soHeader table.
3. Add a query.
A general query related to an entity is built by calling the $query() method of the entity constructor.
qOrders = qOrders.$limit(3);
result contains an array of unmanaged values, each of which represents a row of the Post entity.
The list of projected fields is a JavaScript object, where desired fields are marked by either true or a
String literal such as "TotalNet" denoting an alias name. The query illustrated in the example above
would return the following result.
[{
"SALESORDERID": "0500000236",
"TotalNet": 273.9,
"items": {
"NETAMOUNT": 29.9
}
}, {
"SALESORDERID": "0500000236",
"TotalNet": 273.9,
"items": {
"NETAMOUNT": 102
}
}, {
"SALESORDERID": "0500000236",
"TotalNet": 273.9,
"items": {
"NETAMOUNT": 55
}
}]
The actual database query automatically JOINs all required tables based on the associations involved. In
the example above, the generated SQL looks like the following:
Note
In the following code example, the names of table are abbreviated to help readability.
SELECT "t0"."SALESORDERID" AS
"t0.SALESORDERID",
"t0"."NETAMOUNT" AS "t0.NETAMOUNT",
"t0.items"."NETAMOUNT" AS "t0.items.NETAMOUNT"
FROM "Header" "t0"
LEFT OUTER JOIN "Item" "t0.items"
ON "t0"."SALESORDERID"="t0.items"."SALESORDERID"
LIMIT 10
var qSelectedOrders =
qOrderAndItemTitles.$where(soHeader.items.NETAMOUNT.
$div(soHeader.NETAMOUNT).$gt(0.5))
References to fields and associations such as items are available as properties of the entity constructor
function, for example, soHeader.items. As in the case with projections, XSDS generates all required
JOINs for associations referenced by the conditions automatically, even if they are not part of the current
projection. To build more complex expressions in $where, see the SAP HANA XS Data Services JavaScript
API Reference.
8. Refine the query conditions to a specific matching pattern.
With the $matching() method you can specify conditional expressions using the JSON-like syntax of the
$find() and $findAll() methods. The following code example shows how to further refine the
selection returned by the result set, for example, to accept only those items with a EUR currency and
quantity greater than 2.
qSelectedOrders = qSelectedOrders.$matching({
items: {
CURRENCY: 'EUR',
QUANTITY: {
$gt: 2
}
}
});
Tip
Unlike $findAll(), $matching() returns an unmanaged plain value and ignores all unpersistent
changes to any entity instances.
qSelectedOrders = qSelectedOrders.$addFields({
"DaysAgo": soHeader.items.DELIVERYDATE.$prefixOp("DAYS_BETWEEN", new
Date())
});
Note
This query refers to the SQL function DAYS_BETWEEN, which is not a pre-defined function in XSDS.
Instead, you can use the generic operator $prefixOp, which can be used for any SQL function f, for
example, with the syntax f(arg1, … argN).
Tip
In SQL terms, the $aggregate() operator creates a GROUP BY expression for the specified paths and
automatically projects the result.
If you need to use a more restrictive projection, you can replace true with false in the $aggregate call,
as illustrated in the following example, which removes the sales order IDs for the result set.
Related Information
You can use the XS Data Services (XSDS) library to update CDS entities as if they were JavaScript objects.
Prerequisites
Note
Access to the SAP Software Download Center is only available to SAP customers and requires logon
credentials.
Context
For read-write scenarios, SAP HANA XS Data Services (XSDS) offer a managed mode with automatic entity
management and additional consistency guarantees. Managed mode shares CDS imports and transaction
handling with unmanaged mode but uses a different set of methods provided by the entity constructors.
Procedure
1. Import the XSDS library and the CDS entities into your application.
In your entity import, specify a SAP HANA sequence that is used to generate the required keys.
order.CURRENCY = "USD";
order.HISTORY.CHANGEDAT = new Date();
order.$save();
order.$discard();
// disable auto-commit
XSDS.Transaction.$setAutoCommit(false);
var order = SOHeader.$get({ SALESORDERID: "0500000236" });
order.CURRENCY = "JPY";
order.$save(); // persist update
XSDS.Transaction.$commit(); // commit change
order.CURRENCY = "EUR";
order.$save(); // persist update
order.HISTORY.CHANGEDAT = new Date();
order.$save(); // persist update
XSDS.Transaction.$rollback(); // database rollback
// order #0500000236 now has currency JPY again
Related Information
In SAP HANA Extended Application Services (SAP HANA XS), you use the SQL-connection configuration file to
configure a connection to the database; the connection enables the execution of SQL statements from inside a
server-side JavaScript application with credentials that are different to the credentials of the requesting user.
In cases where it is necessary to execute SQL statements from inside your server-side JavaScript application
with credentials that are different to the credentials of the requesting user, SAP HANA XS enables you to
define and use a specific configuration for individual SQL connections. Each connection configuration has a
unique name, for example, Registration or AdminConn, which is generated from the name of the
corresponding connection-configuration file (Registration.xssqlcc or AdminConn.xssqlcc) on
activation in the repository. The administrator can assign specific, individual database users to this
configuration, and you can use the configuration name to reference the unique SQL connection configuration
from inside your JavaScript application code.
The following code example shows how to use the XS SQL connection AdminConn.xssqlcc.
function test() {
var body;
var conn;
$.response.status = $.net.http.OK;
try {
conn = $.db.getConnection("sap.hana.sqlcon::AdminConn");
var pStmt = conn.prepareStatement("select CURRENT_USER from dummy");
var rs = pStmt.executeQuery();
if (rs.next()) {
body = rs.getNString(1);
}
rs.close();
pStmt.close();
} catch (e) {
body = "Error: exception caught";
$.response.status = $.net.http.BAD_REQUEST;
}
if (conn) {
conn.close();
}
$.response.setBody( body );
}
test();
To use the SQL connection from your application during runtime, you must bind the SQL connection
configuration to a registered database user and assign the user the appropriate permissions, for example, by
assigning a pre-defined role to the user. To maintain this user mapping, SAP HANA XS provides the Web-
based SAP HANA XS Administration Tool. When the run-time status of the XSSQLCC artifact is set to active,
SAP HANA generates a new auto user (with the name XSSQLCC_AUTO_USER_[...]. The new user is granted
the permissions specified in a role, which can be assigned using the parameter role_for_auto_user - either
in the design-time artifact or the run-time configuration.
Note
Access to the tools provided by the XS Administration Tool requires the privileges granted by one or more
specific user roles.
● sap.hana.xs.admin.roles::SQLCCViewer
Required to display the available SQL Connections and the current user mapping
● sap.hana.xs.admin.roles::SQLCCAdministrator
Required to modify details of the user mapping; the SQLCCAdministrator role includes the role
SQLCCViewer.
Troubleshooting Tips
If you are having problems implementing the XS SQL connection feature using an .xssqlcc configuration,
check the following points:
● User permissions
Make sure that you grant the necessary user the activated role (for example,
sap.hana.xs.admin.roles::SQLCCAdministrator). You can use the developer tools to grant roles (or
privileges), as follows:
Note
The granting user must have the object privilege EXECUTE on the procedure
GRANT_ACTIVATED_ROLE.
Note
If you have to authorize libxsauthenticator, you might also need to refresh the Web page in your
browser the next time you want to access .xssqlcc to display the logon dialog again.
The .xssqlcc file enables you to establish a database connection that you can use to execute SQL
statements from inside your server-side JavaScript application with credentials that are different to the
credentials of the requesting user.
Prerequisites
Note
This tutorial combines tasks that are typically performed by two different roles: the application developer
and the database administrator. The developer would not normally require the privileges of the SAP HANA
administrator or those granted by the SQLCCAdministrator user role.
Context
In this tutorial, you learn how to configure an SQL connection that enables you to execute SQL statements
from inside your server-side JavaScript application with credentials that are different to the credentials of the
user requesting the XSJS service.
To configure and use an XS SQL configuration connection file, perform the following steps:
Procedure
The file-creation wizard adds the required file extension .xsapp automatically.
d. Choose Finish.
Tip
Files with names that begin with the period (.), for example, .xsapp or .xsaccess, are sometimes
not visible in the Project Explorer. To enable the display of all files in the Project Explorer view, use
the Customize View Available Customization option and clear all check boxes.
In the SAP HANA studio's Project Explorer view, right-click the new (.xsapp) file and choose Team
Activate from the context-sensitive popup menu.
3. Create the application access file for the new application.
a. In the SAP HANA studio, open the SAP HANA Development perspective.
b. In the Project Explorer view, right-click the folder where you want to create the new (.xsaccess) file.
c. In the context-sensitive popup menu, choose New Other... .
d. In the Select a Wizard dialog, choose SAP HANA Application Development XS Application
Access File
The file-creation wizard adds the required file extension .xsaccess automatically and enables direct
editing of the file.
Note
The default name for the core application-access file is .xsaccess and cannot be changed.
e. Choose Finish.
f. Check the contents of the .xsaccess file.
{
"exposed" : true,
"authentication" : { "method" : "Form"},
"prevent_xsrf" : true
}
a. Right-click the folder where you want to save the XS SQL connection configuration file and choose
New Other... Application Development XS SQL Connection Configuration File in the context-
sensitive popup menu.
b. Enter the name of the SQL connection configuration file in the File Name box, for example,
AdminConn.
Tip
The file-creation wizard adds the required file extension automatically (for example,
AdminConn.xssqlcc) and, if appropriate, enables direct editing of the new file in the
corresponding editor.
c. Choose Finish to save the changes and commit the new XS SQL connection configuration file in the
repository.
5. Configure the details of the SQL connection that the XS JavaScript service will use.
a. Define the required connection details.
{
"description" : "Admin SQL connection"
"role_for_auto_user" : "com.acme.roles::JobAdministrator"
}
Tip
Replace the package path (com.acme.roles) and role name (JobAdministrator) with the
suitable ones for your case.
Note
Activating the SQL connection configuration file AdminConn.xssqlcc creates a catalog object with the
name sap.hana.xs.testApp1::AdminConn, which can be referenced in a XS JavaScript application.
6. Write an XS JavaScript application that calls the XS SQL connection configuration.
To create a preconfigured SQL connection using the configuration object AdminConn, for example, from
inside your JavaScript application code, you must reference the object using the object name with the full
package path, as illustrated in the following code example.
function test() {
var body;
var conn;
$.response.status = $.net.http.OK;
try {
conn = $.db.getConnection("sap.hana.xs.testApp1::AdminConn");
Note
Saving a file in a shared project automatically commits the saved version of the file to the repository.
You do not need to explicitly commit it again.
Note
Access to details of HTTP destinations in the SAP HANA XS Administration Tool requires the
credentials of an authenticated database user and one of the following SAP HANA roles:
○ sap.hana.xs.admin.roles::SQLCCViewer
○ sap.hana.xs.admin.roles::SQLCCAdministrator
b. In the XS Applications tab, expand the nodes in the application tree to locate the application testApp.
c. Choose AdminConn to display details of the XS SQL configuration connection .
10. Set the run-time status of the XS SQL connection configuration.
You must change the status rutime status of the XS SQL connection configuration to Active. This run-time
status can only be changed by an administrator. When the run-time status of the XSSQL connection
configuration is set to active, SAP HANA automatically generates a new user
(XSSQLCC_AUTO_USER_[...]) for the XSSQL connection configuration object and assigns the role
defined in role_for_auto_user to the new auto-generated user.
If you want to create an SQL connection configuration, you must create the configuration as a flat file and save
the file with the suffix .xssqlcc, for example, MYSQLconnection.xssqlcc. The new configuration file must
be located in the same package as the application that references it.
Note
An SQL connection configuration can only be accessed from an SAP HANA XS JavaScript application
(.xsjs) file that is in the same package as the SQL connection configuration itself. Neither subpackages
nor sibling packages are allowed to access an SQL connection configuration.
The following example shows the composition and structure of a configuration file AdminConn.xssqlcc for
an SAP HANA XS SQL connection called AdminConn. On activation of the SQL connection configuration file
AdminConn.xssqlcc (for example, in the package sap.hana.sqlcon), an SQL connection configuration
with the name sap.hana.sqlcon::AdminConn is created, which can be referenced in your JavaScript
application. In the xssqlcc artifact, you can set the following values:
● description
A short description of the scope of the xs sql connection configuration
● role_for_auto_user
The name of the role to be assigned to the auto user (if required) that the XSSQL connection uses, and the
absolute path to the package where the role definition is located in the SAP HANA repository.
sap.hana.sqlcon::AdminConn.xssqlcc
{
"description" : "Admin SQL connection"
"role_for_auto_user" : "com.acme.roles::JobAdministrator"
}
The run-time status of an XSSQL connection configuration is inactive by default; the run-time status can only
be activated by an SAP HANA user with administrator privileges, for example, using the SAP HANA XS
Administration Tools. When the run-time status of the XSSQLCC artifact is set to active, SAP HANA generates
a new auto user (with the name XSSQLCC_AUTO_USER_[...]) and assigns the role defined in
role_for_auto_user to the new auto-generated user.
Tip
In the SAP HANA XS Administration Tools, it is possible to view and edit both the the user's parameters and
the role's definition.
{
conn = $.db.getConnection("sap.hana.sqlcon::AdminConn");
}
Related Information
The XS SQL connection-configuration file .xssqlcc uses pairs of keywords and values to define the SQL
connection.
Example
The XS SQL Connection Configuration (.xssqlcc) File
Code Syntax
{
"description" : "Admin SQL connection"
"role_for_auto_user" : "com.acme.roles::JobAdministrator"
}
description
Sample Code
The name of (and package path to) the role assigned to be assigned to the new user that is automatically
generated on activation of the XSSQL connection-configuration artifact.
Sample Code
"role_for_auto_user" : "com.acme.roles::JobAdministrator"
Activating the design-time XSSQL connection configuration generates a run-time object whose status is
“inactive” by default; the run-time status must be set to active by an SAP HANA user with administrator
privileges, for example, using the SAP HANA XS Administration Tools. When the run-time status of the
XSSQLCC artifact is set to active, SAP HANA generates a new auto user (with the name
XSSQLCC_AUTO_USER_[...]) and assigns the role defined in role_for_auto_user to the new auto-
generated user.
Related Information
HTTP requests can define the language used for communication in the HTTP header Accept-Language. This
header contains a prioritized list of languages (defined in the Browser) that a user is willing to accept. SAP
HANA XS uses the language with the highest priority to set the language for the requested connection. The
language setting is passed to the database as the language to be used for the database connection, too.
In server-side JavaScript, the session object's language property enables you to define the language an
application should use for a requested connection. For example, your client JavaScript code could include the
following string:
Note
Use the language-code format specified in BCP 47 to set the session language, for example: “en-US” (US
English), “de-AT” (Austrian German), “fr-CA” (Canadian French).
As a client-side framework running in the JavaScript sandbox, the SAP UI5 library is not aware of the Accept-
Language header in the HTTP request. Since the current language setting for SAPUI5 is almost never the
same as the language specified in the SAP HANA XS server-side framework, SAPUI5 clients could have
problems relating to text displayed in the wrong language or numbers and dates formatted incorrectly.
<script id="sap-ui-bootstrap"
type="text/javascript"
src="/sap/ui5/1/resources/sap-ui-core.js"
data-sap-ui-theme="sap_goldreflection"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-language="de">
</script>
<script>
window["sap-ui-config"] = {
"language" : "de"
}
</script>
[…]
<script id="sap-ui-bootstrap"
[…]
</script>
The sap-ui-config object must be created and filled before the sap-ui-bootstrap script.
It is important to understand that the session starts when a user logs on, and the specified language is
associated with the session. Although the user can start any number of applications in the session, for
example, in multiple Browser tabs, it is not possible to set a different language for individual applications called
in the session,
The script tag for the SAPUI5 startup can be generated on the server side, for example, using the
$.session.language property to set the data-sap-ui-language parameter. Applications that have the
SAPUI5 <script> tag in a static HTML page can use this approach, as illustrated in the following example:
<script id="sap-ui-bootstrap"
type="text/javascript"
src="/sap/ui5/1/resources/sap-ui-core.js"
data-sap-ui-theme="sap_goldreflection"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-language="$UI5_LANGUAGE$">
</script>
The called XSJS page can be instructed to replace the $UI5_LANGUAGE$ parameter, for example, with the
value stored in $.session.language when loading the static HTML page.
You can include an HTTP call in the static HTML page to fetch the correct language from the server using some
server-side JavaScript code, as illustrated in the following example:
<script>
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "getAcceptLanguage.xsjs", false );
xmlHttp.send( null );
window["sap-ui-config"] = {
"language" : xmlHttp.getResponseHeader("Content-Language")
}
</script>
<script id="sap-ui-bootstrap"
…
</script>
This approach requires an XSJS artifact (for example, getAcceptLanguage.xsjs) that responds to the
AJAX call with the requested language setting, as illustrated in the following example:
$.response.contentType = "text/plain";
$.response.headers.set("Content-Language", $.session.language);
$.response.setBody("");
Scheduled jobs define recurring tasks that run in the background. The JavaScript API $.jobs allows
developers to add and remove schedules from such jobs.
If you want to define a recurring task, one that runs at a scheduled interval, you can specify details of the job in
a .xsjob file. The time schedule is configured using cron-like syntax. You can use the job defined in
an .xsjob file to run an XS Javascript or SQLScript at regular intervals. To create and enable a recurring task
using the xsjob feature, you perform the following high-level tasks:
Note
The tasks required to set up a scheduled job in SAP HANA XS are performed by two distinct user roles: the
application developer and the SAP HANA administrator. In addition, to maintain details of an XS job in the
SAP HANA XS Administration Tool, the administrator user requires the privileges assigned by the user role
sap.hana.xs.admin.roles::JobAdministrator .
1 Create the function or script you want to run at regular intervals Application developer Text edi
tor
2 Create the job file .xsjob that defines details of the recurring Application developer Text edi
task tor
3 Maintain the corresponding runtime configuration for the xsjob SAP HANA administrator XS Job
Dash
board
4 Enable the job-scheduling feature in SAP HANA XS SAP HANA administrator XS Job
Dash
board
5 Check the job logs to ensure the job is running according to SAP HANA administrator XS Job
schedule. Dash
board
Related Information
The xsjob file enables you to run a service (for example, an XS JavaScript or an SQLScript) at a scheduled
interval.
Prerequisites
Note
This tutorial combines tasks that are typically performed by two different roles: the application developer
and the database administrator. The developer would not normally require the privileges granted to the
JobAdministrator user role, the sap.hana.xs.admin.roles::HTTPDestAdministrator user role, or the SAP
HANA administrator.
In this tutorial, you learn how to schedule a job that triggers an XS JavaScript application that reads the latest
value of a share price from a public financial service available on the Internet. You also see how to check that
the XS job is working and running on schedule.
To schedule an XS job to trigger an XS JavaScript to run at a specified interval, perform the following steps:
Procedure
1. Create the application package structure that contains the artifacts you create and maintain in this
tutorial.
Create a root package called yahoo. You use the new yahoo package to contain the files and artifacts
required to complete this tutorial.
/yahoo/
.xsapp // application descriptor
yahoo.xsjob // job schedule definition
yahoo.xshttpdest // HTTP destination details
yahoo.xsjs // Script to run on schedule
2. Write the XS JavaScript code that you want to run at the interval defined in an XS job schedule.
The following XS JavaScript connects to a public financial service on the Internet to check and download
the latest prices for stocks and shares.
Create an XS JavaScript file called yahoo.xsjs and add the code shown in the following example:
function readStock(input) {
var stock = input.stock;
Note
Saving a file in a shared project automatically commits the saved version of the file to the repository, To
explicitly commit a file to the repository, right-click the file (or the project containing the file) and
choose Team Commit from the context-sensitive popup menu.
Note
To maintain the runtime configuration details using the Web-based XS Administration Tool you need the
privileges granted in the SAP HANA user role sap.hana.xs.admin.roles::HTTPDestAdministrator.
host = "download.finance.yahoo.com";
port = 80;
{
"description": "Read stock value",
"action": "yahoo:yahoo.xsjs::readStock",
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
Note
To maintain details of an XS job using the Web-based XS Administration Tool you need the
privileges granted in the SAP HANA user role sap.hana.xs.admin.roles::JobAdministrator.
Note
It is not possible to enable the scheduler for more than one host in a distributed SAP HANA XS
landscape.
a. In the XS Job Dashboard set the Scheduler Enabled toggle button to YES.
Toggling the setting for the Scheduler Enabled button in the XS Job Dashboard changes the value set for
the SAP HANA configuration variable xsengine.ini scheduler enabled , which is set in the
Configuration tab of the SAP HANA studio's Administration perspective.
7. Check the job logs to ensure the XS job is active and running according to the defined schedule.
You can view the xsjob logs in the XS Job Dashboard tab of the SAP HANA XS Administration Tool.
Note
To maintain details of an XS job using the Web-based XS Administration Tool you need the privileges
granted in the SAP HANA user role sap.hana.xs.admin.roles::JobAdministrator.
If the job does not run at the expected schedule, the information displayed in the xsjob logs includes
details of the error that caused the job to fail.
Related Information
The XS job file uses a cron-like syntax to define the schedule at which the service defined in an XS JavaScript
or SQLScript must run, as you can see in the following example, which runs the specified job (the stock-price
checking service yahoo.xsjs) on the 59th second minute of every minute.
{
"description": "Read stock value",
"action": "yahoo:yahoo.xsjs::readStock",
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
When defining the job schedule in the xsjob file, pay particular attention to the entries for the following
keywords:
● action
Text string used to specify the path to the function to be called as part of the job.
"action": "<package_path>:<XSJS_Service>.xsjs::<FunctionName>",
Note
You can also call SQLScripts using the action keyword.
● description
Text string used to provide context when the XSjob file is displayed in the SAP HANA XS Administration
tool.
● xscron
The schedule for the specified task (defined in the “action” keyword); the schedule is defined using
cron-like syntax.
● parameter
A value to be used during the action operation. In this example, the parameter is the name of the stock
SAP.DE provided as an input for the parameter (stock) defined in the readStock function triggered by
the xsjob action. You can add as many parameters as you like as long as they are mapped to a parameter
in the function itself.
The following examples illustrate how to define an xscron entry including how to use expressions in the
various xscron entries (day, month, hour, minutes,...):
● 2013 * * fri 12 0 0
Every Friday of 2013 at 12:00 hours
● * * 3:-2 * 12:14 0 0
Every hour between 12:00 and 14:00 hours on every day of the month between the third day of the month
and the second-last day.
● * * * * * */5 *
Every five minutes (*/5) and at any point (*) within the specified minute.
Note
Using the asterisk (*) as a wild card in the seconds field can lead to some unexpected consequences, if
the scheduled job takes less than 59 seconds to complete; namely, the scheduled job restarts on
completion. If the scheduled job is very short (for example, 10 seconds long), it restarts repeatedly until
the specified minute ends.
To prevent short-running jobs from restarting on completion, schedule the job to start at a specific second
in the minute. For example, * * * * * */5 20 indicates that the scheduled job should run every five
minutes and, in addition, at the 20th second in the specified minute.
● * * * -1.sun 9 0 0
Every last Sunday of a month at 09:00 hours
Related Information
The XS job file .xsjob uses a number of keywords to define the job that must be run at a scheduled interval.
Example
The XS Job (.xsjob) File
{
"description": "Read stock value",
"action": "yahoo:yahoo.xsjs::readStock",
"schedules": [
{
"description": "Read current stock value",
"signature_version": 1,
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
{
"description": "Read stock value",
}
The description keyword enables you define a text string used to provide context when the XS job is displayed
for maintenance in the SAP HANA XS Administration Tool. The text string is used to populate the Description
field in the SCHEDULED JOB tab.
action
{
"action": "myapps.finance.yahoo:yahoo.xsjs::readStock",
}
The action keyword enables you to define the function to run as part of the XS job, for example, an XS
JavaScript or an SQLScript. The following syntax is required: “action” :
“<package.path>:<XSJS_Service>.xsjs::<functionName>”.
Note
If you want to use the action to call an SQLScript, replace the name of the XSJS service in the example, with
the corresponding SQLScript name.
schedules
{
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
The schedules keyword enables you define the details of the XS job you want to run. Use the following
additional keywords to provide the required information:
● description (optional)
Short text string to provide context
● xscron
Uses cron-like syntax to define the schedule at which the job runs
signature_version
{
"signature_version": 1,
}
The signature_version keyword enables you manage the version “signature” of an XS job. You change the XS
job version if, for example, the parameter signature of the job action changes; that is, an XS job accepts more
(or less) parameters, or the types of parameters differ compared with a previous version of an XS job. On
activation in the SAP HANA Repository, the signature of an XS job is compared to the previous one and, if the
job’s signature has changed, any job schedules created at runtime will be deactivated.
Note
The default value for signature_version is 0 (zero).
Deactivation of any associated runtime job schedules prevents the schedules from silently failing (no
information provided) and enables you to adjust the parameters and reactivate the job schedules as required,
for example, using the enhanced XS JS API for schedules. Schedules defined in a design-time XS Job artifact
are replaced with the schedules defined in the new version of the XS job artifact.
Tip
Minor numbers (for example, 1.2) are not allowed; the job scheduler interprets “1.2” as “12”.
xscron
{
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
The xscron keyword is used in combination with the schedules keyword. The xscron keyword enables you to
define the schedule at which the job runs. As the name suggests, the xscron keyword requires a cron-like
syntax.
The following table explains the order of the fields (*) used in the “xscron” entry of the .xsjob file and lists
the permitted value in each field.
Month 1 to 12
Day -31 to 31
DayofWeek mon,tue,wed,thu,fri,sat,sun
Hour 0 to 23
Minute 0 to 59
Second 0 to 59
Note
Using the asterisk (*) as a wild card in the seconds field can lead to some unexpected consequences, if the
scheduled job takes less than 59 seconds to complete; namely, the scheduled job restarts on completion. If
the scheduled job is very short (for example,10 seconds long), it restarts repeatedly until the specified
minute ends.
To prevent short-running jobs from restarting on completion, schedule the job to start at a specific second in
the minute. For example, * * * * * */5 20 indicates that the scheduled job should run every five minutes
and, in addition, at the 20th second in the specified minute. The job starts at precisely 20 seconds into the
specified minute and runs only once.
The following table illustrates the syntax allowed to define expressions in the “xscron” entry of the .xsjob
file.
Table 12:
Expression Where used... Value
a,b,c Anywhere a or b or c
parameter
{
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE",
The optional parameter keyword is used in combination with the schedules keyword. The parameter keyword
defines values to be used as input parameters by the XSJS function called as part of the job. You can list as
many parameters as you like, separated by a comma (,) and using the JSON-compliant syntax quotations (“”).
The $.jobs application programming interface (API) enables you to manipulate the schedules for an XS job at
runtime.
Context
You can use the $.jobs.JobSchedules API to add a schedule to (or delete a schedule from) a job defined in
an .xsjob file at runtime.
Note
Schedules added at runtime are deleted when the .xsjob file is redeployed.
Procedure
Note
If you have already created this XS job file, for example, in another tutorial, you can skip this step.
{
"description": "Read stock value",
"action": "yahoo:yahoo.xsjs::readStock",
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
Note
Saving a file in a shared project automatically commits the saved version of the file to the repository, To
explicitly commit a file to the repository, right-click the file (or the project containing the file) and
choose Team Commit from the context-sensitive popup menu.
2. Create the XS JavaScript (.xsjs) file you want to use to define the automatic scheduling of a job at
runtime.
Name the file schedule.xsjs.
3. Use the $.jobs JavaScript API to add or delete a schedule to a job at runtime.
The following example schedule.xsjs adds a new schedule at runtime for the XS job defined in
yahoo.xsjob, but uses the parameter keyword to change the name of the stock price to be checked.
Related Information
The SAP HANA XS server-side JavaScript API provides tracing functions that enable your application to write
predefined messages in the form of application-specific trace output in the xsengine trace files
(xsengine*.trc) according to the trace level you specify, for example, “info”(information) or “error”.
If you use the server-side JavaScript API to enable your application to write trace output, you can choose from
the following trace levels:
● debug
● info
● warning
● error
For example, to enable debug-level tracing for your JavaScript application, include the following code:
The server-side JavaScript API for SAP HANA XS enables you to activate the writing of messages into a trace
file; the following trace levels are available: debug, error, fatal, info, and warning.
Context
By default, applications write messages of severity level error to the xsengine*.trc trace files; you can
increase the trace level manually, for example, to fatal. In SAP HANA XS, the following steps are required to
enable trace output for your server-side JavaScript application:
Procedure
Note
To set the trace level, click the cell in the System Trace Level column that corresponds with the
application you want to trace and choose the desired trace level from the drop-down list.
The server-side JavaScript API for SAP HANA XS enables you to instruct your JavaScript applications to write
application-specific trace messages in the xsengine*.trc trace files. You can view the trace files in the
Diagnosis Files tab page of the Administration perspective in the SAP HANA studio.
Context
The trace levels “debug”, “error”, “fatal”, “info”, and “warning” are available. To view trace output for your
server-side JavaScript application, perform the following steps:
Procedure
SAP HANA XS provides a set of dedicated tools to enable you to debug the XS JavaScript code that you write.
To trigger debugging, you need an XS JavaScript configuration.
Overview
To prepare the system for debugging, you need to perform the following high-level steps:
To trigger debugging, you need to choose an XS JavaScript configuration; each configuration type represents
a different starting point for debugging an XS JavaScript file. To debug XS JavaScript, you must choose one of
the following types of configuration:
● XS JavaScript
Use to debug a stand-alone XS JavaScript service.
● XS JavaScript: Manual Session
Use to debug an XS JavaScript initiated from any remote client using that specific XS session.
● XS JavaScript: HTML-based
Use to debug an XS JavaScript initiated from HTML.
● XS JavaScript: XS OData-based
Use to debug an XS JavaScript initiated from an XS OData breakout.
Note
Before you start debugging server-side JavaScript on SAP HANA Extended Application Services (SAP
HANA XS), first check that you have fulfilled the following prerequisites:
Note
By default, other users do not have the permissions required to access your XS JavaScript debugging
sessions. However, SAP HANA XS enables you to grant access to your debug sessions to other users,
and vice versa.
Note
Debugging can also be done in other settings, for example, when a server is cloud-based or when it is a
secured server.
Related Information
Context
Procedure
Note
You can use an existing configuration, change it or create a new debug configuration by selecting the
file type to use for debugging, and clicking on the New button.
4. In the General tab, enter a name for the new debug configuration.
5. The external browser is your default debug mode. You can also choose to debug using the internal SAP
HANA Studio.
6. To build the URL, select the file and resource path or add parameters where relevant. Parameters can be
entered using raw text or a table format.
○ When creating a manual session debug configuration, you only need to select the system to debug.
○ If a system is logged off, it will not show in the system dropdown list.
7. You can include stored procedures in your debug configuration which will enable SQL script to be
debugged along with XS JavaScript. If your XS JavaScript code triggers stored procedures, you can set
breakpoints and debug them using the same debug configuration. You do not need to create a separate,
dedicated debug configuration for the stored procedures.
8. For configurations with an Input Parameters tab, select the method, and enter the header and body
information as relevant. Body details can be entered as raw text or in the x-www-form-urlencoded format.
9. Choose Apply.
10. Choose Close to save the configuration for later use or Debug to start debugging.
SAP HANA studio enables you to debug XS JavaScript files, including setting breakpoints and inspecting
variables.
Context
To enable the display of more helpful and verbose information for HTTP 500 exceptions on the SAP HANA XS
Web server, add the parameter developer_mode to the xsengine.ini httpserver section and set it to
true. xsengine.ini is in the Configuration tab of the Administration perspective in SAP HANA studio.
Prerequisites
Procedure
1. In a Web browser, run the XS JavaScript source file that you want to debug.
2. Create or choose a debug configuration for debug sessions for a specific SAP HANA installation.
a. Open the Debug view.
b. Choose a debug configuration.
You can also create a new configuration by doing one of the following:
○ From the menu bar, click Run Debug Configuration Run Debug Configurations .
○ Select the file to be debugged and right-click, choose Debug As Debug Configurations .
c. Choose Apply.
d. Choose Close.
3. Set Breakpoints
Set breakpoints in the JavaScript code by double-clicking the left vertical ruler.
4. Run the new debug configuration for your server by choosing and selecting your debug
configuration.
You can also run the debug configuration by doing one of the following:
○ From the menu bar, click Run Debug Configurations , then choose the debug configuration you
want to use.
○ Select the file to be debugged and right-click on it, and then choose Debug As.
○ From Debug Configurations, click the debug configuration you want to use.
○ For an HTML file, select the file to be debugged and right-click on it, then choose Debug As
HTML .
Note
When using the external debug mode, you can only have one open XS debug session per system. This is
relevant for the following debug configurations:
Related Information
SAP HANA studio includes a dedicated debug perspective, which provides the tools needed by a developer
who wants to debug server-side JavaScript code.
Application developers can use the SAP HANA studio's Debug perspective to perform standard debugging
tasks, for example: starting and resuming code execution, stepping through code execution, adding
breakpoints to the code. Developers can also inspect variables and check the validity of expressions. The
following views are available as part of the standard Debug perspective:
● Debug
Displays the stack frame for the suspended or terminated threads for each target you are debugging. Each
thread in your program appears as a node in the tree. You can also see which process is associated with
each target.
● Breakpoints
Displays a list of the breakpoints set in the source file you are currently debugging
● Variables
Displays a list of the variables used in the source file you are currently debugging
● Expressions,
Displays global variables, such as $.request and other SAP HANA XS JavaScript API objects
● Outline
Displays a structural view of the source file you are currently debugging. You can double-click an element
to expand and collapse the contents.
● Source-code editor
SAP HANA studio uses the file extension (for example, .js or .xsjs) of the source file you want to debug
and opens the selected file in the appropriate editor. For example, files with the .js or .xsjs file
extension are displayed in the built-in JavaScript editor.
Note
Unified Debugger
In the unified debugger, if you choose to include the SQL script layer in the debugging session, you will see
the targets of both the XS JavaScript and SQL script in the debug view.
If a breakpoint is set in the XS JavaScript or in an SQL script procedure, you will see the breakpoints in the
breakpoint view. The debugger will stop at the breakpoints in the relevant XS JavaScript or in the SQL script
as usual. SQL script debugging behavior is the same in the SQL script debugger as it is in the unified
The JavaScript debugger included with SAP HANA Extended Application Services (SAP HANA XS) requires
user authentication to start a debug session. SAP HANA XS includes a dedicated debugger role, which defines
the permissions needed by a developer who wants to debug server-side JavaScript code.
Debugging application code is an essential part of the application-development process. SAP HANA Extended
Application Services (SAP HANA XS) includes a debug perspective, a debug view, and a dedicated debugger
role that must be assigned to any developer who wants to debug XS JavaScript. The debugging role is named
sap.hana.xs.debugger::Debugger and can be assigned to a user (or a role) either with the standard role-
assignment feature included in SAP HANA studio (the Application Privileges tab in the Security area of the
Systems view) or in a design-time, role-configuration file (.hdbrole).
Since a developer primarily needs to debug his own HTTP calls, the following limitations apply to a debug
session:
● Only authenticated users can start a debug session, for example, by providing a user name and password
when logging in to a debug session
● A user can debug his own sessions.
Note
It is also possible to use SSL for debugging. If SSL is configured, the server redirects the Web-socket
connect call to the corresponding SSL (secure HTTP) URL, for example, if sent by plain HTTP.
SAP HANA studio includes a graphical user interface (GUI) which you can use to grant access to debug
sessions at both the session level and the user level.
You can grant other developers access to the debug sessions you use for debugging server-side JavaScript on
SAP HANA XS.
By default, other users are not allowed to access your XSJS debugging sessions. However, SAP HANA XS
provides a tool that enables you to grant access to your debugging sessions to other users, too.
Note
You can grant a user global access to any of your sessions or grant access to a session that is flagged with a
specified token. You can also restrict access to a debug session to a specified period of time.
The XS Debugging tool is available on the SAP HANA XS Web server at the following URL:
<SAPHANAWebServer>80<SAPHANAinstance>/sap/hana/xs/debugger/.
When you are grant access to your debugging session, the following options are available:
● User Name
The name of the database user who requires access to your debug session
● Privilege Expires
The point in time that marks the end of the period for which access to one or more debug sessions is
allowed.
● grant debug permission for all sessions
You can grant a user global access to any of your debug sessions.
Restriction
The user you grant access to must already be registered and authenticated in the SAP HANA database.
Restriction
Unauthenticated users must use the token-based option.
The following rules apply to access to debug sessions flagged with a token:
○ The session used for granting access to the debug sessions is flagged automatically.
Related Information
When debugging your JavaScript code, you sometimes need to solve problems, not only with the code itself,
but the configuration of the sessions and the tools you use to perform the debugging.
Prerequisites
● Start a Web-browser session with the SAP HANA server before starting a debug session.
Make sure you open a session with the SAP HANA server by calling an XS JavaScript file from your Web
browser before starting the debug operation.
● Select the session ID.
Before starting to debug, select the session whose ID is specified in the xsSessionId cookie in your open
Web-browser session.
Context
If you are having problems using the embedded debugging tools to debug your server-side XSJS (JavaScript)
code, check the following solutions:
● Breakpoints
The execution of your XS JavaScript code is not stopping at a breakpoint.
● Network connections
Your SAP HANA server is behind a proxy or a firewall.
Sample Code
hdbstudio.exe -clean
To determine if a clean restart of SAP HANA studio is required, check if the Breakpoints view in SAP HANA
studio's Debug perspective displays the breakpoints as type SAP HANA XSE Script, as follows:
If your SAP HANA server is behind a proxy or firewall, check that your Network Connections are configured
for using a proxy, as follows:
Note
It is not recommended to run a debugging session without using the Secure Sockets Layer (SSL)
protocol. The debugging session uses standard HTTP(S). The session either leverages an existing
session or requests basic (HTTP) authentication on the connection request. The debugging session
upgrades the HTTP connection to a WebSocket.
Related Information
SAP HANA provides a test framework called XSUnit that enables you to set up automatic tests for SAP HANA
XS applications.
The test framework SAP HANA XSUnit (XSUnit) is a custom version of the open-source JavaScript test
framework, Jasmine, adapted for use with SAP HANA XS. You can use the XSUnit test framework to automate
the tests that you want to run for SAP HANA XS applications, for example, to test the following elements:
To use the tools and features provided with the XSUnit test framework, you must perform the following high-
level steps:
Note
Importing a delivery unit into an SAP HANA system requires the REPO.IMPORT privilege, which is
normally granted only to the system administrator.
Note
You must ensure that _SYS_REPO has select permission to schema where the tables are located (for
example, either your user schema or the test schema).
Related Information
XSUnit is an integrated test environment that enables you to set up automatic tests for SAP HANA XS
applications.
People developing applications in the context of the SAP HANA database need to understand how to
implement a test-automation strategy. Especially for new applications which are designed to work exclusively
with SAP HANA, it is a good idea to consider the adoption of best practices and tools.
If you want to develop content that is designed to run specifically in SAP HANA, it is strongly recommended to
use the XSUnit test framework that is integrated in SAP HANA XS; this is the only way to transport your test
code with your SAP HANA content. The XSUnit tools are based on a Java Script unit test framework that uses
Jasmine as the underlying test library.
To write self-contained unit tests that are executable in any system, you have to test the various SAP HANA
objects in isolation. For example, an SAP HANA view typically has dependencies to other views or to database
tables; these dependencies pass data to the view that is being tested and must not be controlled or
overwritten by the test. For this reason, you need to be able to simulate dependencies on the tested view.
XSUnit includes a test-isolation tool that provides this functionality; it allows you to copy a table for testing
purposes.
Note
Although you cannot copy a view for testing purposes, you can create a table that acts like a view.
All (or specific) dependencies on any tables or views are replaced by references to temporary tables, which
can be created, controlled, and populated with values provided by the automated test.
Test Data
Preparing and organizing test data is an important part of the process of testing SAP HANA content such as
views and procedures; specific data constellations are required that have to be stable in order to produce
reliable regression tests. In addition, test-isolation tools help reduce the scope of a test by enabling you to test
a view without worrying about dependent tables and views. Limiting the scope of a test also helps to reduces
the amount of data which needs to be prepared for the test.
Dedicated roles enable developers to access and use the tools provided with the SAP HANA XS test
framework (XSUnit).
To grant access to the SAP HANA XS test framework that enables developers to set up automatic testing for
SAP HANA applications, the SAP HANA system admininstrator must ensure that the appropriate roles are
assigned. The following table lists the roles that are available; one (or more) of the listed roles must be
assigned to the application developers who want to use the XSUnit testing tools.
sap.hana.testtools.common::TestExe Enables you to view the persisted test results produced by the XSUnit test frame
cute work and to execute the examples included in the demonstration package
(sap.hana.testtools.demo).
sap.hana.xs.ide.roles::Developer Enables you to view source files in the SAP HANA Web-based Work Bench (Web
IDE)
Use the XSUnit tools to set up automated testing of your applications in SAP HANA XS.
Prerequisites
The following prerequisites apply if you are using SAP HANA studio to set up and run tests with XSUnit:
If you want to develop content that is designed to run specifically with SAP HANA, you can use the XSUnit
tools that are integrated in SAP HANA XS. The XS Unit tools are based on a Java Script unit test framework
that uses Jasmine as the underlying test library.
Procedure
To create a shared Eclipse project, start SAP HANA studio and, in the SAP HANA Development
perspective, perform the following steps:
a. In the Systems view, add the SAP HANA system you want to work and test on.
b. In the Repositories view, add a repository workspace for your SAP HANA system
c. Create and share a project of type XS Project.
Tip
You can also checkout and import an exisiting project from the SAP HANA Repository.
You can use the file-creation Wizard in SAP HANA studio, for example, File New Other SAP
HANA Development XS JavaScript Library File
b. Add the following content to the new XSlibrary test file <MyFirstTest>.xsjslib.
Note
You can extend the list of globally available functions to include any additional functions that you
use in your test.
You execute an XSUnit test by entering the following URL in a Web Browser:
http://<hostname>:<port>/sap/hana/testtools/unit/jasminexs/TestRunner.xsjs?
package=<packageName>
Where <hostname> is the name of the SAP HANA system where you are running your application test,
and <port> is the port number that the SAP HANA instance is available on.
The TestRunner tool recursively searches the package <packageName> for any files with the
suffix .xsjslib whose names match the pattern “*Test”.
Note
If you want to search for a string other than “*Test”, you must pass a custom pattern to TestRunner
using the parameter pattern.
Related Information
The XSUnit test framework is a custom version of the JavaScript test framework Jasmine adapted to suit SAP
HANA XS.
A test specifications begin with a call to the global Jasmine function describe. The describe functions
define suites that enable you to group together related test suites and specifications. Test-suite specifications
/*jslint undef:true */
describe('testSuiteDescription', function() {
beforeOnce(function() {
// beforeOnce function is called once for all specifications
});
beforeEach(function() {
// beforeEach function is called before each specification
});
it('testSpecDescription', function() {
expect(1).toEqual(1);
});
it('anotherTestSpecDescription', function() {
expect(1).not.toEqual(0);
});
});
To enable a test suite to remove any duplicate setup and teardown code, Jasmine provides the global
functions beforeEach and afterEach. As the name implies the beforeEach function is executed before
each specification in the enclosing suite and all sub-suites; the afterEach function is called after each
specification. Similarly, the special methods beforeOnce and afterOnce are called once per test suite.
● beforeOnce
Executed once before all specifications of the test suite
● afterOnce
Executed once after all specifications of the test suite
The XSUnit framework provides a managed database connection called jasmine.dbConnection, which is
globally available. You can use it in the following scenarios:
One obvious advantage of this is that you no longer have to pass the database connection as a parameter or
define it as a global variable. The jasmine.dbConnection is opened automatically and rolled back (and
closed). However, if you want to persist your data, you have to commit() jasmine.dbConnection
manually.
Example syntax for the functions, assertions, and parameters required by the SAP HANA XSUnit test tools.
The following code example lists the most commonly used functions and assertions used in the XSUnit
syntax.For more information about the assertions used, for example, toBe, toBeTruthy, or toBeFalsy, see
Assertions.
The following code example lists the most commonly used assertions, shows the required syntax, and the
expected parameters.
expect(actual).toBe(expected);
expect(actual).toBeFalsy();
expect(actual).toBeTruthy()
expect(actual).toEqual(expected);
expect(actualArray).toContain(expectedItem);
expect(actual).toBeNull();
expect(actualNumber).toBeCloseTo(expectedNumber, precision);
expect(actual).toBeDefined();
expect(actual).toBeUndefined();
expect(actualString).toMatch(regExpression);
expect(actualFunction).toThrowError(expectedErrorMessage);
expect(actualFunction).toThrowError(expectedErrorType, expectedErrorMessage);
expect(actualTableDataSet).toMatchData(expected, keyFields);
expect(actual).toBeLessThan(expected);
expect(actual).toBeGreaterThan(expected);
The XSUnit tool suite includes a generic tool that you can use to run tests.
You can start the XSUnit test-running tool (TestRunner.xsjs) by entering the following URL in a Web
Browser:
http://<hostname>:80<HANAinstancenumber>/sap/hana/testtools/unit/jasminexs/
TestRunner.xsjs?<parameters>
The following table lists the parameters that you can use to control the behavior of test-runner tool. If you
execute the test runner without specifying the pattern parameter, only the tests in *Test.xsjslib files are
discovered (and run) within the package hierarchy.
Note
You can specifiy mutliple parameters by separating each parameter=value pair with the ampersand
character (&), for example:coverage=true&exclude=sap.hana.tests
package yes Package that acts as starting point for discovering the tests. If not otherwise
specified by parameter “pattern” all .xsjslib files in this package and its sub-pack
ages conforming to the naming pattern “*Test” will be assumed to contain tests
and will be executed.
package=sap.hana.testtools.demo
pattern no Naming pattern that identifies the .xsjslib files that contain the tests. If not speci
fied, the pattern “*Test” is applied. You can use question mark (?) and asterisk
(*) as wildcards to match a single or multiple arbitrary characters, respectively.
To match all “Suite.xsjslib” files, use the following code:
pattern=Suite
format no Specifies the output format the test runner uses to report test results. By default,
the results will be reported as HTML document. This parameter has no effect if a
custom reporter is provided via parameter “reporter”. To display outputs results
using the JSON format, use the following code:
format=json
reporter no Complete path to module that provides an implementation of the Jasmine re
porter interface. With this parameter a custom reporter can be passed to publish
the test results in an application specific format . To specify the reporter inter
face, use the following code:
reporter=sap.hana.testtools.unit.jasminexs.reporter.db
.dbReporter
Note
format=db produces the same result
tags no Comma-separated list of tags which is used to define the tests to be executed.
tags=integration,long_running
profile no Name of a "profile" defined in the test which filters the tests to be executed on
the basis of tags.
profile=end2end
coverage no Activate code coverage measurement for all server-side (XS) JavaScript code
that is executed by the tests or which is in the scope of a specified package.
coverage=true
coverage=sap.hana.testtools.mockstar
coverage=true&exclude=sap.hana.testtools.mockstar.test
s
XSUnit includes a selection of test packages that demonstrate the scope of tests you can perform on an SAP
HANA XS application.
The following table lists the test packages included in the XSUnit test framework. The table also indicates the
name of the test file and provides a quick overview of the scope of the test.
Note
If you want to have a look at the code in the tests, checkout the package sap.hana.testtools.demo as
an XS project to your local workspace.
To write self-contained unit tests that are executable in any system, it is essential to be able to test the
selected SAP HANA objects in isolation. For a typical unit test using the XSUnit tools, you need to be able to
change any direct dependencies between the tested objects and other views or tables with references to
simple tables. For integration tests, rather than change the direct dependencies to a view or a table, you might
need to change dependencies between the dependent views (deeper in the dependency hierarchy).
Mockstar is a tool that is specifically designed to enable you to isolate test objects, for example, a view or
procedure. Mockstar allows you to create a copy of the tested view or procedure and substitute the
dependency to a another view or table with a table that is stored in a test schema. It is strongly recommended
to use a dedicated schema for the tests; in this test schema, you have write permissions and, as a result, full
control over the data in the tables and views.
● Creates a copy of the SAP HANA object to test (for example, a view or database table); the copied object
retains the same business logic as the original one object, but replaces some or all dependencies.
● Replaces the (static) dependencies to tables or views with temporary tables
● Supports deep dependency substitution
Mockstar can determine dependencies deep within a hierarchy of dependencies and copy only the
necessary parts of the hierarchy.
Mockstar tools are included in the delivery unit HANA_TEST_TOOLS, which you must install manually, for
example, using the SAP HANA studio or the SAP HANA Application Lifecycle Management tool. After the
installation completes, the Mockstar tools are available in the package sap.hana.testtools.mockstar.
Note
Importing a delivery unit into an SAP HANA system requires the REPO.IMPORT privilege, which is normally
granted only to the system administrator.
A basic example of the syntax required to set up the Mockstar test environment.
Note
The names of schemas, tables, and views used in the following code example are intended to be for
illustration purposes only.
The Mockstar test-isolation tools write helpful information in the SAP HANA trace files. You can adapt the
trace level, for example, to debug to ensure the right amount and type of information is written during the test
run. Note that you need the corresponding administration role to be able to change the trace-level settings in
SAP HANA. The trace files are written in the trace component xsa:sap.hana.testtools (truncated to
“xsa:sap.hana.tes” in the trace files).
Tip
As an alternative to reading the trace files directly, you can also use the SQL console to select data from the
table M_MERGED_TRACES.
This section contains information about the problems that developers frequently encounter during test runs:
The JavaScript library you want to test can only be loaded when there is an application descriptor (.xsapp
file) defined within the package hierarchy. The application descriptor is the core file that you use to describe an
The following error message is displayed when testing access to an OData service in SAP HANA XS:
If you encounter problems concerning duplicate entries when running tests, try the following solutions:
1. When inserting records into a productive table, ensure that no jasmine.dbConnection.commit() call
occurs during test execution.
2. When inserting records into a test table, ensure that the table entries are deleted (dropped) before they
are (re)created.
You encounter an error message that explains that a test table cannot be created during the test because the
table already exists. You must ensure that the specified table is deleted before the test tries to create it during
the test run.
the name of the model is too long (inlcuding the package name). You can reduce the name by setting the
TruncOptions option as shown in the following code snippet:
Tip
Its a good idea to analyze the created model before it is activated.
To generate a detailed and structured error log, in the SAP HANA Systems view in the SAP HANA studio and
locate the test package and activate it manually.
To test whether a test inserts data as expected into the created test table, implement a
jasmine.dbConnection.commit( ) connection to ensure that the data created during the test is stored
The detault timeout setting for the TestRunner tool is ten (10) minutes. If your test run for longer than ten
minutes and cause a timeout, try splitting the test into smaller and shorter elements. If this is no possible, try
running the test in three phases:
This error sometimes occurs if you try to create a copy of the original view and replace some dependencies
with test tables. The reason for the error is one of the following:
● You did not provide any dependency substitutions. For example, you passed an empty array as the third
parameter of mockstar.createTestModel()).
● The view that you want to test does not depend on any of the original views specified in the dependency
substitutions.
● For active schema mapping, you have written the dependencies with the physical schema whereas the
view refers to the authoring schema. Provide the schema in the same way as it is written in the view (or
stored procedure).
The XSUnit test framework provides a new “managed” database connection called jasmine.dbConnection,
which is automatically opened and rolled back (and closed) after each test completes. You can use it in
beforeEach or afterEach functions, in other functions defined in your test libraries, or even in imported
libraries, in the event that you have moved test code into external libraries.
Related Information
As the XSUnit test tools are based on a custom version of the JavaScript test framework Jasmine, you can use
XSUnit to test JavaScript. XSUnit provides tools that enable you to create and install a test “double” for one or
more object methods. In the Jasmine framework, a test double is known as a “spy”. A spy can be used not only
to stub any function but also to track calls to it and all arguments, too.
Note
XSUnit includes special matchers that enable interaction with Jasmine spies.
The XSUnit test tools delivery unit (DU) includes a small XS JavaScript demo “Ratings” application which
comprises an SAPUI5 client frontend on top of OData and XS JavaScript services; the Ratings application
enables you to experiment with different test techniques. You can try out the application at the following URL:
http://<SAPHANA_host>:80<instancenumber>/sap/hana/testtools/demo/apps/rating/
WebContent/
The following code example provides a quick overview of commonly used commands that enable the use of
Jasmine Spies. You can see how to perform the following actions:
The following code example shows how install a method double (simple example).
spyOn(object, "method");
expect(object.method).toHaveBeenCalled();
The following code example shows how install a method double (variant).
The following code example shows how install a method double (custom action for double).
The following code example shows how to check whether the function has been called as expected, and if so, if
the the right values were used.
expect(spyObject.method).toHaveBeenCalled();
expect(spyObject.method).toHaveBeenCalledWith(expArgValue1, expArgValue2);
expect(spyObject.method.calls.allArgs()).toContain([ expArgValue1,
expArgValue2 ]);
expect(spyObject.method.calls.mostRecent().args).toEqual([ expArgVal1,
expArgVal2 ]);
expect(spyObject.method.calls.count()).toBe(2);
spyObject.method.calls.reset(); // reset all calls
XS JavaScript files that can be accessed by performing an HTTP call against the service defined in the XS
JavaScript file.
You can use the TestRunner tool to call an XS JavaScript service. The TestRunner service is part of the test-
tools package sap.hana.testtools.unit.jasminexs and has one mandatory parameter, namely
package. Since TestRunner is an HTTP GET service, you can execute the service in the browser using the
following URL:
http://<hostname>:80<instancenumber>/sap/hana/testtools/unit/jasminexs/
TestRunner.xsjs?package=<mypackage>
Since it is not possible to import XS Javascript files (.xsjs) files into a JavaScript library (.xsjslib), the
functions you implement inside the XS JavaScript file cannot be tested within an XSUnit test. As a
consequence, it is recommended to include only minimal logic within the XSJS files and delegate tasks to the
functions implemented in corresponsding JavaScript libraries; these libraries can be tested in isolation using
XSUnit tools (for example, Mockstar).
Note
XSUnit enables you to perform an HTTP call to your XSJS services via HTTP. However, this is an end-to-end
system test with no possibility to use test doubles during the test. These tests are not suitable for testing a
JavaScript function.
Since you cannot insert test data into the test table during the test, the tests have no control over the data.
This restriction reduces the scope of the tests you can perform for HTTP calls, for example, you can test the
following scenarios:
To ensure access to SAP HANA, you need to adapt the default HTTP destination file
(:localhost.xshttpdest) provided with the XSUnit test tools. The default HTTP destinatinon configuration
file is located in sap.hana.testtools.unit.jasminexs.lib:localhost.xshttpdest to fit to your
HANA instance. To access an HTTP destination configuration, you need the permissions granted in the user
role sap.hana.xs.admin.roles::HTTPDestAdministrator.
Caution
To change the HTTP destination, create an HTTP extension" of your own; do not make any changes to the
file localhost.xshttpdest. Changes to localhost.xshttpdest are overwritten by updates to the
XSUnit test tools on your system.
Use XSUnit tools to test JavaScript code that depends on functions in your code, for example: dependencies
on functions, libraries, or to database tables.
In JavaScript it is possible to overwrite anything that is visible in a context, for example: public data, public
functions, or even the whole class. With XSUnit, you can make use of a simulation framework that is included
with Jasmine. The simulation framework provides a mechanism that enables you to create and install a test
double (so-called Jasmine “Spy”), which can help you to reduce some of the basic code and keep the code
more concise. Jasmine Spies should be created in the test setup, before you define any expectations. The
Spies can then be checked, using the standard Jasmine expectation syntax. You can check if a Spy is called (or
not) and find out what (if any) parameters were used in the call. Spies are removed at the end of every test
specification.
Note
Each dependency increases the complexity of testing involved for a function or a component.
The Average Component Dependency (ACD) is the number of dependencies to other components, averaged
over all components; it indicates whether your system is loosely coupled. If you prefer to implement
JavaScript in an object-oriented way, you can apply dependency management aspects by following object-
oriented design principles (OOD).
The following code snippet defines a controller that you want to test; the controller depends on a Date object.
The accompanying code snippet shows how you can test this code.
The following code snippets shows an example of the test code you could run; the code uses a Jasmine Spy
ensures the dependencies on the Date object are replaced and tested as expected.
beforeEach(function() {
model = new DataModel();
controller = new Controller(model);
});
it('should set current date when data is modified (replace Date.now() using
jasmine spies)', function() {
spyOn(Date, 'now').and.returnValue(anyDate.getTime());
oController.updateModel({data : [1,2,3]});
It is important to try to avoid mixing business logic that is implemented in JavaScript with the data base
interaction. We recommend moving the database persistency logic into a dedicated persistency class, so that
just the business logic remains for testing. The goal of the test is to be able to test both normal and special
cases without interacting with the data base at all.
To unit test the persistency class, you can parameterize the schema and use a schema for testing, for
example, the user schema where you have all authorizations required to create, modify, and drop objects, and
cannot mess things up with the test. Last of all, you can offer a small set of integration tests, that just ensure
that the productive classes, the AnyService class, and the Persistency class, integrate well.
Note
For sake of conciseness, resource closing and error handling is missing from the following code example.
The following code snippets shows an example of the test code you could run to test the dependencies.
The following code snippet show how to use XSUnit to test a self-contained JavaScript function (mathlib); a
self-contained function has no dependencies to other JavaScript functions, database tables or session
parameters.
SAP HANA server software and tools can be used for several SAP HANA platform and options scenarios as
well as the respective capabilities used in these scenarios. The availability of these is based on the available
SAP HANA licenses and the SAP HANA landscape, including the type and version of the back-end systems the
SAP HANA administration and development tools are connected to. There are several types of licenses
available for SAP HANA. Depending on your SAP HANA installation license type, some of the features and
tools described in the SAP HANA platform documentation may only be available in the SAP HANA options and
capabilities, which may be released independently of an SAP HANA Platform Support Package Stack (SPS).
Although various features included in SAP HANA options and capabilities are cited in the SAP HANA platform
documentation, each SAP HANA edition governs the options and capabilities available. Based on this,
customers do not necessarily have the right to use features included in SAP HANA options and capabilities.
For customers to whom these license restrictions apply, the use of features included in SAP HANA options and
capabilities in a production system requires purchasing the corresponding software license(s) from SAP. The
documentation for the SAP HANA optional components is available in SAP Help Portal at http://
help.sap.com/hana_options. If you have additional questions about what your particular license provides, or
wish to discuss licensing features available in SAP HANA options, please contact your SAP account team
representative.
Coding Samples
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system
environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and
completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP
intentionally or by SAP's gross negligence.
Accessibility
The information contained in the SAP documentation represents SAP's current view of accessibility criteria as of the date of publication; it is in no way intended to be
a binding guideline on how to ensure accessibility of software products. SAP in particular disclaims any liability in relation to this document. This disclaimer, however,
does not apply in cases of wilful misconduct or gross negligence of SAP. Furthermore, this document does not result in any direct or indirect contractual obligations of
SAP.
Gender-Neutral Language
As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as
"sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun
does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible.
Internet Hyperlinks
The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does
not warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any
damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. All links are categorized for
transparency (see: http://help.sap.com/disclaimer).