With SAP HANA SP5*, we introduce an exciting new capability called SAP HANA Extended Application Services (sometimes referred to unofficially as XS or XS Engine). The core concept of SAP HANA Extended Application Services is to embed a full featured application server, web server, and development environment within the SAP HANA appliance itself. However this isn’t just another piece of software installed on the same hardware as SAP HANA; instead SAP has decided to truly integrate this new application services functionality directly into the deepest parts of the SAP HANA database itself, giving it an opportunity for performance and access to SAP HANA differentiating features that no other application server has.

Before SAP HANA SP5 if you wanted to build a lightweight web page or REST Service which consumes SAP HANA data or logic, you would need another application server in your system landscape. For example, you might use SAP NetWeaver ABAP or SAP NetWeaver Java to connect to your SAP HANA system via a network connection and use ADBC (ABAP Database Connectivity) or JDBC (Java Database Connectivity) to pass SQL Statements to SAP HANA.  Because of SAP HANA’s openness, you might also use Dot Net or any number of other environments or languages which support ODBC (Open Database Connectivity) as well. These scenarios are all still perfectly valid.  In particular when you are extending an existing application with new SAP HANA functionality, these approaches are very appealing because you easily and with little disruption integrate this SAP HANA functionality into your current architecture.

However when you are building a new application from scratch which is SAP HANA specific, it makes sense to consider the option of the SAP HANA Extended Application Services.  With SAP HANA Extended Application Services you can build and deploy your application completely self-contained within SAP HANA; providing an opportunity for a lower cost of development and ownership as well as performance advantages because of the closeness of the application and control flow logic to the database. 

Applications designed specifically to leverage the power of SAP HANA, often are built in such a way to push as much of the logic down into the database as possible.  It makes sense to place all of your data intensive logic into SQL, SQLScript Procedures, and SAP HANA Views, as these techniques will leverage SAP HANA’s in-memory, columnar table optimizations as well as massively parallel processing. For the end-user experience, we are increasingly targeting HTML5 and mobile based applications where the complete UI logic is executed on the client side. Therefore we need an application server in the middle that is significantly smaller than the traditional application server. This application server only needs to provide some basic validation logic and service enablement. With the reduced scope of the application server, it further lends credit to the approach of a lightweight embedded approach like that of the SAP HANA Extended Application Services.

Paradigm_Shift.png

Figure 1 – Architectural Paradigm Shift

SAP HANA Studio Becomes a Development Workbench

In order to support developers in creating applications and services directly within this new SAP HANA Extended Application Services, SAP has enhanced the SAP HANA Studio to include all the necessary tools. SAP HANA Studio was already based upon Eclipse; therefore we were able to extend the Studio via an Eclipse Team Provider plug-in which sees the SAP HANA Repository as a remote source code repository similar to Git or Perforce. This way all the development resources (everything from HANA Views,  SQLScript Procedures, Roles, Server Side Logic, HTML and JavaScript content, etc.) can have their entire lifecycle managed with the SAP HANA Database.  These lifecycle management capabilities include versioning, language translation export/import, and software delivery/transport.

The SAP HANA Studio is extended with a new perspective called SAP HANA Development. As Figure 2 shows, this new perspective combines existing tools (like the Navigator view from the Modeler perspective) with standard Eclipse tools (such as the Project Explorer) and new tools specifically created for SAP HANA Extended Application Services development (for example, the Server Side JavaScript editor shown in the figure or the SAP HANA Repository browser). Because SAP HANA Studio is based on Eclipse, we can also integrate other Eclipse based tools into it. For example the SAP UI Development Toolkit for HTML5 (SAPUI5) is also delivered standard in SAP HANA Extended Application Services.  HANA 1.0 SP5 comes pre-loaded with the 1.8 version of the SAPUI5 runtime and the SAPUI5 development tools are integrated into SAP HANA Studio and managed by the SAP HANA Repository like all other XS based artifacts. Although the SAPUI5 development tools are integrated into SAP HANA Studio, they are not installed automatically.  For installation instructions, please see section 10.1 of the SAP HANA Developers Guide.

ServerSideJavaScriptEditor.png

Figure 2 – SAP HANA Development perspective of the SAP HANA Studio

These extensions to the SAP HANA Studio include developer productivity enhancing features such as project wizards (Figure 3), resource wizards, code completion and syntax highlighting for SAP HANA Extended Application Services server side APIs, integrated debuggers, and so much more.

NewProjectWizard.png

Figure 3- Project Wizards for XS Based Development

These features also include team management functionality.  All development work is done based upon standard Eclipse projects.  The project files are then stored within the SAP HANA Repository along with all the other resources. From the SAP HANA Repository browser view, team members can check out projects which have already been created and import them directly into their local Eclipse workspace (Figure 4).

After projects have been imported into the local Eclipse workspace, developers can work offline on them. You can also allow multiple developers to work on the same resources at the same time. Upon commit back to the SAP HANA Repository, any conflicts will be detected and a merge tool will support the developer with the task of integrating conflicts back into the Repository.

The SAP HANA Repository also supports the concept of active/inactive workspace objects.  This way a developer can safely commit their work back to the server and store it there without immediately overwriting the current runtime version.  It isn’t until the developer chooses to activate the Repository object, that the new runtime version is created.

RepositoryBrowserProjectImport.png

Figure 4 – Repository Import Project Wizard

For a deeper look at the basic project creation and Repository object management within SAP HANA Studio, please view the following videos on the topic.

OData Services

There are two main parts of the SAP HANA Extended Application Services programming model. The first is the ability to generate OData REST services from any existing SAP HANA Table or View.  The process is quite simple and easy.  From within an SAP HANA Project, create a file with the extension xsodata. Within this service definition document, the developer needs only to supply the name of the source table/view, an entity name, and, if using an SAP HANA View, the entity key fields.

For example, if you want to generate an OData service for an SAP HANA table named teched.epm.db/businessPartner in the Schema TECHEDEPM, this would be the XSODATA definition file you would create:

service namespace "sap.hana.democontent.epm" {
       "TECHEDEPM"."teched.epm.db/businessPartner" as "BUYER";
}

XSODATA_Service_Base.png

Figure 5 – XSODATA Service Definition and Test

Upon activation of this XSODATA file, we already have an executable service which is ready to test. The generated service supports standard OData parameters like $metadata for introspection (see Figure 6), $filter, $orderby, etc. It also supports body formats of ATOM/XML and JSON (Figure 7 for an example). Because OData is an open standard, you can read more about the URL parameters and other features at http://www.odata.org/.

XSODATA_Metadata.png

Figure 6 – OData $metadata support

XSODATA_Format_JSON.png

Figure 7 – Example OData Server JSON Output

The examples in the above figures demonstrate how easily these services can be tested from the web browser, but of course doesn’t represent how end users would interact with the services. Although you can use a variety of 3rd party tools based upon JavaScript, like Sencha, Sencha Touch, JQuery, JQuery Mobile, and PhoneGap, just to name a few; SAP delivers the UI Development Toolkit for HTML5 (SAPUI5) standard in SAP HANA Extended Application Services. A particularly strong feature of SAPUI5 is the integration of OData service consumption not just at a library level but also with special features within the UI elements for binding to OData services.

For example, within SAPUI5, you can declare an OData model object and connect this model object to the URL of the XSODATA service. Next, create a Table UI element and connect it to this model object. Finally you call bindRows of the Table UI element object and supply the OData entity name you want to use as the source of the table.

var oModel = new sap.ui.model.odata.ODataModel
 ("../../services/buyer.xsodata/", false);
oTable = new sap.ui.table.Table("test",{tableId: "tableID",
 visibleRowCount: 10});      
...
 oTable.setModel(oModel);
oTable.bindRows("/BUYER");

This creates an UI Element which has built-in events, such as sort, filter, and paging, which automatically call the corresponding OData Service to fulfill the event. No additional client side or server side programming is necessary to handle such events.

XSODATA_UI5.png

Figure 8 – OData Bound Table UI Element

For more details on OData service creation in SAP HANA Extended Application Services and utilizing these services within SAPUI5, please view these videos.

Server Side JavaScript

The XSODATA services are great because they provide a large amount of functionality with minimal amounts of development effort.  However there are a few limitations which come with such a framework approach.  For example in SAP HANA SP5, the OData service framework is read only.  Support for Insert, Update, and Delete operations is available with SAP HANA SP6.

Luckily there is an option for creating free-form services where you can not only perform update operations but also have full control over the body format and URL parameter definition. SAP HANA Extended Application Services also allows development on the server side using JavaScript (via project files with the extension XSJS).  Core APIs of SAP HANA Extended Application Services are, therefore, exposed as JavaScript functions; providing easy access to the HTTP Request and Response object as well database access to execute SQL or call SQLScript Procedures.

In this simple example, we can take two numbers as URL Request Parameters and multiply them together and then return the results as text in the Response Body.  This is an intentionally basic example so that you can focus on the API usage.

