Professional Documents
Culture Documents
.
The SAP HANA Developer Guide explains how to use the SAP HANA development tools to create
comprehensive analytical models and how to build applications with SAP HANA's programmatic interfaces
and integrated development environment, including the development of native code that runs inside SAP
HANA.
The guide is organized as follows:
SAP HANA architecture
Describes the basic capabilities and architecture of SAP HANA
SAP HANA developer information roadmap
A map to help people navigate the library of information currently available for SAP HANA developers from
different perspective, for example: by SAP HANA guide, by development scenario, or by development task
SAP HANA development scenarios
Describes the main developer scenarios for which you can use SAP HANA to develop applications
Getting Started
Demonstrates how to build a simple SAP HANA-based application, including how to use the SAP HANA
studio tools and work with the SAP HANA repository
Most of the remaining chapters explain how to develop various SAP HANA development objects that you can
include in your SAP HANA application.
Note
For the latest information about the availability of features for SAP HANA Extended Application Services
(SAP HANA XS) and related development tools, see SAP Note 1921675 .
Audience
This guide is aimed at people performing the following developer roles:
Database developers
Often a business/data analyst or database expert, the database developer is concerned with the definition
of the data model and schemas that will be used in SAP HANA, the specification and definition of tables,
views, primary keys, indexes, partitions and other aspects of the layout and inter-relationship of the data
in SAP HANA.
The database developer is also concerned with designing and defining authorization and access control,
through the specification of privileges, roles and users.
Application programmers
The programmer is concerned with building SAP HANA applications, which could take many forms but are
designed based on the model-view-controller architecture. Programmers develop the code for the
following component layers:
Views
Running inside a browser or on a mobile device
Controller
10
PUBLI C
(default/
other work
space)
Take
Over
Acti
vate
1 OBJ1 Inactive Inactive Inactive Not
Appli
cable
Al
lowed
If an object has multiple inactive
versions, and the object version in
Modeler is also inactive, for exam
ple, through delivery unit import
or another workspace in Project
Explorer, user can activate his
own inactive object. After activa
tion, the object is the scenario 2
as in the next row.
Note
If the logged-in user and the
user to whom the object be
longs are different, the activa
tion is not allowed. For exam
ple, if the object is inactive in
SYSTEM users workspace and
MB user opens the object, the
object opens in read-only
mode, and the activation is not
allowed.
2 OBJ1 Inactive Inactive Active Not
Al
lowed
Not
Al
lowed
If an object has multiple inactive
versions in the Project Explorer
and the object version in Modeler
is active, neither activation nor
take over option is enabled.
3 OBJ1 Inactive Active Active Al
lowed
Not
Al
lowed
If an object has single inactive ver
sion in the Project Explorer, and
the object version in Modeler is
active, only take over option is en
abled.
308
PUBLI C
</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("");
SAP HANA Developer Guide
Writing Server-Side JavaScript Code
PUBLI C
</ModulePrefs>
The Site Context API provides the following methods:
publish(key, value)
subscribe(callback)
unsubscribe(subscriptionID)
getContext(callback)
Related Information
Publish [page 567]
A method of the Site Context API that can be used by a widget to publish a message to other widgets.
Subscribe [page 568]
A method of the Site Context API that can be used by a widget for subscribing to messages published by
other widgets.
Unsubscribe [page 569]
A method of the Site Context API that can be used by a widget to remove an existing subscription.
GetContext [page 570]
A method of the Site Context API that can be used to retrieve the sapcontext object to which other widgets
publish their messages.
Enabling Communication Between Widgets [page 571]
You can enable widgets, running in the same application site, to pass data to each other so that their content
and behavior change dynamically according to this data.
566
PUBLI C
</ModulePrefs>
The GadgetPrefs API provides the following methods:
getPreference(key)
setPreference(key,value)
Related Information
GetPreference [page 573]
The GadgetPrefs API provides methods for retrieving persisted preferences of a widget.
572
PUBLI C
</ModulePrefs>
Parameters
Parameter Type Description
title String Title of a widget
Example
<script language ="JavaScript">
...
var newTitle="Hello World";
gadgets.window.setTitle(newTitle);
...
</script>
9.5.3.5 Embedding Widgets Without Iframes
You can embed a widget in a page so that it is rendered without an iframe.
By default, widgets are rendered in iframes. However, iframes impact performance and overall user
experience. This topic describes how to embed a widget in a page without an iframe.
The following widget specification XML causes the widget to be rendered in an iframe:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="My Widget">
<Require feature="sap-context"/>
<Require feature="gadgetprefs"/>
<Require feature="settitle"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<div id="content"></div>
<script type="text/javascript">
(function () {
gadgets.util.registerOnLoadHandler(function () {
// Register the full application path without domain and port
jQuery.sap.registerModulePath("content.applications", "content/
applications");
var myView = new sap.ui.view({viewName:
578
PUBLI C
648
PUBLI C