Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Validation Exit with XSJS

$
0
0

Hi,

 

I am trying to implement validation exit for create functionality using XSJS. I am referring to the development guide example as reference.


I created a .xsjslib file. In the guide there are couple of import statements:

$.import("sap.hana.democontent.epmSP6.services", "session");

var SESSIONINFO = $.sap.hana.democontent.epmSP6.services.session;

 

How can i get SESSIONINFO object in my case?

 

Below is my code:

$.import("sial.sapnext","session");

var SESSIONINFO = $.sial.sapnext.session;

 

function notesCreate(param){

 

  let after = param.afterTableName;

  let pStmt = param.connection.prepareStatement('select * from "'+after+'"');

 

  var Notes =  SESSIONINFO.recordSetToJSON(pStmt.executeQuery(), 'Details');

  pStmt.close();

 

  pStmt = param.connection.prepareStatemnt('select max("ID") from "notes.catalog::Notes"');

  var rs = pStmt.executeQuery();

  var id = 0;

  while(rs.next())

  {

  id = rs.getInt(1);

  }

  pStmt.close();

 

  for(var i=0;i<2;i++){

 

 

  if(i<1){

  pStmt = param.connection.prepareStatement('insert into "notes.catalog::Notes" values(?,?,?,?,?,?,?)');

  }else{

  pStmt = param.connection.prepareStatement('TRUNCATE TABLE "'+ after +'"');

  pStmt = executeUpdate();

  pStmt.close();

 

  pStmt=  param.connection.prepareStatement('insert into "'+after+'" values(?,?,?,?,?,?,?)');

 

  }

 

  pStmt.setInt(1,id);

  pStmt.setString(2,Notes.Details[0].Inbox);

  pStmt.setString(3,Notes.Details[0].Key);

  pStmt.setString(4,Notes.Details[0].Note);

  pStmt.setString(5,Notes.Details[0].Status);

  pStmt.setString(6,SESSION_USER);

  pStmt.setString(7,now());

  pStmt.executeUpdate();

 

  pStmt.close();

  }

  }

 

 

I am getting error on the first line of the function saying:

 

Multiple markers at this line

  - Unexpected 'let'.

  - Cannot read property "line" from

  undefined

 

Any idea how I can fix this issue? Is there some standard library that I need to import in my package / project?

 

Thanks,

Aamod.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>