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.
In this sample several notions are consumed in order to structure the calls to Service Layer, please review them in advance:
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