Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
munishsuri
Participant
In the new era of cloud , where we are moving towards Cloud Foundry environment , a next generation development environment is also required catering to the needs of developer.

Hence SAP Business Application Studio.

What is it ????

SAP Business Application Studio is a next generation, tailor made development environment available as a service on SAP Cloud Foundry which offers a modular development for business application for SAP Intelligent Enterprise.

Here developers can utilize more than 1 development space which are isolated from each other and let you run the application without deploying on Cloud Platform using its powerful terminal

 

CAP - SAP Cloud Application Programming Model

it is an open and opinionated model , which provides framework of libraries , languages and tools for the development of enterprise grade applications . It provides some best practices and guides developer with out of the box solutions for some common problems.

view more

 

So lets get started 

Prerequisite

  1. SAP Cloud Platform Account (Foundry ) - Data center available  

  2. Subscribed to SAP Business Application Studio

  3. Relevant Roles for accessing the service - Authorization Management

  4. SAP HANA Service hdi-shared


 

After Accessing the application

Create a Dev Space

Step 1 : Click on Create Dev Space



 

Step 2: Create Dev Space - Enter Name and Select SAP Cloud Business Application as a category



 

Start Developing

  1. Open new terminal


 

2. type cd projects , to change the directly.

3.  setting up the project
mvn -B archetype:generate -DarchetypeArtifactId=cds-services-archetype -DarchetypeGroupId=com.sap.cds \
-DarchetypeVersion=1.2.0 -DcdsVersion=3.21.2 \
-DgroupId=com.sap.teched.cap -DartifactId=products-service -Dpackage=com.sap.teched.cap.productsservice

 

Open your project in the Studio



 

 

 

Lets Make CDS files

  1. Navigate to db , create a file schema.cds
    namespace sap.capire.dev;



    entity Products {
    title : localized String(20);
    descr : localized String(100);
    stock : Integer;
    price : Decimal(9,2);
    key id :Integer;

    }


  2. Navigate to srv , create a file service.cds
    using { sap.capire.dev as db } from '../db/schema';

    service AdminService {
    entity Products as projection on db.Products;
    }​


  3. From terminal navigate to cd product-service using terminal.

  4. type mvn clean install - to compile the project using terminal .

  5. Now go to srv -> src -> main -> resources and open application.yaml and replace the content
    ---
    spring:
    profiles: default
    datasource:
    url: "jdbc:sqlite:/home/user/projects/products-service/sqlite.db"
    driver-class-name: org.sqlite.JDBC
    initialization-mode: never​


  6. installing SAP HANA DB deployer
    npm install --save-dev --save-exact @sap/hdi-deploy@3.7.0​


  7. login into CF account - using terminal type cf login and select the space

  8. initialize DB and create SAP HANA Service instance - please make sure , you have the entitlement using terminal type , kindly type it manually
    cds deploy --to hana:bookstore-hana​


  9. Go to srv->pom.xml and add the dependency
    <dependency>
    <groupId>com.sap.cds</groupId>
    <artifactId>cds-feature-hana</artifactId>
    </dependency>​


  10. Time to run the application in the terminal
    mvn spring-boot:run -Dspring-boot.run.profiles=cloud​

     

     

  11. Click on Expose and Open on the left Bottom and press Enter

  12. Go Back to Application Studio and open new terminal

  13. Test the service with POST call
    curl -X POST http://localhost:8080/odata/v4/AdminService/Products \
    -H "Content-Type: application/json" \
    -d '{ "title": "Product 1", "descr":"sample product ","stock":20,"price":100.60,"id":1 }'


  14. Now Lets check the service from step 11 , open Products and you shall be able to view the saved data


 

After successfully following these steps , you would be able to complete the setting up of SAP Business Application Studio on SAP Cloud Platform (Foundry) , creating an application using CAP , connecting it to SAP HANA Service and performing POST , GET operation on your ODATA service.

 

These are the screenshots taken from our SAP Cloud Platform account.
17 Comments