Skip to Content
Author's profile photo Former Member

Website with HANA XSJS backend

Content delivery networks (CDN) for mobile and web applications 1) eliminates the hassles of hosting 2) performs faster in all cases 3) has zero maintenance needs. Below steps will help to create website  including analytics, fonts, scripts for dynamic forms and HANA backend for web application(s).

Create local website files (source files attached files.zip) and upload to CDN

From HCP verify DB and Enable Web Access on HDB

From XS Admin Tool /hana/xs/admin/ confirm Security and Authorization, X-Frame Options

From SAP HANA Web-based Development Workbench, navigate to Security to create user and update priviledges

From SAP HANA Web-based Development Workbench, navigate to Editor to Create HCP HANA project (right-click Content folder). Import logic.xsjs and logic2.xsjs files (source files attached respectively)

From SAP HANA Web-based Development Workbench, navigate to Catalog to Create HCP table ZFI_HEADER and data (for illustration only, consider CDS)

Test connectivity and results

<!DOCTYPE HTML> 
<html>
<link rel="stylesheet" href="css/css.css" />
<!–– Insert Analytics here -->

<head>
<!–– Insert Analytics here -->
<zh1>Heading</zh1>
</head>

<body>
<zh2>HANA XSJS application 2  --- Go to <a href="index.html">first page</a></zh2>
<!–– Begin HANA XSJS call -->
<iframe width="560" height="50" frameBorder="0" src="https://<insertHCPhere>/actuals/logic2.xsjs"></iframe>
</body>

<div class="footer">
 <div><a href="#top"> Back to top </a></div>
 
</div>
</html>


<!DOCTYPE HTML> 
<html>
<link rel="stylesheet" href="css/css.css" />
<!–– Insert Analytics here -->
<head>
<!–– Insert Analytics here -->
<zh1>Heading</zh1>
</head>

<body>
<zh2>HANA XSJS application    --- Go to <a href="page2.html">second page for app 2</a></zh2>
<!–– Begin HANA XSJS call -->
<iframe width="560" height="50" frameBorder="0" src="https://<insertHCPhere>/actuals/logic.xsjs"></iframe>
</body>

<div class="footer">
 <div><a href="#top"> Back to top </a></div>
 
</div>
</html>
head, body
{
width: 100%
}

zh1
{
text-align: Center;
font-family: Segoe UI, Tahoma, Arial, Sans-serif;
font-size: 14px; 
font-style: bold;
display: block
}

zh2
{
text-align: Left;
font-family: Segoe UI, Tahoma, Arial, Sans-serif;
font-size: 12px; 
display: block
}

.footer
{
text-align: center;
font-family: Verdana, Arial, Helvetica, Sans-serif;
font-size: 10px; 
}
create column table actuals.zfi_header (
System 		nvarchar(3)  not null,
Client 		nvarchar(3)  not null,
Bukrs    	nvarchar(4)  not null,
Belnr   	nvarchar(10) not null,
Gjahr           nvarchar(4)  not null,
blart           nvarchar(2)  not null,
budat           nvarchar(10) not null,
aedat           nvarchar(10) not null,
usnam           nvarchar(12) not null,
bktxt		nvarchar(25) not null,
PRIMARY KEY
(
System,
Client,
Bukrs,
Belnr,
Gjahr
)
); 


insert into actuals.zfi_header values ('HDB','100','1000','0900000001','2017','RE','01/29/2017','01/23/2017','TWITTER','Reference doc1');
insert into actuals.zfi_header values ('HDB','100','1000','0900000002','2017','RE','01/29/2017','01/23/2017','TWITTER','Reference doc2');
function getUsername(){
   var username =  $.session.getUsername();
   return username;
}
var result = "Hello World from User " + getUsername();
$.response.setBody(result);



function getRecords(){
var output = ""; 
var conn = $.db.getConnection();
var pstmt = conn.prepareStatement( "select count(*) from ACTUALS.ZFI_HEADER;" );
var rs = pstmt.executeQuery();

if (!rs.next()) {
    $.response.setBody( "Failed to retrieve data" );
    $.response.status =  $.net.http.INTERNAL_SERVER_ERROR;
} else {
    output = output + "from HANA data: " + rs.getString(1);
}
rs.close();
pstmt.close();
conn.close();
 return output;
}
var result = "Records " + getRecords();
$.response.setBody(result);

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.