skip to Main Content

Deploying a Cloud Application Programming Project with VS Code vs. BAS

Deploying a CAPM Application through the SAP Business Application Studio (BAS) and VS Code is a very simple process if you follow all the steps carefully. In my previous blog, I took you through the creation of a CAPM project through VS Code and BAS. Today, in continuation of the series, I will talk about the deployment process and how to push the code to the repository.

To begin with, let’s see how you would deploy the application into the HANA database through BAS.

Start with the following commands in BAS

  1.   cds add hana–> (This configures deployment for SAP HANA to use the hdbtable and hdbview formats)
  2.   cf login  —> (here, you will need to login to the cloud foundry with your credentials)
  3. cf create-service hana hdi-shared (Project name-db) —> (This, creates the service in CF)

4 ) cf services (we can now check whether the services have been created or not)

5)  cds build –production → build the application (after the successful build, the project structure gen-folder will be created)

6)  cf push -f gen/db—> (this pushes the db-folder into cloud-foundry)

7)  cf push -f gen/srv –random-route —> (this pushes the SRV-folder into cloud-foundry)

Below, is an example of an application deployed on SAP HANA Cloud;

Now, let’s look at how we can deploy the application into the HANA Database through BAS:

Here, we have 2 deployment options through BAS 


1)  With MTAR

When we create CAPM Project through a template, it will have all the dependency files:

 

Once the project is created, you will need to follow the steps listed below;

Step 1: 

Use command ‘Mbt build’
Then it will generate the mta_archives folder like below

Once the MTAR file is generated, right-click on it and select the ‘Deploy MTA Archive’ option from the menu. Now, enter the CF details to deploy the MTAR file to the CF.

2) Without MTAR

Now, let us see how it would work without generating the MTAR
For this, you would need to use the following command in BAS;

  1.   cds add hana–> (This configures deployment for SAP HANA to use the hdbtable and hdbview formats)
  2.   cf login  —> (Need to log in the cloud Foundry)
  3. cf create-service hana hdi-shared (Project name-DB) —> (Creating the service in CF)
  4. cf services
  5. cds build –production → Build the application (after the successful build, in project structure gen-folder will be created)
  6. cf push -f gen/db —> (pushing the db-folder into cloud-foundry)
  7. cf push -f gen/srv –random-route —> (pushing the SRV-folder into cloud-foundry)

The Application would be deployed in SAP HANA Cloud in the following manner;

A)  If you needed to push code to GIT through BAS, you would need to;
1. Create the GIT repository
2. Open BAS home page click on view — > Find command

3) Find out the GIT clone. 

Then you can enter the GIT repository url and click on enter so the clone is completed.

Now, let’s create a project like cds within it.

Once the project is created, save all files. Enter the command ‘GIT push’ to push the code out.

At this point, it should look like the example below;

B) Now let us take a look at how to push code to GIT through VS Code

  1. Create a repository
  2.  Then login to the GIT account via VS Code:

Once the GIT account login is completed, we can follow the same steps we did to push the code to GIT through the BAS module. 

Personally, I prefer working on BAS. In my experience, BAS is a far simpler tool. Its in-built libraries make it particularly user-friendly. VS Code regrettably, doesn’t offer this feature.

Navaneetha Nalamada comes with 7 years of experience in SAP front-end development. Her strong knowledge in SAP Fiori has led her to many successful projects & learnings. At Mindset Consulting India, she heads the team as a Sr Developer. You can find Navneetha succinct about her path in the SAP ecosystem as she has a flair for learning new things at SAP. At her leisure, you can find her listening to music of sorts.

Back To Top