Technical Articles
Connect HANA Cloud Service Instance with SAP Business Application Studio
SAP Business Application Studio is going to be the next version of SAP Web IDE, which is comparatively advanced in features and development efficiencies. It aims to significantly improve the development experience by providing us more control over the environment and code.
SAP Business Application Studio comes out of the box with predefined set of development environments – Dev-Spaces (virtual machine on the cloud where we can develop, build, test and run using run times and tools already installed) tailored for developing SAP business scenarios.
In order to connect SAP HANA Cloud with SAP Business Application Studio, it is assumed that you already have access to SAP Business Application Studio in DEV Space with a type of SAP Cloud Business Application, also you have been authorized with Business_Application_Studio_Developer role that you can find in Cloud Foundry Sub Account details and screenshot is attached for the same.
Once Role Collection is done, switch to Trust Configuration and SAP ID Service
Assign, Business_Application_Studio_Developer to the Developer Login ID
For additional details on Subscription and Assigning the roles, please refer link below:
- Once you login to SAP Business Application Studio, you see DEV space is currently stopped, please ignore if it’s already running.
- Start the DEV space and wait until it’s up and running
- So, DEV Space is up and running, we click on SAPCAPM and enter inside SAP Business Application Studio and we can move on to SQL Tools highlighted in the image to establish a connection with HANA Cloud Instance.
- Before we move forward please open a new terminal as shown below
- Pass the following commands in sequence in terminal:
-
- mkdir -p ~/.ssl
- cd ~/.ssl
-
npm install -g node-wget
-
openssl x509 -inform der -in DigiCertGlobalRootCA.crt -out ~/.ssl/DigiCertGlobalRootCA.pem
- cd ~
- Why do we need these commands ? Answer is:
We need to have a trust-store with DigiCert, for connecting HANA as a Service (cloud service), the connection is required to be encrypted.This gets the proper certificate required for providing an encrypted connection, converts it to the proper format, and places it the the proper location so that the SQL connection configuration can find it.
Please refer link below for more information on this:
https://vscode-sqltools.mteixeira.dev/driver/saphana#Error
- We need to choose appropriate Database Driver, in our case it is SAP HANA
- Once chosen, following screen shows up
- Pass all the required parameters, once passed SAVE CONNECTION and TEST CONNECTION buttons would be enabled.
- In order to connect with HANA Cloud Service Instance, we need to make some changes in the settings, Open Preferences
SQLTools, Connections
- Once clicked on connections, it asks us to ADD a value
- Preference -> SQLTools->Connection->Add Value-> WorkSpace->SQL Connections
{
"sqltools.connections": [
{
"dialect": "SAPHana",
"port": -----,
"server": "---------------------------------------",
"name": "--------",
"database": "DBADMIN",
"username": "DBADMIN",
"password": "-----------",
"hanaOptions": {
"encrypt": true,
"sslValidateCertificate": true,
"sslCryptoProvider": "openssl",
"sslTrustStore": "/home/user/.ssl/DigiCertGlobalRootCA.pem"
},
"isActive": false,
"isConnected": false
}
]
- As mentioned above, HANA Cloud Service Instance has to be Encrypted, along with Trust Store and DigiCert in it, same values have been passed to HANA Options with other required parameters.
- Save and Click on Connect HANA Database Service Instance
- Successfully, we are now connected with the HANA Cloud Service Instance.
- Let’s check if it is really working, select HANA DB and click on SQL
- Write SELECT Query on any exiting database table, in my case I am using DeviceMaster
Select the query and right click on it:
- HANA Cloud Service Instance is connected and we are getting the result
I hope this blog would be useful for everyone looking forward to work on SAP Business Application Studio,please do share your views on this.
References:
- https://blogs.sap.com/2020/03/06/sap-business-application-studio-trial-in-sap-cloud-platform-assigning-roles/
- https://vscode-sqltools.mteixeira.dev/driver/saphana#Error
Profile on SAP Community:
https://people.sap.com/shiromani.soni
Regards
Shiromani Soni
Thanks shiormani soni for sharing the block with detailed steps. Let's try ??
Thank you Sanjeev 🙂
Hi,
Thanks for taking the time to contribute to the community of BAS and CAP 🙂
I think you can greatly improve your productivity, working with the tools that BAS has to offer.
You can create a new run configuration for a CAP Node application ( In the future we hope to add support for CAP Java apps as well) and use the bind option to connect to an SAP HANA instance, Then, the connection is created for you automatically and you can immediately move to the SQLTools view to check your data.
It will be great if you can give it a try and tell me what you think 🙂
Thanks,
Liat
Hi Liat,
Thanks for writing and certainly it would add wings to BAS and CAP capabilities, looking forward to get hands on with the new and advanced features.
Regards,
Shiromani Soni
With the SQL connection created out of run configuration tools for my CAP node.js project, I am getting below error :
Deployment to container 62259D0F1AA849929E7C1DDFDD37E18F failed – error: Connection failed (RTE:[89006] System call ‘connect’ failed, rc=111:Connection refused {13.xxx.xxx.26:xxxxx} (<hana-instance-server>:<port>)) [Deployment ID: none].
Even after following this blog steps it is same.
Appreciate any help!
Best regards,
Sumit
Hi Sumit,
What are the steps you followed?
You created a run configuration and then have bind your db to a HANA instance?
Yes per https://developers.sap.com/tutorials/appstudio-cap-deploy-app.html#7012a9b9-524d-48e0-8958-6246c0a34edd
I am using SAP Cloud Platform, SAP HANA Service though.
Best regards,
Sumit
Make sure HaaS is configured as 'open to all IPs'. I think this is the issue you're facing.
Thanks,
Liat
Spot on Liat! Thanks a lot for your help. It worked after alloed all IPs in HaaS instance.
Best regards,
Sumit
Hi https://people.sap.com/shiromani.soni ,
May I know why I can’t see all the options that you see under SQLTools? What should I do to get those?
In SQL Tools, there is an option "Edit in settings.json", click on that and you would be able to see, please let me know if you are able to set up the connection.
Regards,
Shiromani Soni
Hi https://people.sap.com/shiromani.soni
I have the same error with connetcion : “Error opening connection only secure connections are allowed”
I applied all configs how you explain but keep the error: Error opening connection only secure connections are allowed.
Explain:
creating the connection, if i check this option:
thanks
Hi Alfredo,
Have you installed SSL Certificate as mentioned in the blog, if not please install it first and run the command in BAS terminal and carefully maintain settings.json and share the screenshot if you are facing the same error.
Regards,
Shiromani Soni
Hi https://people.sap.com/shiromani.soni
I have error when I try to connect my SAP HANA Database: "Error opening connection only secure connections are allowed".
Do you help me?
Hi Ihar,
Please make sure you have installed SSL, execute following commands in Terminal of BAS:
Hi https://people.sap.com/shiromani.soni
Yes all steps are done, but I get the same error
Hi Shiromani,
I think I missed a step. I am trying to run the commands but keep getting the
Error: Invalid URI "–no-check-certificate".
I don't have the certificate installed yet, but where am I supposed to install it?
Thanks
Larry
After this I am getting error as follows.. any hints? thanks!
Hi Larry,
Could you please try with the given commands above in terminal, you should be able to install it, please follow the steps in sequence carefully in the connect Database terminal in BAS.
Regards,
Shiromani Soni
I am facing same issue.. below is the terminal output.. any recommendations?.. thank you!
Please retype --no-check-certificate. Apparently your first - (from --) has an ASCII value of 150 instead of 45.
Very nice and detailed explanation Shiromani. Keep up the good work.
Best Regards,
Megha
Hello Soni,
a lot has changed since this blog has been published.
are your steps still valid for SAP Cloud Platform cockpit 2.15.6 that has BAS subscription enabled in it?
Thank you,
greg
Shiromani Soni Thanks for the detailed blog. For the connection details: The url, server in sql.connections file and SQL tool settings will be the same as the details we get from service key?
If yes, then I'm getting Sockets closed by peer. I have completed the certificate download part successfully. Kindly help
Please check in your HANA Connection, if Allow all IP address radio button is selected and SSL certificate is installed properly.
Hi Soni,
Thank you for sharing this blog. I have one question.
I have a lot of experience working in SAP NEO environment but in this case all the tables, storeprocedures, schemas, etc. I create it from the web based workbench for HANA and after this i create a XSJS service which is call from my application using configured destination to make my SQL statement.
After explain this my question is what is the way to work in Cloud foundry i mean for creating the tables, the store procedure and after this call this from my application in SAP UI5 controller ?.
Thanks a lot for your help.
Best regards.
In Cloud Foundry environment, you need to familiarize yourself with SAP CAPM and I have provided links for the same in my blogs. Refer these links for BAS and you will get to know.
Currently we use WebIDE for creating calculation views, procedures and BAS (Business Application Studio) for database artifacts (tables, sequences etc.) however going forward BAS will have everything and you don't need to use separate tools but the integrated framework for everything required in order to create an end-to-end application.
Follow the link:
https://blogs.sap.com/2020/07/09/sap-cloud-application-programming-model-ep1/
Regards,
Shiromani Soni
Hi Soni.
Thank you for your quick response.
I will check the blog you mention in your comment.
Best regards.
David.