We have already published serveral blogs talking about SAP Business One version for SAP HANA new Service Layer oData interface:
In this blog I’ll like to continue the series by talking about how to enable CORS (Cross Origin Resource Sharing) in Service Layer.
If you want to better understand CORS just have a look to the web, many articles are available. Here I just gave one link talking about it:
CORS configuration has been implemented in Service Layer since SAP Business One version for SAP HANA 9.1 PL08 released end of July 2015 and is documented inside the document “Working_with_SAP Business_One_Service_Layer.pdf” directly available from your HANA Server at https://hanaserver:50000/Working_with_SAP_Business_One_Service_Layer.pdf.
In order to enable CORS in your Service Layer server you have to add the following 2 parameters into the b1s.conf file located at /usr/sap/SAPBusinessOne/ServiceLayer/conf folder:
“CorsEnable” : true
Default value is false.
If this item is set to true, Service Layer will check the value of
This item takes effect only if CorsEnable is true. It is a semi-colon separated
string list where each string is a representation of a trusted origin.
CorsAllowedOrigins can also be configured as “*” to support requests from
all origins. However, in production environments, it is not recommended due to
After changing the configuration don’t forget to restart Service Layer!
Now that Service Layer CORS has been configured you can for example directly call Service Layer from your client side Java Script application. You just need to add to your ajax calls the parameter:
Hope you will enjoy it!