Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Use case:

Invoke xsjs application from html.

Most people may know about debugging an xsjs application using the hdbstudio.

Supposing, for some reason, the debug configuration is not able to connect to the correct session, there is an alternate way to debug the application.

HTML snippet - MyHTML.html:




          function onBody() {

          var aUrl = '../services/MyService.xsjs';


          url: aUrl,

          method: 'GET',

          dataType: 'json',

          success: this.onCompleteBody,

          error: this.onBodyError



          function onBodyError(myTxt){



          function onCompleteBody(myTxt){

              oModel.setData({ bData : myTxt });





<body  onLoad=onBody()>




================= End of MyHTML.html ================



var errtxt='';     // Empty string



errtxt += '1:';

SQL statement 1


errtxt += '2:';

SQL statement 2;



errtxt += 'n:';

SQL statement n;

$.response.contentType = 'application/json';
$.response.status = $.net.http.OK; 


  catch (err)


$.response.contentType = 'text/plain';
errtxt += ':Error : ' + err;
$.response.setBody(errtxt );
$.response.status = $.net.http.INTERNAL_SERVER_ERROR; 


---------  END of MyService.xsjs ---------------


Using chrome or firefox run the MyHTML.html in developer mode and debug it.

Set break point at

          function onBodyError(myTxt){

           >   alert(myTxt.statusText);   // break point at alert


If there is any error you can view the object myTxt contents and the myTxt.responseText will show the errtxt set in MyService.xsjs.

This will show on which SQL statement, the xsjs failed along with error code.

Hope this helps your debugging efforts.

1 Comment
Labels in this area