XSJS_SimpleExample.png

Figure 9 – Simple XSJS Service

However the power of XSJS services comes from the ability to access the database objects, but also have full control over the body output and to further manipulate the result set after selection. In this example, we use XSJS to create a text-tab delimited output in order to support a download to Excel from a user interface.

function downloadExcel(){
    var body = '';
    var query = 'SELECT TOP 25000 \"PurchaseOrderId\", \"PartnerId\", to_nvarchar(\"CompanyName\"), \"LoginName_1\", \"CreatedAt\", \"GrossAmount\" FROM \"_SYS_BIC\".\"teched.epm.db/PO_HEADER_EXTENDED\" order by \"PurchaseOrderId\"';    $.trace.debug(query);
    var conn = $.db.getConnection();
    var pstmt = conn.prepareStatement(query);
    var rs = pstmt.executeQuery();
    body =
"Purchase Order Id \tPartner Id \tCompany Name \tEmployee Responsible \tCreated At \tGross Amount \n";
   while(rs.next()) {
        body += rs.getString(1)+
"\t"+rs.getString(2)+"\t"+rs.getString(3)+"\t"+rs.getString(4)+"\t"+rs.getTimestamp(5)+"\t"+rs.getDecimal(6)+"\n";
    }    $.response.setBody(body);   
    $.response.contentType = 'application/vnd.ms-excel; charset=utf-16le';
    $.response.headers.set('Content-Disposition','attachment; filename=Excel.xls');
    $.response.headers.set('access-control-allow-origin','*');
    $.response.status = $.net.http.OK;
}

Closing

This blog hopefully has served to give you a small introduction to many of the new concepts and possibilities with SAP HANA SP5 and SAP HANA Extended Application Services.

Over the coming weeks, we will be posting additional blogs with more advanced examples and techniques as well how to integrate SAP HANA Extended Application Services content into additional environments. Likewise there is a substantial Developer’s Guide which expands on many of the concepts introduced here.

*It is also important to note that while SAP HANA Extended Application Services ships as productive software (meaning customers can go live in production with it) in SAP HANA SP5; it is a controlled release initially, with a special “Project Solution” program in place around this new functionality.  Please refer to Service Note 1779803, for additional details on the current status of the Project Solution. This Project Solution approach is designed to provide the highest levels of support possible to initial customers and partners who choose to develop using SAP HANA Extended Application Services. It also provides a channel for feedback to Product Management and development so that we take suggestions and ideas and quickly integrate them into future revisions of SAP HANA and SAP HANA Extended Application Services.

To report this post you need to login first.

184 Comments

