In this blog, we would like to point out some of the highlights of the new features for developers who use the SAP HANA native application development capabilities in HANA 2.0 SPS 03. It should be noted that most of the major architectural changes in the development topic area were recently introduced in SAP HANA 1.0 SPS 11. This is when we first shipped the SAP HANA extended application services, advanced model (XSA), SAP HANA deployment infrastructure (HDI), and the SAP Web IDE for SAP HANA. If you are new to these topics in general, you might first want to review the what’s new details from SPS 11, SPS 12, HANA 2.0 SPS 0 and the openSAP courses on this topic.
https://blogs.sap.com/2015/12/08/sap-hana-sps-11-new-developer-features/
https://blogs.sap.com/2016/05/20/sap-hana-sps-12-new-developer-features/
https://blogs.sap.com/2016/12/01/sap-hana-2.0-sps-0-new-developer-features/
https://blogs.sap.com/2017/04/18/sap-hana-2.0-sps-01-new-developer-features/
https://open.sap.com/courses/hana5/
https://open.sap.com/courses/hana6/
We have also updated the exercises from the latest openSAP course to include a version that showcases how to build the same using HANA 2.0 SPS 03:
https://github.com/SAP/com.sap.openSAP.hana5.example/tree/hana2_sps03
Its also important to keep in mind that many of the new developer features are contained in the XSA runtime and/or the SAP Web IDE for SAP HANA. These two features of SAP HANA are updated and released with HANA 2.0 SPS 03, but actually are backwards compatible and can be updated independent of the HANA database. Therefore if want some or many of the features described in this blog, you can update the XSA Runtime and SAP Web IDE for SAP HANA to the latest version even if you don't also update the SAP HANA database backend version.
SAP HANA, express edition
On the subject of updating without disrupting your existing HANA database; we also have SAP HANA, express edition. This is can be a great way for an individual to get access to the latest HANA 2.0 SPS 03 without needing their business systems to be upgraded. SAP HANA, express edition is a free, personal copy of SAP HANA that runs on a local machine or in the cloud. For more details on the new features in SAP HANA, express edition 2.0 SPS 03, please refer to this blog by
rudi.leibbrandt :
https://blogs.sap.com/2018/04/13/sap-hana-express-edition-sps-03-ready-to-download/
Database Development
In order to keep this blog from being too large,
rich.heilman posted about the database development features in a separate blog here:
https://blogs.sap.com/2018/04/11/sap-hana-2.0-sps-03-new-developer-features-database-development/
SAP HANA Extended Application Services, Advanced Model
One of the biggest changes to the SAP HANA architecture was the introduction of XS advanced in HANA 1.0 SPS 11. SAP HANA extended application services in SPS 11 represents an evolution of the application server architecture building upon the previous strengths while expanding the technical scope. While I don’t want to repeat all the architectural features which came with XS advanced in SPS 11, you can review them in this blog:
SAP HANA SPS 11: New Developer Features; XS Advanced
With HANA 2.0 SPS 03 we continue to round out the general feature set of XS Advanced; particularly focusing on supportability and every day operations of the environment.
A few of the various new and enhanced features are:
SAPUI5 Service Broker
The UI5 service provides resources to SAP UI5 applications which are needed to run their graphical user interfaces. In a typical XS advanced installation, one service is installed at any point in time and the service corresponds to an UI5 release. UI5 applications no longer need to refer to a particular UI5 service that they depend on; they can refer to the UI5 Service Broker, which serves the bootstrap URL of the service they require.
XSA Messaging Service (ActiveMQ)
The XSA Messaging Service is a new, central service broker based upon ActiveMQ which helps with the efficient communication between services and applications. For a general overview of this new service, I would point you to the online help description here:
https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/03007855703e4ba79ca534696e...
The important thing to know about this new messaging service is that like the SAPUI5 Service Broker, it isn't installed automatically with the XSA Runtime. It has its own, separate MTAR that must be downloaded and installed. For instance you can find the XSA Messaging Service on the Support Launchpad, Software Downloads:
SAP HANA XS Advanced Cockpit
HANA 2.0 SPS 03 introduces a newly designed XSA Admin Cockpit which matches the interaction patterns and UI design of the SAP Cloud Platform Cockpit. The previous XSA Admin web-based tool is now deprecated and will be completed replaced by this new XSA Admin Cockpit moving forward. You will also find new features in this new tool like the ability to create and edit User Provided Services which are of particular interest to developers.
Node.js version 8.x
With HANA 2.0 SPS 03, we see the removal of Node.js 4.x as it is out of maintenance. However we also see the addition of Node.js 8.x. As with any major new release of Node.js, there are infrastructure and language improvements. For example Node.js 8.x comes with npm version 5 and the JavaScript engine (V8) version 6.1. In particular the new version of the JavaScript VM (known as TurboFan and Ignition) provides on average 20% faster performance when compared to typical Node.js version 6.x based applications. That's a pretty nice improvement that comes essentially "for free".
We also see a new utility function to promising existing functions or module exports. For example in the past if you wanted to add a promises interface you might write a small wrapper like this:
function readFilePromisified(filename) {
return new Promise((resolve, reject) => {
require("fs").readFile(filename, "utf8", (error, data) => {
if (error) {
reject(error);
} else {
resolve(data);
}
});
});
}
But now in Node.js version 8.x, you could accomplish the same with one call to this new util.promisfy:
const readFilePromisified = util.promisify(require("fs").readFile);
On the subject of promises, Node.js version 8.x also introduces the concept of Async/Await. Basically this a next generation option to both callbacks and promsies. It builds upon the concept of promises and further simplifies the syntax and avoids the nested and hard to read code of deeply embedded callbacks.
For example, here is a simple database query using only callbacks:
//Simple Database Select - In-line Callbacks
app.get("/example1", function(req, res) {
var client = req.db;
client.prepare(
"select SESSION_USER from \"DUMMY\" ",
function(err, statement) {
if (err) {
res.type("text/plain").status(500).send("ERROR: " + err.toString());
return;
}
statement.exec([],
function(err, results) {
if (err) {
res.type("text/plain").status(500).send("ERROR: " + err.toString());
return;
} else {
var result = JSON.stringify({
Objects: results
});
res.type("application/json").status(200).send(result);
}
});
});
});
Notice how all the embedded callbacks makes the code rather difficult for a human to both read and write.
In Node.js version 6.x, we had the option of using promises and avoid some of this nesting of callbacks:
//Simple Database Select Promises
app.get("/promisesDB1", function(req, res) {
let db = new promisedDB(req.db);
db.preparePromisified("select SESSION_USER from \"DUMMY\"")
.then(statement => {
db.statementExecPromisified(statement, [])
.then(results => {
let result = JSON.stringify({
Objects: results
});
res.type("application/json").status(200).send(result);
})
.catch(err => {
res.type("text/plain").status(500).send(`ERROR: ${err.toString()}`);
return;
});
})
.catch(err => {
res.type("text/plain").status(500).send(`ERROR: ${err.toString()}`);
return;
});
});
We still have a few layers of nesting, but now we can simplify the flow of error catching. The then-based flow is more readable than embedded callbacks, but it could be even more readable. That's where async/await comes in.
//Simple Database Select Await
app.get("/awaitDB1", async(req, res) => {
try {
let db = new promisedDB(req.db);
const statement = await db.preparePromisified("select SESSION_USER from \"DUMMY\"");
const results = await db.statementExecPromisified(statement, []);
let result = JSON.stringify({
Objects: results
});
return res.type("application/json").status(200).send(result);
} catch (e) {
return res.type("text/plain").status(500).send(`ERROR: ${e.toString()}`);
}
});
This streamlines the code and allows you to write/read the code in the manner a human would expect even if it is still executed via events. The await keyword simply tells the code to wait until the completion of his command before moving onto the next. You also notice that we have a single try catch block for all the events. This avoids all the redundant error processing within each callback level we saw in the previous examples.
XSA and Python
With HANA 2.0 SPS 03 Python moves from BYOL/R (Bring Your Own Language/Runtime) to fully supported runtime in XSA. However the situation with Python is still a little different than using Node.js or Java.
XS advanced now supports the Python run-time environment with a new build pack and supporting libraries.
This does NOT include the runtime. Customers must still download, compile and install a Python runtime at the server OS level. There is also no integration of Python within the SAP Web IDE for SAP HANA. The setup steps to compile and install your own Python runtime can be found here:
https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/681f48593a1a46e595f8bfde1c.... Likewise information about the new Python libraries can be found here:
https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/842824f04d654ceeaf5168da66...
XS Command Line Tool
The XS command line tool has long been the main tooling for administration and some developer task at the lower level. It predates the introduction of any web-based administration tooling. However its had a few gaps such as role collection maintenance and tenant mapping that could only be done via the web-based admin UI. With HANA 2.0 SPS 03, we remove that gap by adding a whole new set of xs commands:
XSA Command Tool
Although not techncially new in HANA 2.0 SPS 03, I think this is a good time to also talk about the XSA command. This is not to be confused with the XS command line tool. The XSA command is a command installed on the Linux OS of the XSA Runtime itself. It provides very low level and powerful operations on the XSA Runtime. Originally this command was primarily used to stop and start XSA independent of the HANA DB. However in HANA 2.0 SPS 03, we started expanding its features to also include some important troubleshooting capabilities.
From the Linux console as your HANA SID admin user, you can issue the XSA command (all caps - because of course Linux is case sensitive).
I really like the new XSA diagnose command. It runs configuration and performance testing on your XSA Runtime. It can help troubleshoot common problems such as slow performing file systems which greatly impact XSA operations.
In particular the details on the file system throughput is important to developers. This greatly impacts the time for builds/runs in the SAP Web IDE for SAP HANA while we are developing:
Sizing XSA
With HANA 2.0 SPS 03, we've also expanded the sizing options of XSA. In HANA 2.0 SPS 02 we first introduced the t-shirt based sizing configuration. Now in HANA 2.0 SPS 03, we allow separate sizing for platform vs. application usage. This is detailed in this help article:
https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/2.0.03/en-US/7a49aa852c0c4ed089a58a840f...
And in this service note:
https://launchpad.support.sap.com/#/notes/2618752
We've also published a sizing note specific to the usage of the SAP Web IDE for SAP HANA:
https://launchpad.support.sap.com/#/notes/2624901
SAP Web IDE for SAP HANA
SAP Web IDE for SAP HANA provides a comprehensive web-based end-to-end development experience for creating SAP HANA native applications:
- Development of SAP HANA content and models
- UI development with SAPUI5
- Node.js, XSJS, or Java business code and service enablement
- Git integration
Therefore it provides a complete workflow for all of your new HANA Deployment Infrastructure (HDI) and XS advanced model (XSA) based development.
SAP Web IDE for SAP HANA comprises capabilities of SAP HANA Studio and SAP HANA Web-based Development Workbench. It represents the long term replacement tool for both of these previous offerings. It consolidates technologies, follows industry trends, and leverages industry standards where possible, while retaining a competitive innovation focus of SAP’s current offering.
With SAP HANA 2.0 SPS 3, we continue to enhance and expand the capabilities of the SAP Web IDE for SAP HANA and close the few remain feature gaps compared to the old HANA studio. We are also focused on increased productivity in typical day to day activities.
Automatic Service Creation (a.k.a. Service Provisioning) in SAP Web IDE
This new feature of the SAP Web IDE for SAP HANA was already detailed here in another blog by
uri.nizan:
https://blogs.sap.com/2018/05/16/automatic-service-creation-a.k.a.-service-provisioning-in-sap-web-i...
Improved Git Integration
The SAP Web IDE for SAP HANA in HANA 2.0 SPS 03 features Git file level comparison display and cherry picking, tagging, reverting and check out options.
Annotation Modeler
The Annotation Modeler is a new tool in the SAP Web IDE for SAP HANA to help building annotation XML files for use in Fiori Elements based applications. It is essentially the same tool which is already available in the SAP Web IDE on SAP Cloud Platform. It can be used within modules created via the List Report Module or SAP Fiori Master/Detail Module wizards.
External HANA Service Wizard
This is a new wizard that helps with the creation of development artifacts commonly needed for the use of HDI containers or schemas outside of our project. It supports both HDI and schema sources. It creates or updates the User Provided Services for us. It also adjusts the mta.yaml automatically.