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: 
liat_b
Employee
Employee
SAP Business Application Studio (aka BAS) is the evolution of SAP Web IDE. It is a modular development environment, built on Eclipse Theia that embraces the VS Code experience.

To learn more about BAS and business application development with the application programming model (aka CAP), checkout the following blogs:

Now that you know almost everything there is to know about BAS, you’re ready to move!

All that is left to do, is to take your code with you 🙂

This blog describes how to migrate CAP Java and CAP Node applications from
SAP Web IDE Full-Stack to BAS, and then how to run them in BAS

Prerequisites



  • In SAP Web IDE, export your application or push your application to Git.

  • Make sure you have access to BAS.

  • To run your application with SAP HANA database, you need an SAP HANA service in your Cloud Foundry space.


Create your SAP Cloud Business Application developer dev space



  1. Open BAS.

  2. Click Create Dev Space.

  3. Choose a name for your dev space.

  4. Choose SAP Cloud Business Application as the application type.

  5. Click Create Dev Space.



Create dev space


 

Import your application



  • If you pushed your application to Git:

    1. Clone your repository using git clone from the terminal or from the command palette.

    2. Open a new workspace and select your cloned application as the root of your workspace.



  • If you exported your application:

    1. Create a new folder under your projects folder and give it the name of your application.

    2. Open a new workspace and select your new folder as the root for your workspace.

    3. Extract the application you exported and drag all the files (without the root folder) to the file explorer.




Delete SAP Web IDE configuration files


Your application may contain SAP Web IDE configuration files that reside in several `.che` folders. You can delete all the `.che` folders from your application.

Adjust you project for building with the Cloud MTA Build Tool


If you haven't migrated your application to use the new Cloud MTA Build tool, you must do so now, as the old build tool is deprecated.

First, you need to adjust your project according to these guidelines. Then, configure the module build order so that the module generating *hdbcds files, for example the srv module, is built before modules that consume this output, for example the db module. For that, you need to set the requires build parameter as follows:
- name: db
...
build-parameters:
requires:
- name: srv

Alternatively, you can define a before-all global build in the `mta.yaml` file to trigger the cds build in advance, as follows:
build-parameters:

before-all:

- builder: custom

commands:

- npm install

- cds build/all

 

Migrate to the latest CAP Java version


If you’re migrating a CAP Java application, I highly recommend migrating your application to the latest CAP Java version available.

Follow this guide for migration instructions, before continuing to the next step.

If you still want to run your CAP Java application without migrating it, this is possible. Nevertheless, this blog doesn’t cover this scenario.

Running your Application


Supported SAP HANA versions


SAP Business Application Studio supports the option to run a CAP application out-of-the-box with the following SAP HANA versions:

  • SAP HaaS (should be configured as 'open to all IPs').

  • SAP HANA Cloud (should be configured as 'open to all IPs').


If you run your application with a PSA-based SAP HANA which is not publicly available (not accessible from connectivity perspective outside of Cloud Foundry), you'll need to use Chisel to connect to it, as explained in the next steps.

Running your CAP JAVA application


1.Bind and deploy your application to an SAP HANA service.

  • If your SAP HANA instance is publicly available, run:
    cds deploy –to hana:<instance-name>​




  • If your SAP HANA instance is not publicly available: 


Open a chisel-secured tunnel to connect to the app from BAS:

  • Open the command palette and type CF.

  • Choose CF: Bind a service to a locally run application.

  • Choose the root folder of your application and click ‘Select folder for .env file’

  • Choose the service with which you wish your application to run.
    An environment (`.env`) file is created in your root folder.

  • In the terminal run the following commands:


cd ~/projects/<application-root-folder>
. /extbin/bin/setenv.sh .env1;
chisel client --auth $CHISEL_USER:$CHISEL_PASSWORD $CHISEL_URL
$TUNNEL_PARAM

You should see the chisel tunnel is connected.


The chisel tunnel should be connected for all actions that require connectivity to your SAP HANA instance ( deploy, run…)

  • In a new terminal run
    cds deploy db --to hana:<instance-name> --tunnel-address 0.0.0.0:30041​



2. If your application has additional dependencies to Cloud Foundry services, see the documentation to learn how to bind them to your application. (In the future, we plan to offer tools to simplify this process for the developer.)

3. To build and run your application, in the terminal, run:
mvn spring-boot:run

4. Open your application in the browser when you're prompted to do so.

SAP Business Application Studio also supports the use of a local database SQLite as your application database. You can consider using it instead of SAP HANA to test your application. See Using Databases

 

Running your CAP Node application


1.Install dependencies:

Open a new terminal and change directory to the application's root directory.

Run the following commands:
npm install
cds build​

Change directory to the db folder and run the following command:
npm install

 

2. Open the Run Configurations tool from the side panel of SAP Business Application Studio.
Click the Create Configuration icon (plus sign) and select the root of your application.



3. Bind the database dependency presented in the run configuration under the application node to an SAP HANA service (hana) by clicking the Bind button and selecting the service with which you want the application to run.




 

4. The bind action creates a task for deploying the data model.

If your SAP HANA instance is publicly available, you will be prompted to deploy your data model.

Click Yes.


If your SAP HANA instance is not publicly available:

You need to open a secure tunnel to deploy the application data model to the database, and run the deploy task yourself.


To open a tunnel, run the task that was created for you automatically when you bound your application to the SAP HANA service.

Choose Run task from the Terminal.
The name of the task follows the format OpenChiselTunnelFor-<serviceName>

To deploy the data model, run the task that was created for you automatically when you bound your application to the SAP HANA service.

Choose Run task from the Terminal menu.

The name of the task follows the format cds-deploy-to-hana-<appName>-<sericeName>

5. You can bind additional services your application depends on via the run configuration tool by clicking the Bind button on each of the dependencies. However, since your application will run locally in BAS, you may not need to bind to all services at this stage. This depends on your specific implementation.

Click Run to start the service. The icon appears when you hover over the run configuration.


You should see the service starting in the Debug Console after all the prelaunch tasks have been run.

Open your application in the browser when you're prompted to do so.

Running with local data base


SAP Business Application Studio also supports the use of a local database SQLite as your application database. You can consider using it instead of SAP HANA to test your application. See Using Databases

Running with XSUAA


You can run your CAP application locally and bind it to an XSUAA instance. However, at this stage, you cannot use the Run Configurations tool to run your CAP application via Approuter.

Refer to CAP documentation to learn how to handle authentication and authorization of your application without Approuter.

Enhancing and deploying your application


Once your application has been migrated to BAS, you can continue with your development and eventually deploy your application to Cloud Foundry. See the following resources to learn more:

I hope this guide has been useful and that you’re already on the way to improving your development experience with BAS!

 

Happy coding 🙂

 

 

 
4 Comments