I’ll like to share with you a sample we have developed in HANA XS (Java Script) connecting to SAP Business One Service Layer.

This sample uses a proxy class in order not to directly call SAP Business One Service Layer from the client side but from the server side. This option allows you to encapsulate your own business logic on the server side.

The sample provided contains a HANA XS application called ServiceLayerApp. This basic application shows you how to perform basic operations like Add/Update/Delete on Business Partners and Sales Orders entities via Service Layer.

How to get this application working in your environment

ServiceLayerApp HANA XS application

  • Extract from the zip file the source code corresponding to the ServiceLayerApp: SL_APP-SA.tgz.
    This package is a HANA XS Delivery Unit that you can directly import into your HANA development environment (via HANA Studio File -> Import Delivery Unit or HANA Web Workbench life cycle management tools).  As this delivery unit has been generated on a HANA SPS11 system, you require at least HANA SPS11 version to be able to import it.
  • Update the destination file and create the required trusted store for Service layer as explained in point 2 here below (Important notions section).
  • Run directly the project from the index.html main page

Note: The auto generated B1SLReference.js file has been generated based on SAP Business One 9.1 PL03 version for SAP HANA and will then maybe not contain the same entities your current Service Layer is exposing. Also your own UDOs, UDTs, UDFs will not be part of this reference class unless you regenerate this class with the oDataClassesGenerator .NET solution. Please check point 3 here below (Important notions section) for more details.

Important notions

In this sample several notions are consumed in order to structure the calls to Service Layer, please review them in advance:

  1. The HANA XS app client side doesn’t connect directly to Service Layer but calls a proxy server side JavaScript class (xsjs/B1SLProxy.xsjs) that filters the requests coming from the client side and calls the Service Layer. This proxy allows you to execute some extra server side checks and calculations before calling Service Layer.
  2. The server side of the application is calling SAP Business One Service Layer using HANA XS libraries allowing to directly call Service Layer.
    Check the following blog I published some time ago explaining how to setup HANA XS in order to be able to call SAP Business One Service Layer https oData interface:
    How to call SAP Business One Service Layer from HANA XS
  3. The “B1SLReference.js” class has been auto generated via TypeScript, please check the blog SAP Business One Service Layer – TypeScript autogeneration for more details.

Download

You can download the source code of the full sample containing different projects from here https://sapassets.edgesuite.net/tools/SL_APP.zip.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !