Hello Everyone,

I am writing this blog post on creating a  CDS Entity in SAP BTP, Expose the Entity as an OData Service to Outside world, Deploy to HANA DB and cloud foundry as an application, generate the API and Create a chatbot by consuming that API in SAP CAI chatbot.

Little Back Ground: 

Sounds interesting. Well I am pretty new to all these. I have created SAP CAI chatbots in the past from SAP HANA XSA workbench on HANA backend tables, Created an XSODATA service and exposed that service to an outside world and then called that API via a webhook call from in SAP CAI chatbot, integrated with SAP Fiori Portal and Facebook messenger also.

But over a period of time the development IDEs got changed from HANA XSA workbench to sap webide to –> now SAP Business Application studio. Even the underlying modelling also changed from packages to HDI Containers to CDS Entities.

Even SAP NEO cloud platform trial is stopped and CF is only enabled, available and now SAP Cloud platform cloud foundry is called SAP Business Technology platform,

SAP BTP provides bunch of PaaS services and all can be hosted on MS Azure, AWS, GCP and even Alibaba cloud data centers. The answer to why is very simple.  SAP is a Business Process Oriented company and not a cloud data center provider.

Hence SAP partnered with all these cloud data center provider vendors and hosting SAP workloads on all these cloud service providers/vendors and rebranded it to SAP Business Technology Platform.

We will go from the start to the end. Though it was an easy business case there were good number of issues I faced to make it run.

SAP BTP login Screen : 

Once you log in with your user name and password you can see that I have created a subaccount and created a dev space. Under dev space I will create a HANA DB instance and deployed application with in that dev space.

There are enough blogs explaining about creating subaccount and creating Dev space, subscribing a service from market place so I am not going to explain here the same.

But I will post the snapshots which I created and how it looks in BTP when you create those.

 

Instanced and Subscriptions.

 

Instances I created and Deployed.

 

Environment 

So now your BTP environment is ready

Now lets us go to SAP Business Application Studio :

1st you need to create a dev space and once that dev space created we can create a Full stack application inside the dev space.

The dev space which we created in SAP BTP is different and the dev space which we created SAP BAS is different.

SAP BAS dev is an area in which we you can create applications either using SAP UI 5 Fiori, Node, JAVA languages.

Now our environments are mostly ready.

Now let us go back to SAP BTP and try to understand few more areas. These are really required to understand while creating and deploying an application on Cloud Foundry. I have followed many blogs and was able to create an application but I was not able to deploy the same. I faced so many issues while deploying the application to CF.

Please understand these as well as in below : –

Entitlements:

We need to configure entitlements with shared units or else the deployment will fail.

Please see the below 2 snapshots

Look at the SAP HANA schema and HDI container entitlement configured.

 

Quota Plans

We need to create a plan. I was trying to create a service and deploy the HANA backend models without creating a Quota Plan and every time I was getting a failure message saying I do not have enough memory defined on my dev space the application which I am trying to deploy. After a lot of research I understand that I need to create a quota plan and assign that quota plan to my dev space.

Plan1 which I had created and assigned that plan to my dev space.

Please see the quota plan assignment which I had done for the dev space created.

 

That’s it. The cloud environment is ready and the applications which you will create on SAP BAS will be deployed successfully on SAP BTP under the dev space which we created above.

Now I was looking for a Business case to build and I was reading lot of blog posts.

I want to give the credit to this blog written by  Pavan Krishna Mulpur, @pkrishna and below the blog comments highlighted by Showkath Ali Naseem , @showkath.naseem

I followed this blog and created the scenario using SAP Cloud application Programming model. This is the best business case I found and decided to perform it.

https://blogs.sap.com/2020/09/24/how-to-create-cds-entities-in-sap-business-application-studio/

Now Customers those who are still using SAP WEB IDE as their application development they must be thinking what is Cloud application Programming now ?

Those customers need not worry on CAP so soon. We Still can create backend entities or models in SAP WEB IDE and we can still expose those models and of course we are exposing these models using a NODE JS module or Fiori Module or a JAVA module in web ide as well.

But when we move to SAP BTP CF and use SAP provided HANA DB as a service and SAP Business application studio as your IDE for application development SAP is suggesting to create backend entities using CAP and deploy your service using CAP.

Having said that we still have flexibility to create our backend models same as web ide and load data into those tables using SAP SDI flowgraphs and can expose those entities using node js module etc.

But SAP is promoting CAP model for sure.

What is CAP? I do not want to explain again here . Those who are not aware of CAP must go through the excellent blog by : – Daniel Hutzel , @daniel.hutzel

https://blogs.sap.com/2018/06/05/introducing-the-new-application-programming-model-for-sap-cloud-platform/

Now coming Back to the point of creating the same business case posted by Pavan Krishna Mulpur, @pkrishna

 

Please see the SAP BAS project screen, Run configuration to deploy the DB deployer and finally the MTAR to deploy the application as a service. Please see the screen one by one below here : –

 

SAP BAS MTAR file to deploy application

U can see the developer tutorial here on how to deploy.

https://developers.sap.com/tutorials/appstudio-cap-deploy-app.html

( You can follow tutorials from Thomas Jung and his Team)

 

 

Before deploying the entities as a service and creating an O DATA service please ensure below commands are successfully executed.

CDS watch : to see CDS entities were successfully created

NPM INSTALL : to Install node manager packages in the DEV space of Business Application Studio.

Once deploy and the deployment is successful you should see something like this in you dev space.

Now when I click on test1-srv you will see the service and data in it. When you click Sales it will generate sales service and when we click on Purchases Service it will generate Purchase Service.

Please ensure that HANA DB instance is up and running.

Please find below snaps one by one.

 

 

 

Now we had exposed our backend entities which are deployed as Table in HANA HDI containers to the outside world or internet.

 

Now we can consume these serviced to SAP CAI.

 

Hope you are with me till now. Let us jump into SAP CAI now.

Which I will explain in Part 2.

 

Part 2 Link

https://blogs.sap.com/2022/08/12/create-a-cds-entity-in-sap-btp-expose-the-entity-as-an-odata-service-to-outside-world-deploy-to-hana-db-and-cf-as-an-application-and-create-a-chatbot-by-consuming-the-api-in-sap-cai-facebook-messe/

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x