Skip to Content
Technical Articles
Author's profile photo Kapil Verma

Adding Data to the Database Entities on BAS for CAPM Full Stack UI5 Development

Welcome to the Fourth Episode of the Series: SAP CAPM Full Stack UI5 Application with CRUD Operations. Till now we have created Development Space in BAS, set up a project structure for development, created entities and exposed the same as Odata services. In this episode, we will be inserting the Data in the created database entity for the project and expose the same.

Assumption(OR Must Have to Start):

  • You have followed our previous episode where we create entities and exposed the same.

Your project structure should look like the below if you carefully followed all our previous episodes.

Step 1: Creating Data

So let’s create a folder in db folder. Right-click on db folder and select New Folder.

Name your folder as data.

Now create a new file in the created data folder.

Name your file as cap_tutorial-SalesOrders.csv. Here cap_tutorial is the namespace – SalesOrders is our entity. It’s a nomenclature that needs to be followed for mapping the data.

cap_tutorial-SalesOrders.csv

Now, it’s time to create actual data. So, in CAPM we use .csv files to create local data. You can easily create them in Excel or Libre or even in Notepad. For now, you can copy-paste it from below.

customerName,PoNumber,customerNumber,orderDate,soNumber,inquiryNumber,totalOrderItems
Adidas,2000000001,3000000001,2021-06-15T19:34:03Z,500009101,30061111,2
Adidas,2000000002,3000000002,2021-06-15T19:34:03Z,500009102,30061111,3
Rebok,2000000003,3000000003,2021-06-15T19:34:03Z,500009103,30061114,2
Adidas,2000000004,3000000004,2021-06-15T19:34:03Z,500009104,30061111,1
Rebok,2000000005,3000000005,2021-06-15T19:34:03Z,500009105,30061113,2
Puma,2000000006,3000000006,021-08-15T15:00:03Z,500009106,30061112,3
Puma,2000000007,3000000007,2021-08-15T15:00:03Z,500009107,30061112,1
Adidas,2000000008,3000000008,2021-08-15T15:00:03Z,500009108,30061115,2

Your final Project Structure should look something like this :

 

Step 2: Exposing the Data

First let’s save everything and then we will proceed.

We will have to do a cds build.

Now let’s do cds watch, this time when we navigate to the Entity SalesOrders. We will be able to see the added data.

Now you can click on Fiori preview.

You will see the below screen, with No Data. No need to worry, just click on Setting Icon.

Choose all the columns for which you want to see the data and click OK.

We can see the Data is populated now in our fiori preview.

Fiori Preview is a fully you can get a feel of the final Integration here. Like we can also use the Filter Feature.

Feel free to drop your comments in the comment section.

In this blog post we have learnt how to add Data in the created database entity for the project and exposed the same.

In the next blog post we will see how to set up a SAPUI5 project for CAP Development in BAS.

Further reading – https://cap.cloud.sap/docs/guides/

Next Episode: Setting up a UI5 Application on BAS for CAPM Full Stack UI5 Development.

 

Assigned Tags

      17 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo AjeethKumar R
      AjeethKumar R

      Thanks for this wonderful blog.

      Author's profile photo Gautam Malla
      Gautam Malla

      Not able to open the app.

      Any idea what could be the reason?error%20in%20app

      error in app

      Author's profile photo Yogaraj Gunasekaran
      Yogaraj Gunasekaran

      Hi Gautam Malla

      Please use the Firefox browser. Instead of Chrome or Edge.

      I am also facing the same issue earlier.

      Author's profile photo Gautam Malla
      Gautam Malla

      Quite strange. Though I'll check that in Firefox but still the question remains there, why it is not working with other browsers. Author can look into this.

      BTW thanks Yogaraj. 🙂

      Author's profile photo Gautam Malla
      Gautam Malla

      Tried in Firefox as well but no luck!

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi,

      I also struck at this point. I have tried in Edge, Chrome & Firefox .

      I am still facing issue in Firefox also.

      Any idea ?

      Thanks,

      Dileep.

      Author's profile photo Yogaraj Gunasekaran
      Yogaraj Gunasekaran

      Hi Kapil Verma

      I am having a issue to get the value in Service Endpoint and Fiori Preview.

      I followed the step from Step 2: Exposing the Data

      1

      cds build completed

      Please let me know if anything to be corrected from my end. I have tried.But I could not able to get the values in Odata Service.

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi,Screen

       

      please change to data . its not datas. you service cds refering data from db/data not db/datas. Thank you.

      I am not able to open Fiori Preview in any browser 🙂

      Screen

      Author's profile photo Yogaraj Gunasekaran
      Yogaraj Gunasekaran

      Hi Dileep Kumar KOSANA ,

      Thank you so much for your response!

      First, I am also facing the same issue. then I deleted the project and create a new project from Firefox then only I can see the Fiori preview in firefox browser.

      please try once from firefox.

      Note: I have faced the same browser issue recently in lot of project.

      Thanks!

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi Yogaraj Gunasekaran ,

      Thank you for the Inputs.

      Thanks,

      Dileep.

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi Yogaraj Gunasekaran ,

      you need change to file name to data-model.cds instead data-models.cds.

      Hope you resolved your issue by now and seeing data in End point & Fiori Preview.

      Thanks,

      Dileep.

      Author's profile photo Yogaraj Gunasekaran
      Yogaraj Gunasekaran

      Hi Dileep,

      Thank you so much!

      Yes, the issue has been resolved. Now I am seeing data in End point & Fiori Preview.

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi Yogaraj,

      Nice.  Long way to go .

      Thanks,

      Dileep.

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi Kapil Verma ,

      Thanks for the wonderful blog series.

      I was able to see data in End point but I am not able to see Fiori Preview .

      Please let us know if anything to be corrected. Thank you.

       

      Thanks,

      Dileep.

      Author's profile photo Gautam Malla
      Gautam Malla

      Same for me. I am not able to open Fiori Preview.

      Author's profile photo Dileep Kumar KOSANA
      Dileep Kumar KOSANA

      Hi Gautam Malla ,

      Any luck ?

      Author's profile photo Gautam Malla
      Gautam Malla

      Unfortunately No.