You must be Logged on to comment or reply to a post.

  1. John Appleby

    Tom,

     

    I’m a huge XS fan – it’s the epitome of the simplification of IT and that’s what HANA is all about. No idea how you create so much content but this blog lays out exactly what people need to know about XS to get started. Great thing is if you know OData and JavaScript, it will come naturally to any programmer.

     

    John

    (0) 
  2. DJ Adams

    Hey Tom

     

    Further to John’s comments, I wanted to also say thanks for XS, OSDL and all the work you folks have put into this platform (and the ever-present help recently!)

     

    Really attracted to the simple monolithic stack but moreso to the inherent and implicit idea that one uses XS to expose DATA, not UI. Building the demo recently was a piece of cake – and we concentrated on using XSJS to provide simple services and OSDL (XSODATA) for data provision. And SAPUI5 providing the client side application framework and interface. Worked really nicely.

     

    Cheers

    dj

    (0) 
  3. Chandan Sinha

    I have always been a great fan of yours and a true follower. This blog comes as a rescue for me as I was thinking of integrating mobile apps with HANA in an easier way.

     

    Hope we get the CoE/Sandbox servers running on HANA SP5

     

    Please do keep enlightening us in this way. Great work Thomas

    (0) 
  4. Bjorn Vilhjalmsson

    Amazing blog – once again Thomas, thanks.  I wish more bloggers would have the same ambition and skills in blogging, the SAP world would be a lot easier to get into or master. 

    (0) 
  5. varada santosh

    Hi Thomas

     

      I am using 32 bit version of SAP HANA studio and trying to configure workspace under the SAP HANA Development perspective, but as the 32 bit version does not have regi.exe file I am not able to configure the workspace hence not able to proceed further .It seems SAP does not have any plans to provide regi.exe for 32 bit client .Request guidance for any other workaround as I would like to create oData channels using Studio and consume them in SAP UI5.

     

    Thanks

    Santosh Varada

    (0) 
    1. Thomas Jung Post author

      There is no workaround which I can provide.  REGI tool is critical to the development process and only currently supplied on 64-bit Linux and Windows. You must use one of these two operating systems and associated SAP HANA Studio/Client version in order to perform these development tasks.

      (0) 
      1. varada santosh

        Hi Thomas

         

            Thanks for  confirming on that, I have changed my OS to work with Extended Applocation Services,but would expect it would be released soon for 32 bit as well ,any idea regarding the time lines when it will be available for 32 bit version as well.

         

        Regards

        Santosh Varada

        (0) 
        1. Thomas Jung Post author

          There are no timelines for 32-bit version support. We are discussing alternatives for the future, but nothing definative has been decided yet.

          (0) 
          1. Simon Dale

            Hi, one possible workaround would be to run HANA studio on a free Amazon Web Services micro-instance, connecting back to your HANA system, or connecting to one on AWS itself.   We provide these to people who run a normal Mac so they can still develop their skills on HANA.   Easy to setup, drop me a line if you need the info.

            (0) 
  6. Lukasz Chomin

    Hi Thomas,

    I would like to follow your tutorial but I cannot get my HANA XS working.

    When I try to open http://myserver:8000 I don’t get any response.

    I checked all logs and traces and I don’t see any issues there.

    What can be checked more to see what’s wrong with my HANA XS service?

     

    Kind regards

    Lukasz Chomin

    (0) 
    1. Thomas Jung Post author

      Is this HANA system in the Cloud or on site?  In either case, do you know if port 8000 is reachable? Especially when running systems in the cloud you need to add new ports to the network profile to allow them to be reachable (my experience here is with Amazon – AWS). 

       

      Also, go into HANA Studio.  Go to the Administration tool for your system. From the Landscape tab in the Services; do you see an xsengine process?

       

      Are you sure your HANA system is system number 00?  The XS Engine port by defaul is 80XX where XX is your system number.  Are you sure someone hasn’t manually changed the default port on your system? 

       

      What SPS/Revision level is your HANA Server?

      (0) 
      1. Lukasz Chomin

        Hi Thomas,

        Thanks for quick reply.

        This is on-site HANA system Rev.47. All services are green – also xsengine.

        I’ve checked now and the port is not reachable from a remote host but is reachable from the server console. So it seems that there is some firewall rule which blocks access to port 8000.

        I was almost sure there is no firewall enabled by default on Fujitsu appliance. Now I’ll have to check how it’s configured.

        Anyway, thanks for your help as it led me to the root of this issue.

         

        Best regards

        Lukasz Chomin

        (0) 
    1. Thomas Jung Post author

      The samples, the underlying demo model, and a data generator for that data model will be available soon. It will either ship in a future revision as non automatic content or we will make it available as a download on SCN. There are a few more days work needed to complete all the samples and then it takes sometime for the packaging and approval processes for shipping.

      (0) 
  7. Andreas Cardeneo

    Tom,

    have you managed to install  SAPUI5 Tools within HanaStudio? It seems that the dependencies on the Eclipse Faceted Project Framework do not match.

    Regards,

    Andreas

    (0) 
      1. Andreas Cardeneo

        Doing this within a freshly installed HanaStudio (rev. 48) yields the following message:

        —>

        Cannot complete the install because one or more required items could not be found.

          Software being installed: Language files for SAPUI5 Application Development 1.8.7 (com.sap.ide.ui5.app.feature.lang.feature.group 1.8.7)

          Missing requirement: Language files for SAPUI5 Application Development 1.8.7 (com.sap.ide.ui5.app.feature.lang.feature.group 1.8.7) requires ‘org.eclipse.jst.web_ui.feature.feature.group [3.1.0,4.0.0)’ but it could not be found

        <—-

        (0) 
  8. Fahad Ajaib

    Hi,

     

    I am facing a problem while using HANA XS. When I update a file (like HTML Page) from HANA Studio into HANA Repository and try to view this updated HTML page in browser, I can’t see the updated page infact the browser show me the old version of the page. I also tried after deleting the browser history but still no use. Also i noticed (from the file history) that inside HANA the file is not getting activated immedietly and take some time to activate like 1 hour and after activation I can see the latest version of the file. Please guide me in this regard, what to do so that I can see the updated version of a file immedietly.

     

    Thanks and best regards.

     

    Fahad

    (0) 
    1. Thomas Jung Post author

      The problem strongly sounds like
      a configuration setting in the Web Dispatcher.  We’ve changed the default
      value of this setting not to cache in newer system builds. However if you have
      a system which has existed for a while and been upgraded in place; the upgrade
      process, unfortunately, doesn’t update these settings.

       

      You will need to access the file
      system of your HANA appliance as the Web Dispatcher configuration is not yet
      exposed to the HANA Studio Admin tools. You will need to find the
      sapwebdisp.pfl file.  It should be in /usr/sap/<SID>/HDB<Instance
      Number>/<hostname>/wdisp/

       

      You should comment out any lines
      which contain icm/HTTP/server_cache

      (0) 
      1. Fahad Ajaib

        Hi Thomas Jung,

         

        Thanks a lot for your prompt reply. The problem has been solved after making the changes in Web Dispatcher Configuration.

         

        Best regards.

         

        fahad

        (0) 
  9. Elaine Gao

    Hi Thomas,

     

    I have encountered a problem when I bind the oData to UI use Chrome. my code is as below

     

    var sServiceUrl = “http://ldcinx1.wdf.sap.corp:8002/a1test/xstest/service/ccy.xsodata/“;

    var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, false, “I072391”, “******”);

     

               oCurTable.setModel(oModel);

              oCurTable.bindRows(“/CCY”);

     

    When I use IE9, it workds fine, but use Chrome, the table is empty and will encounter error

     

    Failed to load resource: the server responded with a status of 401 (Unauthorized)

     

    is not allowed by Access-Control-Allow-Origin.

     


    (0) 
    1. Thomas Jung Post author

      So I assume that your SAPUI5 is being served by a different host than XS/HANA.  You are getting a cross domain request.  The browser is trying to make a CORS preflight request, but this fails becuase preflight requests don’t use authentication and thefore fail with the 401. This is a known issue which we are currently working on.  Soon you will be able to specify in the .xsaccess that you want to support CORS and then this request will work. But this is a few revisions away from shipping as the developer is still working on this code.

       

      Until then you have a few possible workarounds.  First you could serve the SAPUI5 web page from the XS Engine as well. You won’t have the CORS request and you won’t need to specify the user name and password since the authentication of the page will automatically be reused. 

       

      Otherwise your only other option is to use XSJS instead of XSODATA and to setup the service as anonymous.  For any database access inside the XSJS you will need to setup a SQLCC connection. 

      (0) 
      1. Elaine Gao

        Hi Thomas,

        Thanks very much for your quick reply. I have tried another way like below (add proxy before http), fortunately, it can works OK with both IE9 and Chrome. 

        var sServiceUrl = “proxy/http/ldcinx1.wdf.sap.corp:8002/a1test/xstest/service/ccy.xsodata/“;

        var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, false, “I072391”, “******”);

                   oCurTable.setModel(oModel);

                  oCurTable.bindRows(“/CCY”);

        (0) 
        1. Aisha Mitha

          Hi,

          How did you add a proxy before before http? I am also facing the same problem. Your help would be appreciated.

          Does this proxy solution work for all CORS?

          Thanks in advance.

          (0) 
      2. Orel Stringa

        Hi Thomas,

        nice to see that SAP has made it possible with SP6 to specify cross origin resource sharing (CORS) support via the .xsaccess file. SP6 HANA development guide has example of how to specify CORS support.

        I have build an XS application and would like to serve SAPUI5 on a diff.host than XS/HANA.

        How can I specify that I would like to allow cross origin access restricted to certain domain(s) only ?

        Is there a special keyword / syntax for specifying that?

        Thank yoi.

        Orel

        (0) 
        1. Thomas Jung Post author

          This is currently not possible.  The CORS support is for all origins.  We don’t yet have the feature to maintain a whitelist of CORS origins.

          (0) 
  10. Fahad Ajaib

    Hi guys,

    I created a xsodata service like

    service namespace “sap.hana.sepm” {

              “_SYS_BIC”.”oss/AT_PRODUCTS” as “PRODUCTS” keys (“NODE_KEY”);

    }

    and now i am traying to search  a subtring (e.g. Notebook so that i can get records which start with this keyword like Notebook 15, Notebook ABC etc.)

    var sServiceUrl = “http://abc.int.def.poc:8000/zsb/services/products.xsodata?$filter=substringof('Notebook‘, TEXT) eq true”;

    but I am getting an error

    Query options $select, $expand, $filter, $orderby, $inlinecount, $skip and $top cannot be applied to the requested resource.

    Fahad

    (0) 
    1. Thomas Jung Post author

      You are applying the filter to the odata service itself.  The OData specification requires that you must supply a filter to an entity or collection.

      http://www.odata.org/documentation/uri-conventions#FilterSystemQueryOption

      Also I’m not usre if the substringof works for XSODATA.  I’ve always used indexof for such wildcard searches.  I didn’t get the simliar substringof syntax as you were using to work.

      /sap/hana/democontent/epm/services/poWorklist.xsodata/PO_WORKLIST?$skip=0&$top=100&$orderby=PurchaseOrderId,PurchaseOrderItem%20asc&$filter=(indexof(ProductId,’HT-10′)%20ge%200)&$inlinecount=allpages

      (0) 
      1. Fahad Ajaib

        Hi Thomas,

        Thanks for your reply, indexof is working fine and now I am getting the desired results, but I have one more small problem. If I want to search a word like “Notebook” in OData Service then I should write “Note”  because with “note” I can not search this word. I tried “filter=tolower” but it is not working

        oss1/services/products.xsodata/?$orderby=PRICE asc&$filter=(indexof(TEXT,'”+val+”‘) ge 0)&$filter=tolower

        Best regards.

        Fahad

        (0) 
  11. Puran Khoeval

    Hi Thomas,

    I am trying to expose the SPFLI table of schema SFLIGHT as XSODATA service. For this I have created UI application using SAP UI5 (Eclipse). When I run the application on Tomcat server in my local envirnoment I get the table template as output as in the blank table. I am suspecting it could be becuase of the cross domain origin issue.

    Now in order to overcome this I created same UI appication in HANA studio and the environment where HANA server is residing, and tried to consume the XSODATA service. Now when I run the application it is not at all launching the application. Error ” We could not find the resource you are trying to access”

    In HANA Studio my UI5 project is created under the package “uipackage”.

    URL–> http://<hanaserver&gt;:<port>/uipackage/Demo_Flight/

    When I am trying to launch the “Hello world” it is coming correctly, however the “Hello world” is not created as UI5 Project. I have checked the HANA XS is working. Please advise me what is that I am missing.

    Thanks,

    Puran K.

    (0) 
    1. Thomas Jung Post author

      > I am suspecting it could be becuase of the cross domain origin issue.

      I would be almost 100% certain that the cross domain is the source of the problem.  You really can’t test with a local web server because of cross domain issues until we have CORS support at the .xsaccess level (coming with SPS6).

      > Error ” We could not find the resource you are trying to access”

      You can’t launch the website from the Studio.  You have to type in the URL for the application manually in the browser.  Make sure you are putting in the full URL. In your sample you don’t have a WebContent folder in your path and SAPUI5 projects always generate this additional folder.

      (0) 
      1. Puran Khoeval

        Hi Thomas,

        Thanks a lot for your reply!!

        As you pointed out the problem was essentially with the way I was framming the URL and there are issues with the browser as well. I am getting only text piece in the IE9, table is not rendering at all.However I can see every thing properly in chrome!!

        Not sure what is the issue with IE, once again thanks alot for your guidance.

        Thanks,

        Puran Khoeval.

        (0) 
  12. Aisha Mitha

    Hey Thomas,

        Currently I am developing an application with odata and SAPUI5. While accessing the url in browser, it asks for username and password to access hana server. I would like to bypass this. Is there any way of doing this?

    (0) 
    1. Thomas Jung Post author

      XS supports basic authentication, forms based authentication, and SAP Single Sign On Tickets.  Both basic authentication and forms based authentication require the input of a username and password.  SAP Single Sign On tickets would allow you access with transparent SSO. XS doesn’t generate SSO Tickets, but only consumes them. Therefore this scenario only works when an XS application is embedded inside the NetWeaver Portal or NetWeaver Business Client.

      We do plan to add support for other forms of authentication in the future. For example SAML and x509 certificates are planned for SPS6.  Kerberos and OAuth are also both planned but probably not until SPS7.

      (0) 
    2. Witalij Rudnicki

      There is an option to disable authentication by putting

      { “authentication” : null }

      in .xsaccess file. I am not sure though what user is used then to authorize execution: the author of the code, or some special anonymous user.

      (0) 
      1. Thomas Jung Post author

        That’s true that you can have anonymous services and pages as well, although that certainly isn’t the same as SSO. When you set the service to anonymous it runs under a special anonymous user which has NO database access rights.  If you need to call the APIs to read from the database or repository you must setup a SQLCC entry and embed a user name and password in their which will be used by the anonymous service.  This lets the developer decide which user the anonymous service will actually run under.

        (0) 
        1. Aisha Mitha

          Hi Thomas,

               I currently would like to use anonymous user. But how do I go about setting up a SQLCC entry and embed a user name and password in their which will be used by the anonymous service. I would like end user to have anonymous authentication to hana server, but the final data that is retrieved is from an Odata service. Could you direct me as to how to go about the whole thing.

          (0) 
          1. Aisha Mitha

            Also, currently in SAP Hana the http method defined is GET, for POST method it displays 405 Method Not Allowed error. How to configure http to accept post method.

            (0) 
            1. Thomas Jung Post author

              In which development artifact?  The XSODATA object?  If so, only GET is currently supported as we only have Read-only operations.

              (0) 
              1. Aisha Mitha

                I am building an application with UI5. This appl has a form which on submit gets proceesed at another file. login.html -> verify.jsp -> On valid user calls xsodata.  The authentication at verify.jsp is done with an oracle databse.

                On submit of login.html,

                • post method in form tag : 405 error,method not allowed
                • and if I use get method, it downloads the file, verify.jsp

                How do I configure the Hana Application server to accept Post requests?

                (0) 
                1. Thomas Jung Post author

                  Did you also send me this same question via Email?  I received this exact same question via Email last night as well. 

                  Same response I gave in email:

                  Only get is supported because in REST services the HTTP Verb is
                  the action which is performed.  Therefore a POST would imply an update or
                  create operation which is not yet supported by the generic OData framework in
                  XS.  If you want, however, you can code your REST services and support any
                  verb you want using XSJS.

                  I can’t say I really understand why you need to POST in your
                  scenario. 

                  > If not possible,
                  then in GET method how to submit a form to the next page. As you can see, it
                  has transferred the document via MIME type and downloaded it. How to avoid this
                  download and simple submit to next page.

                  Why are you submitting to the service.  This is not
                  normally how REST services are used.  Why not call the service via AJAX?

                  (0) 
          2. Thomas Jung Post author

            >Could you direct me as to how to go about the whole thing.

            The process is fully documented in the HANA Developers’ Guide – Section 10.5

            (0) 
            1. Aisha Mitha

              hi,

              In the hana dev guide a basic overview of SQLCC is mentioned. Can you please guide me step by step as to how to configure for anonymous user(i.e authentication : null  in .xsaccess file).

              (0) 
              1. Thomas Jung Post author

                I’m not sure what to provide which isn’t already in the Developer Guide.  It alreayd has a step by step guide with source code examples.

                (0) 
  13. Kulwinder Singh

    HI Thomas,

    i need ur help in following issue:

    Accessing .xsjs file function from SAP UI5 project.

    i have created the following 2 projects:

    1) HANA XS project, in which i have defined the .xsjs file and inside it i have written a function.

    apart from this file, the project contains the .xsapp & .xsaccess file.

    the project is commited & activated on to the server.

    2) SAP UI5 development project:

    inside it i have created a view, its corresponding controller.

    from the index.html file, control goes to view.js file. here i want to access the function written inside the .xsjs file.

    Apart from this in the script tag, i have given the reference of the .xsjs file. this reference is the path from the server level.

    that function basiclly connects to the hana database and fetches the records.

    Error coming:: cannot get that function (getFilter() ). so my doubt is, how to reference the function written in .xsjs file in XS project to the view.js file inside SAP UI5 application project.

    my 2nd Doubt is: how to create the connection with the database. because when we use, $.db.getConnection(), the connection is not established.

    Please give your valuable suggestions…..

    Regards,

    Kulwinder

    (0) 
    1. Thomas Jung Post author

      >Apart from this in the script tag, i have given the reference of the .xsjs file. this reference is the path from the server level.

      You misunderstand the difference between server side javascript and client side javascript.  You can’t just reference the .xsjs files on the client side via the script tag. This code in the XSJS is executed on the server, not the client.  It create a REST based service which can only be accessed via HTTP.  Therefore you consume these services from the client side generally via AJAX requests.

      (0) 
      1. Viren Gupta

        @ Thomas,

        Hi, in the case as kulwinder described, he should create a Ajax request in the controller (which is called on the trigger of an even in the view ) and that Ajax request will consume the services from client side, ie. the function written in .xsjs file. ?

        regards,

        Viren

        (0) 
  14. Viren Gupta

    Hi Thomas,

    i am stuck up in a situation:

    i have created a .xsjs file in XS project and at last the data is being showed as xml via application type=  xml. this .xsjs shows the data in the browser in the form of xml, properly.

    now i want to access this .xsjs in the controller.js.

    i am trying to do it as follows:

    i have defined a variable and stored the URL of that .xsjs in it.

    then, a oData XMLModel is created and that url is assigned to it.

    when we debug the same via firefox/chrome, the inspect element shows the XML to be ” “.

    this means the .xsjs is not being accessed from server side to controller page.

    there is a demo example which shows that this is possible:

    http://scn.sap.com/community/developer-center/hana/blog/2013/01/22/rest-your-models-on-sap-hana-xs

    i tried to did the same, but failed.

    Please suggest.

    Regards,

    Viren

    (0) 
  15. Aisha Mitha

    Hi Thomas,

              I am currently hosting an application on a tomcat server which calls the odata service.

    Since they are different servers, I am getting Acces Control Allow Origin Error. One possible solution is CORS.

    Is there a way to integrate CORS? Can you suggest some other way if it is currently not possible?

    (0) 
  16. Sathish Kumar

    Hi Thomas,

    This is a very detailed and well written blog. I great appreciate the information. We are presently analyzing architecture for a High performance analytical and planning application on HANA. We are planning to leverage Predictive Analytics, HANA Live (SoH). Earlier we were thinking of using ABAP Layer as the middle tier. But after looking at XS Engine and Sales and Operation Planning, it looks like we can eliminate the ABAP Layer. The only concerns we have are: Security & Extensibility. Do you have any inputs whether XS Engine would be a viable approach for our product.

    Thanks,

    Sathish

    (0) 
    1. Thomas Jung Post author

      >Do you have any inputs whether XS Engine would be a viable approach for our product.

      Without really knowing anything about your product or requirements, its not possible to comment. What kinds of security & extensibility concerns do you have?  Perhaps if you expand on your concerns, I could comment.

      (0) 
  17. Sharan Chama

    Dear Thomas,

    Is it possible to associate an analytic view with an attribute view in the OData service? Below is the issue I am facing –

    I currently have 2 attribute views – header and items. I have an association between the 2 views in the OData service. In the UI5 project I have a attachRowSelectionChange which restricts the Items table display to only show items for selected document. This works using attribute view entities in OData service.

    However the header table does not have an aggregate of the amounts, so I created an analytic view to contain this field, and added the analytic view as a separate entity to the same odata service. However when the UI5 project entity for header is changed to the analytic view entity, attachRowSelectionChange no longer functions.

    Kind Regards,

    Sharan Chama

    (0) 
    1. Thomas Jung Post author

      >Is it possible to associate an analytic view with an attribute view in the OData service?

      I’m not aware of a limitation; however I can that you should probably model the Attribute View into the Analytic View and then define two entities off the single Analytic View.  Also you use Analytic views, don’t forget that you must define the aggregation in the OData Definition.

      >However when the UI5 project entity for header is changed to the analytic view entity, attachRowSelectionChange no longer functions.

      Can you post more details. Is there an error message on the service call?  Can you test the service directly in the browser or use the Chrome Developer Tools to see the details of the service call?

      (0) 
      1. Sharan Chama

        Dear Thomas,

        I finally was able to associate the Analytic view with the Attribute view. I was trying to add the navigates statement as I did between the two attribute views and this was causing the service to error. After only specifying the association statement the attachRowSelectionChange function started working.

        I now have an issue where the number of rows from the Analytic view is displayed s 28k (items table) instead of the 14k (header table). The analytic view data preview only shows 1 record per document, so not sure why it is counting all the items as well. Is there a way to fix this?

        Out of curiosity when you mentioned two entities on same view, did you mean same definition twice, just each with a separate entity name?

        Kind Regards,

        Sharan

        (0) 
        1. Thomas Jung Post author

          >I now have an issue where the number of rows from the Analytic view is displayed s 28k (items table) instead of the 14k (header table). The analytic view data preview only shows 1 record per document, so not sure why it is counting all the items as well. Is there a way to fix this?

          This could be caused by the parameter: $inlinecount=allpages.  Can you try running the service from the browser with and without this parameter and see if it makes a difference.  Other than that I would have to know more about your service and how you are getting the counts to answer further.

          >Out of curiosity when you mentioned two entities on same view, did you mean same definition twice, just each with a separate entity name?

          Kind of. You can have two entities on the same view, just with different keys and aggregations and still create associations between them.  For example from one view you can create both a header and item entity.

          (0) 
          1. Sharan Chama

            Hi Thomas,

            The analytic view uses the items table (28k records) as the data foundation, and is joined with an attribute view representing the header table (14k). I ran the service using inlinecount=allpages like you asked and the count is showing 14k as highlighted below.

            Capture.PNG

            Running without the parameter gives no count value.

            I am using the following method to count the rows –

            var rownum = purDocTable.getBinding(“rows”).iLength;

            However this is resulting in 28k instead of the 14k displayed by inlinecount

            Capture2.PNG

            I know one alternative is to execute a select distinct statement using xsjs to get the count, but was wondering if this can be done via odata as well since the inlinecount gives the correct number of documents. Many thanks for your assistance.

            Kind Regards,

            Sharan

            (0) 
            1. Thomas Jung Post author

              The fact that if you call the OData service directly it returns the correct number of rows would seem to indicate that the service is not at fault. This may very well be a bug in the table UI element on the client side.  You might look at the OData service call that the UI generates on the client side. I like to use the Chrome Developer Tools for this sort of thing.  From there you might see if it calling the correct entity in the OData service for the count.

              (0) 
              1. Sharan Chama

                Hi Thomas,

                Thanks a bunch for your help. I used chrome developer tools and identified the service call. This is the URL service call being generated by Table UI.

                http://server:8000/path/purdoc.xsodata/PURHEAD?$skip=0&$top=6&$orderby=EBELN%20asc&$filter=startswith(EBELN,%273000000008%27)&$inlinecount=allpages

                Below is the result of the above service call – Interestingly enough the count is properly displaying as 1 in the XML output but the bindRows still results in 6 because the purchase order has 6 line items.

                OData Sevice Call Result.PNG

                This only seems to happen when the entity refers to an analytic view, when i switch back to the entity referring to the attribute view, the counts reflect correctly, so could this be a bug only for analytic and calculation views?

                Kind Regards,

                Sharan

                (0) 
  18. Jeroen Custers

    Hi Thomas,

    Nice blog! I have an issue when checking out the package (SAP HANA Repositories tab). I get the following error:

    An internal error occurred during: “Checking out packages”.

    java.lang.NullPointerException

    I don’t know how to get more details about this error. I’m using HANA Studio rev48 on Windows 8.

    Thanks in advance for your reply!

    Best regards,

    Jeroen

    (0) 
    1. Thomas Jung Post author

      Well you should never get a java.lang.NullPointerException in the Studio, even if you do something wrong.  So this is certainly a bug.  Consider upgrading to a newer version of the Studio.  Rev48 is pretty old at this point and many bugs have been fixed in later revisions. 

      Double check and make sure that you have properly configured the connection to REGI.  You must install the HANA Client 64 bit and in the studio go to Window->Preferences; SAP HANA Development->Repository Access.  Make sure sure that you have a valid location for REGI in this configuration setting.

      (0) 
      1. Jeroen Custers

        Hi Thomas,

        Thanks for your reply. Where can I find newer versions of the studio and the client? I have downloaded studio and client from this HANA Developer center (this is rev48). Maybe my issue is related to our HANA Platform Edition rev46.

        Best Regards,

        Jeroen

        (0) 
        1. Thomas Jung Post author

          >Where can I find newer versions of the studio and the client?

          Customers and partners can download newer revisions from the Service Marketplace.  If you are trying out the free developer edition, you are restricted to the revisions available on the Developer Center, which might be relatively old. 

          Your server is Revision 46? That is also pretty old.  I know that’s older than what is currently on the Developer Center.  Is this a developer center image or an on-premise HANA system?

          (0) 
          1. Jeroen Custers

            Rev46 is our on-premise server which we use for the ERP EHP6 on HANA rampup. We are SAP partner and we are in contact with SAP about the HANA Plaform downloads which are missing/not available for our user in Service Markplace for a few weeks. I hope that we have access again soon to update our HANA server to the latest revision.

            (0) 
  19. Carlos Pachon-Gomez

    Hello Thomas,

    Thanks heaps for your blogs and all the content posted in the SAP HANA Academy. It has been extremely useful.

    Regarding:

    Server Side JavaScript

    The XSODATA services are great because they provide a large amount of functionality with minimal amounts of development effort.  However there are a few limitations which come with such a framework approach.  For example in SAP HANA SP5, the OData service framework is read only.  Support for Insert, Update, and Delete operations is currently planned for SAP HANA SP6.

    Does SAP have any planned release dates for SAP HANA SP6?

    How confident are you that Read and Write Access will be supported in this Service Pack?

    Any information you can provide is greatly appreciated.

    (0) 
    1. Thomas Jung Post author

      >Does SAP have any planned release dates for SAP HANA SP6?

      Yes SPS6 is planned for release near the end of June.

      >How confident are you that Read and Write Access will be supported in this Service Pack?

      Confident.  The development is complete and we are in the testing phases right now. Please note that it is still a planned feature and therefore we are not making a legal commitment that it will be present. Gotta keep the lawyers happy.

      >Any information you can provide is greatly appreciated.

      We will share more information as we get closer to the SPS6 release date.  You can expect some blogs and new videos which showcase the new features.


      (0) 
  20. Amanda Rzepka

    Hi Thomas,

    Thanks for the post.

    One question : Can the XS Services be used in a BW on HANA Scenario?

    Many thanks and regards,

    amanda

    (0) 
    1. Thomas Jung Post author

      >Can the XS Services be used in a BW on HANA Scenario?

      Yes.  XS is part of ALL HANA systems.  You should check and make sure you are licensed for direct access to the underlying HANA instance, however. 

      (0) 
  21. Holger Schimanski

    What was the reason to introduce a hole new app server concept in favor to bring Java / J2EE app server technology closer to HANA? JavaScript libraries and community are not on the same level as Java ecosystem is.

    Kind regards

    Holger

    (0) 
    1. DJ Adams

      “JavaScript libraries and community are not on the same level as Java ecosystem is.

      — thank goodness for that!

      dj

      (0) 
    2. Krishnakumar Ramamoorthy

      Holger

      In my opinion, a J2EE app server would have made it extra big and not extra small (XS). I am with DJ here.. keeping it simple at the app server layer is very important in this case because the power lies within HANA, app server is just a conduit.For this purpose, XS engine works just fine.

      (0) 
    3. Holger Schimanski

      Yes, J2EE would be too big. And I like the OData service. But when it comes to implementation of business logic with some data validation and updating data in HANA you need to implement a service using Server-side JavaScript.

      But just using just HANA Server-side JavaScript API is too low level. This would be equivalent to plain Java Servlet (if at all).

      For a RESTful / JSON web service you have to implement so much stuff e.g. parsing and object mapping of input parameters, output formatting. This results in a lot of manual and error-prone code. In Java just take Jersey and add some annotations to your Java classes.

      Is there a similar library which could be used in XS Engine?

      (0) 
      1. Thomas Jung Post author

        >Is there a similar library which could be used in XS Engine?

        The XSODATA development object is similar.  We also have higher level frameworks for XMLA and Search Services (InA).  You can expect more such high level frameworks to be added to the HANA Extended Application Services in the future.

        (0) 
  22. Manav Mehra

    Hi,

    I have encountered a problem when I bind the oData to UI . my code is as below

    var oModel = new sap.ui.model.odata.ODataModel(“http://hanacloud:8000/data/header.xsodata/“, false);

        var oTable = new sap.ui.table.Table(“test”,{tableId: “tableID”,visibleRowCount: 10});

        oTable.setModel(oModel);

        oTable.bindRows(“/HEADER”);

        oTable.placeAt(“uiArea”);

    On running the html i am getting the table but the data is not displayed.

    I am using Cloudshare access to HANA studio.

    Thanks,

    Manav.

    (0) 
    1. Thomas Jung Post author

      Have you used something like the Chrome developer tools to see see if you are getting any client side javascript errors or to see if the request to your xsodata service is successful?

      (0) 
  23. Kumar Mayuresh

    Hi Thomas,

    I am having a tricky problem with SAP HANA XS – Odata service.

    I am using calculation view (scripted) with 4 input parameters and want to consume the same in Odata web service. I was able to Odata file and my calculation view successfully but during web service testing input parameters are not being identified – error for the parameter ends up with “no property found”.

    I am using SAP HANA one Rev 52.

    awaiting your feedback.

    Regards

    Kumar 🙂

    (0) 
  24. Alexander Bauer

    Hi Thomas,

    Great blog, well done. I have a question regarding the SAPUI5 runtime deployed to HANA (REV56). I am currently running SAPUI5 1.10.0 and want to upgrade to the latest version. I can not find any documentation on how to do this. Is there a delivery unit which I could download?

    Thanks for you help.

    Alex

    (0) 
    1. Thomas Jung Post author

      SAPUI5 gets updated auutomatically when you apply HANA revisions. There is no additional download or update needed.

      (0) 
      1. Chandra Edem

        Thomas,

        I registered for  OpenSAP  course “Introduction to Software Development on SAP HANA” on June 2, 9.00PM. I didn’t know that it is going to end  WEEK1 assignment test  on 6/3/2013 3.00PM. Is there any way can take that WEEK1 Assignment Test.

        Thanks

        Chandra

        (0) 
  25. Vivek Singh Bhoj

    Hi Thomas,

    Thanks for OpenSAP classes.

    Your Youtube Account also have very good exercises.

    IN OpenSAP Week 2 Unit 3 tutorial, after assigning admin role  to my user Id, i am not able to see sequences, synonyms, triggers under my schema or any other schema, i am only able to see Column Views, Procedures, Tables and Views.

    Though now i am able to insert data into my created table.

    Can you let me know how i will be able to see Sequences under my schema without removing the admin role?

    I am using HANA revision 52.

    Got to know from OpenSAP that:

    This is a known issue, and the only way that I’ve seen to fix it is to actually close the studio and open it again, then refresh the node. 

    Cheers,

    Rich Heilman

    SAP HANA Product Management

    Will this bug be fixed in HANA ver 56?

    (0) 
      1. Thomas Jung Post author

        >Will this bug be fixed in HANA ver 56?

        Personally I’ve still experienced this bug in SPS6 internal builds. Must be a tricky one to find. Luckily the workaround of closing and reopening isn’t too difficult.  Just annoying. This also probably makes the bug low priority.

        (0) 
  26. Christian Hufnagl

    Hi Thomas,

    thank you for the interesting tutorial.

    Can you tell me whether it is possible to download the source code of the “Putting it all together” video? And if yes: Where can I download it?

    Thanks!

    Christoph

    (0) 
    1. Thomas Jung Post author

        It will ship as non-automatic content in SPS6 (all systems will have it and it just needs to be imported).  The delivery units are also part of this week’s updates to the Cloudshare and AWS developer center images.  They are also available for download as part of the content of the openSAP course.

      (0) 
  27. Ravindra Channe

    Hi Thomas,

    Thanks for a wonderful and very informative blog. Is there any update on 32 bit REGI file ?

    Is it expected along with SPS6 ?

    Regards,

    Ravi

    (0) 
    1. Thomas Jung Post author

      Yes, it is still planned. However we are still a couple of weeks away and I’ve not seen the final installers to say for certain its there.

      (0) 
  28. Abdul Hakim

    Hi Thomas – What is the programming language used for HANA Extended application services?

    As HANA is more than a database i.e application platform by itself and as you mentioned that more and more applications will be built on HANA i have question as how the future SAP ERP system looks like..whether the current SAP Business suite based on ABAP will be completely migrated to HANA service in the future or SAP ABAP server will continue to evolve and receive focus investment from SAP.. Also whether ABAP can be used to built application in HANA extended services? Your thoughts.

    Thanks

    Abdul Hakim

    (0) 
    1. Thomas Jung Post author

      HANA Extended Application Services uses SQLScript and JavaScript as its two primary programming languages.

      >whether the current SAP Business suite based on ABAP will be completely migrated to HANA service

      No.  The Business Suite already runs on HANA but still via the ABAP application server.  It will continue to leverage HANA via a combination of enhancements to ABAP and utilizing some of the technologies described in this blog.

      >Also whether ABAP can be used to built application in HANA extended services

      No. There is no ABAP language container in HANA Extended Application Services.

      (0) 
  29. Milan Vrozina

    Hello,

    first and foremost, thank you for perfect openSAP classes related to HANA development and for this blog as well.

    I have one question related to server-side javascript. You mentioned in course, that is possible to use 3rd party libraries or reuse 3rd party code. But I can’t find a possible way how to import 3rd party javascript library -as is- to server and use it. For example I would like to use JSZip library to zip some file, before sending it to client from xsjs application. Is that possible ? Thank you.

    (0) 
    1. Thomas Jung Post author

      What kind of problem are you having using this library?  Strict mode JavaScript which doesn’t try to access the DOM, Window, or other client side specific objects should work in Server Side XSJS.  Generally if you have a library you just cut and paste into your XSJS or an XSJSLIB file and then call the functions from your code.

      (0) 
      1. Milan Vrozina

        Thanks for clarification. I thought there would be some kind of import.

        But anyway, in case of this specific library I have some problems with JSLint validation when I do cut and paste of the original code.

        (0) 
        1. Thomas Jung Post author

          JSLint checks are very strict and often produce syntax errors for items that just stylistic and won’t actually cause an error upon activation or runtime.  You can either ignore the JSLint errors or deactivate JSLint for this project in these cases. However it might also be an indication that the JavaScript code you are trying to import isn’t compatible with Strict mode.

          https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode

          (0) 
  30. ashutosh dixit

    Hi Thomas ,

    Amazing blog – once again Thomas, thanks.

    I have been following you for many days , attended your OPEN SAP course also.

    That was an amazing course for new learner like me .

    One of our client is looking forward for XS based search Application identical to what you have created in your DEMO.

    EPM.jpg

    But I am not able to fetch the data on blank HTML page is coming with no data .

    If there is any step by step document related to this please help in getting that .

    Any help will be highly appreciated.

    Thanks

    Ashutosh

    (0) 
        1. Thomas Jung Post author

          >Is there any more demos for the SHINE ??

          I’m not exactly sure what you mean by that.  We are building additional content for SHINE that will be delivered in SP7. 

          (0) 
  31. Abdul Hakim

    Thomas – Let us say a customer is running SAP Netweaver 7.4 ABAP with HANA DB and they have HANA extended service as well…If the customer wants to do new developments then what is the recommendation from SAP ie. whether to build application using HANA XS or use SAP Netweaver 7.4 ABAP..If any one of the option is recommended by SAP then kindly share the pros and cons of each of the item (SAP Netweaver 7.4 ABAP Vs SAP HANA XS)…

    Thanks

    Hakim

    (0) 
    1. Thomas Jung Post author

      >. whether to build application using HANA XS or use SAP Netweaver 7.4 ABAP..If any one of the option is recommended by SAP then kindly share the pros and cons of each of the item


      Taken from the TechEd CD103 session slides:

      Guidance

      use ABAP for optimization of existing progams (in context of SAP Business Suite or BW)

      consider HANA Native Development for development of new applications which will solely run on SAP HANA

      combine ABAP and HANA Native Development to enrich existing applications (e.g. SAP HANA Live, Fiori)

      ABAP

      applications follow 3-tier architecture

      ABAP is in general database agnostic, but with release 7.4 optimized for SAP HANA

      Programming language: ABAP / ABAP OO with the option to use SAP HANA features

      IDE: eclipse-based ABAP Development Tools

      HANA Native Development

      applications follow 2-tier architecture

      HANA Native Development is SAP HANA specific and embedded in the database

      Programming language: River; server-side JavaScript, SQL/SQLScript

      IDE: eclipse-based SAP HANA Studio + web IDE




      (0) 
      1. Abdul Hakim

        Thomas – Thanks for the clarification…Much appreciated…I was listening to ABAP on HANA session by Thorsten Schneider @ this year Teched and he was mentioning that SAP Plans to bring ABAP very close to HANA in the coming future but not much details have been discussed in the session…ABAP Close to HANA means whether we can expect a similar 2 tier architecture similar to HANA XS in the future or what does that mean…??

        Thanks

        Hakim

        (0) 
        1. Thomas Jung Post author

          >ABAP Close to HANA means whether we can expect a similar 2 tier architecture similar to HANA XS in the future or what does that mean

          No it doesn’t mean that ABAP will become a 2 tier architecture.  We will not move the ABAP VM/Kernel into HANA itself. It will remain a separate application server.  At least for the current plans/foreseeable future. What he was referring to was bringing the programming models closer.  For instance the new 7.40 SP5 feature that allows you to write SQLScript directly within an ABAP class method.

          (0) 
          1. Baskar Gopalakrishnan

            Hi Thomas,

                             I’m a SAP PI Middleware consultant/SAP topic leader in XI/PI  heavily worked on Java related Netweaver stack. I have knowledge in ABAP but not worked heavily in abap.  I have enrolled your sap hana native application development course. I feel very interesting… I did work heavily in java and javascript projects using eclipse development tool.  Do you think if I invest my time in just native hana development and proceed in HANA field is a good step?  I don’t have BW experience either…

            (0) 
          2. Abdul Hakim

            Hi Thomas – Was going through blog regarding River (RDL)…Just a question on this…

            When  you say Programming language for HANA native development is Server side Javascript / SQL / SQL Script..Once RDL is rolled out whether RDL can be used for native application development instead of Server side Java script / SQL / SQL Script?? I am very much new to this stuff so appreciate if you can also help on how to get started with Server Side Java script / SQL / SQL Script for HANA…

            Thanks

            Hakim

            (0) 
  32. Raghuveer Phull

    Do you have an example/documentation/video where you can write a service which will populate Hana DB ?

    What I am asking for is a way for my external script to populate the DB tables i have created in Hana DB.

    (0) 
  33. Vikas Madaan

    Hi Thomas,

    Thanks a lot for sharing useful information through various blogs.

    In my current project we are evaluating use of XSOData or XSJS applications. I saw your videos like the one mentioned below:

    http://www.saphana.com/docs/DOC-4376

    Want i understood from various blog is this:

    From SP7 we can write exsits in the OData services and it is very easy to consume at the client side just like any REST base service and from my understanding it is Scalable as well. I would love to use XSOData always becuase development effort is very less compare to XSJS and it is very easy to rampup the team on OData related development objects.

    XSJS were as provide more control becuase of server side scripting becuase it allows development on the server side using JavaScript. Core APIs of SAP HANA Extended Application Services are, therefore, exposed as JavaScript functions; providing easy access to the HTTP Request and Response object as well database access to execute SQL or call SQLScript Procedures. It provide us control over the body format and and URL parameter definition.

    Could please help me in understanding in more advantages/disadvantages for both techniques?

    I am very keen to understand and also explain the same to team members becuase i don’t want to use both the approaches and even sometimes customer can also ask the same to us.

    Also If we are on SP6 then from my understanding XSJS provides us more capability in terms of complex application. Corrent me If i am wrong.

    Thanks!

    Regards,

    Vikas Madaan

    (0) 
    1. Thomas Jung Post author

      >Could please help me in understanding in more advantages/disadvantages for both techniques?

      You’ve summarized it pretty well already. 

      >becuase i don’t want to use both the approaches

      Even with the CRUD support and exits in XSODATA, its still pretty hard to do 100% via XSODATA.  There are still valid use cases for XSJS when you need custom body, custom read processing, job scheduling, etc.  Its good to try and use XSODATA whenever possible, but I wouldn’t automatically exclude the use of XSJS.

      (0) 
      1. Vikas Madaan

        Thanks Thomas.

        I think we are on same page.

        Once quick question that came to my mind: Is there any restriction or development limitation in the XSJSLIB files?

        Regards,

        Vikas Madaan

        (0) 
        1. Thomas Jung Post author

          >Is there any restriction or development limitation in the XSJSLIB files?

          That’s a very general question. Difficult to answer without any context.

          (0) 
  34. gentilini andre

    Hello Thomas,

    Thank you for this great How-To Guide.

    I´m pretty new in SAPUI5 and tried your export-sample in my little trial project, but it doesn´t work 🙁

    My Button for this looks like:

    <code>

    var oButton3 = new sap.ui.commons.Button({

                text : “Save to Excel”,

                icon : “images/save_button.jpg”,

                lite: true,

                press : function() {alert(oButton3.getText());

                downloadExcel();}

    </code>

    and the function for this action looks like:

    <code>

    function downloadExcel(){

       

        var body = ”;

        alert(‘drin’);

        print($query);

        var query = ‘SELECT “CompanyName”, “PartnerId”, “PostalCode”, “City”, “PurchaseOrderId”, “LifecycleStatus”, “GrossAmount”, “TaxAmount”, “CM_NET_Amount_001”, “Currency” FROM “_SYS_BIC”.”Workshop_001.PG1_BL_TI.ANGE1/CA_TBN_001″ order by “PurchaseOrderId”‘; 

        var conn = $.db.getConnection(); 

        var pstmt = conn.prepareStatement(query); 

        var rs = pstmt.executeQuery();

       

        body =  

    “\tCompanyName \tPartnerId \tPostalCode \tCity \tPurchase Order Id \tLifecycle Status \tGross Amount \tTax Amount \tNetto Amount \tCurrency \n”; 

       while(rs.next()) {

           if(rs.next() == ”){

           alert($.response.setBody( “Failed to retrieve data” )); 

           alert($.response.status = $.net.http.INTERNAL_SERVER_ERROR);}

          

           else{

           body += rs.getString(1)+ 

    “\t”+rs.getString(2)+”\t”+rs.getString(3)+”\t”+rs.getString(4)+”\t”+rs.getString(5)+”\t”+rs.getString(6)+”\t”+rs.getDecimal(7)+”\t”+rs.getDecimal(8)+”\t”+rs.getDecimal(9)+”\t”+rs.getString(10)+”\n”;} 

        }    $.response.setBody(body);     

        $.response.contentType = ‘application/vnd.ms-excel; charset=utf-16le’; 

        $.response.headers.set(‘Content-Disposition’,’attachment; filename=Excel.xls’); 

        $.response.headers.set(‘access-control-allow-origin’,’*’); 

        $.response.status = $.net.http.OK; 

    }

    </code>

    I´m afraid and hope that you can help me.

    Kind regards

    André

    (0) 
    1. Thomas Jung Post author

      You have a fundamental misunderstanding here.  You are placing server side JavaScript code in your client side UI5 application. The function downloadExcel is something you need to execute on the server. It needs to be in an XSJS file and it is called from the client side via AJAX – as a REST service not as a local function.

      (0) 
  35. Samuel Tanor-Gyedu

    Hi Thomas,

    I have an odata service with this endpointhttps://s5hanaxs.hanatrial.ondemand.com/…/services/User.xsodata

    I am now trying to consume it from eclipse with the odata4j libraries.

    This is how I get the endpoint.

    public UserServiceOdata(String endpointUri) {

      this.endpointUri = endpointUri;

      ODataConsumer.dump.responseHeaders(true);

      consumer = ODataConsumers.create(endpointUri);

      }

    This is my method to add a user.

    public User addUser(User user) {

         consumer.createEntity(entitySet).properties(OProperties.int32(propertyUserId,      user.getId())).properties(OProperties.string(propertyUserName,      user.getName())).properties(OProperties.string(propertyUserEmail,      user.getEmail())).execute();

    return user;

    }

    When I call addUser method I get an Error:

    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[78,253]

    Message: The reference to entity “sourceUrl” must end with the ‘;’ delimiter.

    odataError1.PNG

    When I use this endpoint https://s5hanaxs.hanatrial.ondemand.com/…/services/User.svc everything works fine. With the https://s5hanaxs.hanatrial.ondemand.com/…/services/User.xsodata I get errors.

    Please I would be very grateful for assistance.

    Thanks in advance.

    Regards,

    Samuel

    (0) 
    1. Thomas Jung Post author

      I don’t think I can help you. This appears to a question about how odata4j works not about XS.  I have no experience with odata4j myself.

      (0) 
  36. gentilini andre

    Hi Thomas,

    well I followed your hints but it still don´t work.

    I created a xsjs File like below:

    function downloadExcel(){

        try {

            var body = ”;

            alert(‘drin’);

            var query = ‘SELECT “CompanyName”, “PartnerId”, “PostalCode”, “City”, “PurchaseOrderId”, “LifecycleStatus”, “GrossAmount”, “TaxAmount”, “CM_NET_Amount_001”, “Currency” FROM “_SYS_BIC”.”Workshop_001.PG1_BL_TI.ANGE1/CA_TBN_001″ order by “PurchaseOrderId”‘; 

            var conn = $.db.getConnection(); 

            var pstmt = conn.prepareStatement(query); 

            var rs = pstmt.executeQuery();

            alert(‘drusse’);

            body =  

                “\tCompanyName \tPartnerId \tPostalCode \tCity \tPurchase Order Id \tLifecycle Status \tGross Amount \tTax Amount \tNetto Amount \tCurrency \n”; 

            while(rs.next()) {

                body += rs.getString(1)+ 

                “\t”+rs.getString(2)+”\t”+rs.getString(3)+”\t”+rs.getString(4)+”\t”+rs.getString(5)+”\t”+rs.getString(6)+”\t”+rs.getDecimal(7)+”\t”+rs.getDecimal(8)+”\t”+rs.getDecimal(9)+”\t”+rs.getString(10)+”\n”;} 

            $.response.setBody(body);     

            $.response.contentType = ‘application/vnd.ms-excel; charset=utf-16le’; 

            $.response.headers.set(‘Content-Disposition’,’attachment; filename=Excel.xls’); 

            $.response.headers.set(‘access-control-allow-origin’,’*’); 

            $.response.status = $.net.http.OK;

        } catch (e) {

            alert(‘db conn funktioniert nicht’);}

    }

    var a = $.request.parameters.get(‘cmd’);

    $.response.setBody(‘Invalid Command: ‘+a);

    switch (a) { 

    case “doex”:

        $.response.setBody(‘Invalid Command: ‘+a);

        alert(“filedownload”);

        this.downloadExcel(); 

        break; 

    default: 

        $.response.status = $.net.http.INTERNAL_SERVER_ERROR; 

    $.response.setBody(‘Invalid Command: ‘+a); 

    The Controller.js File:

    doFileDownload : function (oEvent){

            jQuery.sap.require(“sap.ui.commons.MessageBox”); 

    //        sap.ui.commons.MessageBox.show(“Export Starten?”, sap.ui.commons.MessageBox.Icon.confirm, “Information”);

            sap.ui.commons.MessageBox.confirm(“Export starten?”,inform, “Confirmation”);

    //        return false;

            function inform(rValue){

    //            alert (“drinnnnne!”);

                var aurl = “FileDownload.xsjs?cmd=doex”;

                if(rValue)    //If User presses ‘Ok’

                {

                    alert(aurl);

                    jQuery.ajax({  

                        url: aurl,  

                        method: “POST”,  

                        dataType: “json”,

                        data:{cmd:”doex”},

                        success: sap.ui.commons.MessageBox.alert(“Export wird ausgeführt!”,”,”Confirmation”),

                        error:function onErrorCall(jqXHR, textStatus, errorThrown){

                            alert(jqXHR.status);

                            sap.ui.commons.MessageBox.show(jqXHR.status,   

                                    “ERROR”,  

                            “Error in calling Service” );   

                            return;  

                        },

                        complete: sap.ui.commons.MessageBox.alert(“Export Erfolgreich abgeschlossen!”,”,”Confirmation”)

                    });  

    //                return false;

                }

                else  // If the user presses ‘Cancel’

                {

                    sap.ui.commons.MessageBox.alert(“Vorgang abgebrochen!”,”,”Notification”);

                }

            }

        }

    });

    at last but not least the view 🙂

    sap.ui.jsview(“zag1_ui_cv_03.Index”, {

        /** Specifies the Controller belonging to this View.

        * In the case that it is not implemented, or that “null” is returned, this View does not have a Controller.

        * @memberOf zag1_ui_cv_03.Index

        */

        getControllerName : function() {

            return “zag1_ui_cv_03.Index”;

        },

        /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.

        * Since the Controller is given to this method, its event handlers can be attached right away.

        * @memberOf zag1_ui_cv_03.Index

        */

        createContent : function(oController) {

           

    //         create a lite button with an icon and a text

            var oButton3 = new sap.ui.commons.Button({

                text : “Save to Excel”,

                icon : “images/save_button.jpg”,

                lite: true       

        }).placeAt(“btn”);

           

            oButton3.attachPress(oController.doFileDownload);  

       

           

              var oButton4 = new sap.ui.commons.Button({

                text : “Refresh”,

                icon : “images/refresh.jpg”,

                lite: true,

                press : function() {var data = oTable.val();

                if(data == ”)

                    alert(“no data found”);

    //                return;

    //                print(‘content’);

    //                print(DatArray);

                if (data != ”)

                    alert(‘Funzt’);

                    JSONToCSVConvertor(data, “CUSTOMER AMOUNT”, true);

                }

        }).placeAt(“btn”);  

           

           

            jQuery.sap.require(“sap.ui.table.Table”);

            // create table control with properties

            var oTable = new sap.ui.table.Table({

            width : “100%”,

            rowHeight : 50,

            title : “Amount per Partner”,

            selectionMode : sap.ui.table.SelectionMode.None

            });

           

            oTable.addColumn(new sap.ui.table.Column({

                label : new sap.ui.commons.Label({

                text : “Company Name”

                }),

                template : new sap.ui.commons.TextView({

                text : “{CompanyName}”

                })

                ,sortProperty : “CompanyName”

                   

                }));

           

           

            oTable.addColumn(new sap.ui.table.Column({

            label : new sap.ui.commons.Label({

            text : “Partner ID”

            }),

            template : new sap.ui.commons.TextView({

            text : “{PartnerId}”

            })

            ,sortProperty : “PartnerId”

               

            }));

           

           

           

            oTable.addColumn(new sap.ui.table.Column({

                label : new sap.ui.commons.Label({

                text : “Postal Code”,

               

                textAlign : sap.ui.core.TextAlign.End

                }),

                template : new sap.ui.commons.TextView({

                text : “{PostalCode}”,

                textAlign : sap.ui.core.TextAlign.End

                }),

                sortProperty : “PostalCode”

                }));

           

                oTable.addColumn(new sap.ui.table.Column({

                label : new sap.ui.commons.Label({

                text : “City”

                }),

                template : new sap.ui.commons.TextView({

                text : “{City}”

                }),

                sortProperty : “City”

                }));

               

               

                oTable.addColumn(new sap.ui.table.Column({

                    label : new sap.ui.commons.Label({

                    text : “Purchase ID”

                    }),

                    template : new sap.ui.commons.TextView({

                    text : “{PurchaseOrderId}”

                    }),

                    sortProperty : “Currency”

                    }));

               

               

                oTable.addColumn(new sap.ui.table.Column({

                label : new sap.ui.commons.Label({

                text : “Lifecycle Status”

                }),

                template : new sap.ui.commons.TextView({

                text : “{LifecycleStatus}”

                }),

                sortProperty : “LifecycleStatus”

                }));

               

               

                oTable.addColumn(new sap.ui.table.Column({

                    label : new sap.ui.commons.Label({

                    text : “Gross Amount”

                    }),

                    template : new sap.ui.commons.TextView({

                    text : “{GrossAmount}”

                    }),

                    sortProperty : “GrossAmount”

                    }));

               

                oTable.addColumn(new sap.ui.table.Column({

                    label : new sap.ui.commons.Label({

                    text : “Tax Amount”

                    }),

                    template : new sap.ui.commons.TextView({

                    text : “{TaxAmount}”

                    }),

                    sortProperty : “TaxAmount”

                    }));

               

                oTable.addColumn(new sap.ui.table.Column({

                    label : new sap.ui.commons.Label({

                    text : “Amount Netto”

                    }),

                    template : new sap.ui.commons.TextView({

                    text : “{CM_NET_Amount_001}”

                    }),

                    sortProperty : “CM_NET_Amount_001”

                    }));

               

                oTable.addColumn(new sap.ui.table.Column({

                    label : new sap.ui.commons.Label({

                    text : “Currency”

                    }),

                    template : new sap.ui.commons.TextView({

                    text : “{Currency}”

                    }),

                    sortProperty : “Currency”

                    }));

               

               

               

                var oModel = new sap.ui.model.odata.ODataModel 

                 (“http://qperior.vm.cld.sr:8000/ZAG1_WS_001/ZAG1_CV_001.xsodata;“, false);  

              

                oTable.setModel(oModel); 

                oTable.bindRows(“/Amount”);

                   return oTable;

               

               

               

        }

       

       

    });

    It won´t call the function or better said the action of the button works fine till to the point where it should call the xsjs.file to generate the excel-file. I wondered that in the ajax part the error-, success- and complete-part will be executed at the same time, and not only one of this statements. The message is “200” (The request has succeeded. The information returned with the response is dependent on the method used in the request).

    Maybe you can see where my mistake is, or whats going wrong?

    I´ve the developer edition on cloudshare (Hana Studio rev.68; Server is on SPS05).

    Thanks

    André

    (0) 
    1. Thomas Jung Post author

      Difficult to say what is wrong. I several things which are different than our sample that does this.  You are using a POST for instance instead of a GET.  However if you are gettting a 200 then I assume the service call is correct. In client side tools (like Chrome Developer Tools) you should be able to see the response object from the call. 

      However what I would really recommend is that you study the SHINE content (SAP HANA Interactive Education).  There is already a sample application which does this in SHINE. Also it has some special JavaScript in the UI to handle the file attachment via AXAJ call. Perhaps that is the part you are missing.  You can read more about SHINE here.  It is also included already installed in the latest version of the HANA Developer Center trial image (SP7 based).

      http://help.sap.com/hana/SAP_HANA_Interactive_Education_SHINE_en.pdf

      (0) 
  37. Abdul Hakim

    Hi Thomas – Any recommended book or resource to learn and master Server Side Javascript? There were many books available in the market but as a beginner need to know the right resource / book to start with and master this stuff..Also whether SAP plan to conduct any training to teach Server Side Javascript similar to other standard training offerings?

    Thanks

    Hakim

    (0) 
  38. Vikas Madaan

    Hi Thomas,

    I am trying to pull data from SAP system onto HANA Database using XSJOB files. I am calling RFC enabled function modules over HTTP request. It helps me replicating the real time ECC data onto HANA as well with back ground jobs.

    I am facing one problem in the XSHTTPDEST file. I am able to create and activate the file using studio and this file is even visible in the web based XS administration tool. But in the web based tool when i provide user and password for basic authotication then system just clears the user id and password when i try to save. This the reason our HTTP requests are getting failed and below is the response we are getting in the response body.

    <html><head><title>Logon Error Message</title>

    Is this known issue or we are missing something? Is it possible to provide user and password in the XSHTTPDEST file. Is there any particular syntax?

    I checked and i have the required authorizations as well develper Guide.

    Please help.

    Regards,

    Vikas Madaan

    (0) 
    1. Thomas Jung Post author

      No this isn’t a known issue I’ve seen.  Nor can I recreate the problem in my system.  No you can’t maintain the authentication in XSHTTPDEST itself. It intentionally must be set in XSADMIN tool. I can really only suggest that you open a support ticket.

      (0) 

Leave a Reply