Skip to Content
Author's profile photo Maria Trinidad MARTINEZ GEA

How to call SAP Business One Service Layer from HANA XS

As you might know our SAP Business One Service Layer provides an OData interface (see more details about Service Layer in our SAP Business One,version for SAP HANA Extensibility topics page). You can then develop applications in top of Service Layer to manage SAP Business One data.

 

One of the possibilities to create your own application in top of SAP HANA and Service Layer is to use SAP HANA XS (see details at Introducing…SAP HANA Extended Application Services (XS)).

In HANA XS to be able to call an https service from java script code it is required to create a destination and import the certificate into HANA XS. The following blogs provide detailed explanations how to set up the trust relation between your HANA XS application and an https service like our B1 Service Layer and how to define and call the https destination.

 

Videos in youtube are also showing step by step how to proceed:

Outbound httpS with HANA XS

Outbound httpS with HANA XS (part 2) – set up the trust relation

Outbound httpS with HANA XS (part 3) – call the https outbound service in XS server side JavaScript

 

Once these steps followed you will have

  • a destination file (.xshttpdest) in your HANA XS project containing details of the Service Layer destination.
    Pay attention the xshttpdest need to be in the same package as the xsjs file connecting to it (see attached B1SL.xshtppdes.txt file, remove the txt extension in your project)
  • an xsjs file using the destination file to call Service Layer (see attached CallSL_HTTPS.xsjs.txt file, remove the txt extension in your project).
    This xsjs file shows how to call B1 Service Layer fusing the HANA XS server side Java Script API (http://help.sap.com/hana/SAP_HANA_XS_JavaScript_Reference_en/$.net.http.Client.html).
  • a TrustedStore defined via HANA XS Admin tool and attached to your destination file also via HANA XS Admin tool

and you will be able to call https B1 Service Layer from your HANA XS.

 

Please find attached a sample HANA XS .xsjs file (change extension to .xsjs as only .txt accepted to be attached to a blog)

 

Note: This trusted relation can only setup between HANA XS and B1 Service Layer from B1H 9.1 PL10 on.

 

Regards,

Trinidad.

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jose Amaya
      Jose Amaya

      Dear Maria, first of all I want to thank you for this post

      I'm having problems to achieve the FIORI - B1 Service Layer connection and looking for a friendly hand to get forward, here is my question in the community, I'll be very happy if you could take a look at it

      https://answers.sap.com/questions/488194/getting-failed-to-send-request-to-socketrc-1-calli.html

      Wishing you the best
      Sincerely
      Jose

       

      Author's profile photo Sergei Travkin
      Sergei Travkin

      Dear Maria Trinidad,

      Thanks for the post!

      I was wondering if it would be a security issue to use an HTTP protocol and one of the load balancer member ports, such as 50001, when you call service layer from HANA XS?

      Author's profile photo Maria Jose Gonzalez
      Maria Jose Gonzalez

      Dear Maria Trinidad,

      I was wondering if is possible using B1 Service Layer Script Engine extensions in a HANA XS App?

      Thanks in advance.