I am new to SAP HANA and trying to expose the .xsjs file data through the webbrowser with the following url:
hostname:80<instance#>/workspace/session/a00/data/services/retrieveData.xsjs
However, I am getting the following error when I try to access it:
This link seems to be broken We could not find the resource you're trying to access. It might be misspelled or currently unavailable
These are the files which I have created in the project explorer:
MYSCHEMA.hdbschema
schema_name="MYSCHEMA"
trendsData.hdbtable
table.schemaName = "MYSCHEMA";
table.tableType = COLUMNSTORE;
table.description = "NewDataSet Order trendsData";
table.columns = [
{name= "C"; sqlType = NVARCHAR; nullable = true; length=10; },
{name= "D"; sqlType = VARCHAR; nullable = true; length=5; },
{name= "DU"; sqlType = NVARCHAR; nullable = true; length=20; },
{name= "SA"; sqlType = DECIMAL; nullable = true; length=30; },
{name= "I"; sqlType = DECIMAL; nullable = true; length=30; },
{name= "G"; sqlType = DECIMAL; nullable = true; length=30; },
{name= "G"; sqlType = DECIMAL; nullable = true; length=20; },
{name= "STR"; sqlType = DECIMAL; nullable = true; length=30; }
];
table.primaryKey.pkcolumns = ["INVENTORY"];
orderId.hdbsequence
schema="MYSCHEMA";
start_with=2000000;
cycles=false;
depends_on_table="workspace.session.a00.data::trendData";
retrieveData.xsjs
$.response.contentType="text/html";
var output = "Helloworld";
var conn = $.db.getConnection();
var pstmt = conn.prepareStatement("select * from trendData");
var rs = pstmt.executeQuery();
if (!rs.next())
{
$.response.setBody( "Failed to retrieve data");
$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
}
else
{
output=output + "This is the respose from my SQL: "
+ rs.getString(1);
}
rs.close();
pstmt.close();
conn.close();
$.response.setBody(output);
All the above files were succesfully committed and activated with out any error. Still, the error occurs in the webrowser.
Are you sure that the URL you've typed in the browser is properly built?
URL's should be built in the following way:
A wrong path may be causing your problem. Please see example below:
host: hanacloud
port: 8000 (80 + instance_number)
SAP HANA Repository tree:
mdo ->
sap ->
sflight ->
test ->
test.xsjs
URL: hanacloud:8000/mdo/sap/sflight/test/test.xsjs