Projects and Workspaces in SAP Business Application Studio
In my previous blog post I talked about the dev spaces concept in SAP Business Application Studio. Today I would like to take a closer look at the content within a dev spaces focusing on the workspace and the project entities and compare them with the ones we have in SAP Web IDE.
I provided some best practice recommendations at the end of the blog. You can jump right to it or read on to learn more about the reasons for these guidelines.
In SAP Business Application Studio every dev space is generated with the typical linux folder structure. For standard development, the root folder one should use is /home/user/projects. The ‘projects’ folder is where you should place all your development projects. Unlike SAP Web IDE where projects were organized in a flat list within the workspace, in SAP Business Application Studio you can organize your projects in any folder hierarchy that fits your needs (all under the ‘projects’ folder). Furthermore, the project entity in SAP Business Application Studio is not as prominent as in SAP Web IDE. In SAP Business Application Studio, a project is just a folder with some content. This flexibility opens up to variety of new development scenarios beyond the types that were supported in SAP Web IDE (SAP Fiori for ABAP and MTA projects only). You can create other project types like native java and node.js (non-MTA) or other technologies, but on the other hand, such flexibility transfers some of the responsibility of keeping the integrity of a project to the developer.
Following this line of flexibility and aligned with other modern IDEs, there is no one descriptor (like the .che in SAP Web IDE) that strictly defines the content and boundaries of a project. In MTA based applications the mta.yaml file continues to play a central descriptor role. However, you can start development without it and add it in a later stage of the project as it is done in CAP (Cloud Application Programming model) applications.
Now let’s look at the workspace concept. A workspace in SAP Business Application Studio is basically your current working root directory containing settings, debug configuration and task configuration, all specific for the content of the workspace root folder.
In SAP Web IDE workspaces had a prominent status, they were containers for a set of projects, extensions and settings. In SAP Business Application Studio a workspace represents the focus of your current development and you can have multiple workspaces each typically tailored for a specific project.
As best practice I would recommend opening the workspace on the root folder of the project you would like to work on. This way you can have project-specific debug, tasks and workspace settings which will be stored in the “.vscode” folder under the project root folder.
Another point is that you can save the “.vscode” or individual files to your Git repo for sharing settings, launch configurations or tasks (but make sure no credentials are included in those files).
Git is another aspect to consider. When opening the project as your workspace root the entire workspace becomes the Git project. This provides a better understanding of what is under the source control, and it is also easier to use the Git pane.
You can find more reasons for this best practice in our documentation
If you want to work on more than one project (e.g. to copy some files from one to the other), you can add additional folders to your workspace. Simply press the three dots in the EXPLORER veiw (‘More Actions’) and select ‘Add Folder to Workspace’. In this case, you will end up with a ‘multi-root workspace’. In multi-root workspaces settings can still be stored under each of the root folders, so you can have project-specific settings.
To store workspace-specific settings you can save them to a file. Then, the workspace name will be changed from UNTITLED to the file name. In case of multi-root workspace the multi-root definitions will also be stored in that file. This way, you can always have the same view and there is no need to open one folder and then add one.
To sum up the best practice
- Use the right dev space type for your development task and distribute your projects in the various dev spaces accordingly. You can have up to 10 different dev spaces
- The storage of each dev space is limited to 6GB. Distribute your projects in additional dev spaces if you require more than that
- Organize your projects using a folder structure as you would in your local desktop.
- When working on a specific project, open the workspace on the root folder of that project
- Refrain from working with the ‘projects’ folder as your workspace root folder. Using the ‘projects’ folder as workspace root folder will result with having the settings of all the projects residing in the same files. This will probably get messy over time as the number of projects grows.
- If you want to work with more than one project in hand, use a multi-root workspace
I hope you now have better understanding of the Project and Workspace concepts in SAP Business Application Studio and can make better use of our new development environment.
You can find more information in the relevant section of the SAP Business Application Studio Documentation.