SAP Business Application Studio Multitarget Application (MTA) development toolkit
Welcome to SAP Business Application Studio, the cloud environment for efficient development of business applications such as SAP Fiori, Applications for SAP Cloud Platform Mobile Services, full-stack business applications, SAP S4 HANA extensions, and modeling workflows!
You can find more information about the service in these blogs:
To simplify your development process, SAP Business Application Studio provides dev spaces with tailored tools and pre-installed runtimes per development scenario.
In this blog, I will present a set of scenario-agnostic tools for developing full-stack applications based on the multitarget application (MTA) model. Using these tools, you can create, extend, test, and finally deploy your application to the SAP Cloud Platform, Cloud Foundry environment.
If you are not yet familiar with the multitarget application concepts, I recommend you read this guide to learn about the topic.
Usually, your work on an MTA project includes the following steps:
- Create a project
- Add modules
- Add resources or modify existing modules and resources
- Test modules
- Package (aka Build)
Now let’s look at the tools supporting these steps in SAP Business Application Studio (BAS). I will tell you about the tools that are already available and about the planned enhancements.
Dev spaces for SAP Fiori and SAP Cloud Business Application, for example, include this extension by default. If you select other dev space types, you can enable the MTA extension from the Additional SAP Extensions list.
For more information about SAP Business Application Studio dev spaces, have a look at this blog.
How to create an MTA project
The recommended way to create a new project is using the Application Wizard which you can trigger from the command palette (F1 -> SAP Business Application Studio: Create Project from Template) or from the Welcome screen (by selecting the New project from template option).
In the wizard, you can select either the Basic Multitarget Application template or a template for your development scenario.
The Basic Multitarget Application template will generate a project folder and the MTA descriptor file with initial content. Then you can populate it with modules as described in the section below.
For the scenario templates, you should check the template’s documentation to make sure it generates a project for the SAP Cloud Platform, Cloud Foundry environment. In this case, the template generates a project with the MTA structure (for example, SAP Fiori Freestyle Project), or there is a way to convert the generated project into MTA at a later stage (for example, CAP Project).
You can also use Yeoman generators to create a new project from a terminal. For that, type the ‘yo’ command in the terminal and select a generator from the list.
How to add modules
If you created a project using a business scenario template/generator, your project already contains modules relevant to the selected scenario.
You can add more modules by running Yeoman generators from a terminal or by using one of the followings wizards:
- “Yeoman UI Generators”. You can open the wizard from the command palette (F1→Yeoman UI Generators). It presents all the generators available in your dev space and you should check the generator’s documentation to learn if it adds an MTA module.
- “New MTA Module From Template”. It can be open from the mta.yaml file context menu or from the command palette (F1→Create MTA Module From Template). This wizard filters the existing generators and presents only those that create MTA modules.
How to add new resources or to adjust properties and parameters of existing modules and resources
If you need to add new resources or adjust the properties or parameters generated by the templates, you should edit the ‘mta.yaml’ file.
You can do it by using one of the following editors:
- Code editor. To open the code editor, double-click on the desired mta.yaml file or right-click the file and choose . This editor provides you with basic code completion triggered by cntl+space buttons and automatic syntax validation capabilities.
- MTA editor. This is a visual editor that allows you to edit the MTA descriptor using tables and forms instead of the text-based code editor. This editor allows you to easily navigate between the objects in the ‘mta.yaml’ file and helps you avoid dealing with the complex and sensitive syntax of YAML files. To open the MTA editor, right-click the ‘mta.yaml’ file and choose .
Also, to make the process of adding resources simpler, we will provide snippets for different resources that can be added using a dedicated tool that we are currently developing.
How to test MTA modules
Business Application Studio allows you to test some of the supported module types using the Run Configurations feature. This feature is used to run your modules locally, i.e. in your dev space. This is the easiest and fastest way to test your modules.
If Business Application Studio does not provide a default Run Configuration option for a specific module type yet or if you would like to test the module in the target Cloud Foundry environment, you can use commands of Cloud MTA Build Tool and MultiApps CF CLI Plugin for partial build and deployment in the BAS terminal. Using these capabilities, you can prepare specific modules for deployment and then deploy them. You can find more details in this repository.
How to prepare an MTA project for deployment to the Cloud Foundry environment
To deploy your application to the target Cloud Foundry environment, you first need to build it to create an MTA archive file (MTAR).
You can trigger an MTA build from the ‘mta.yaml’ file context menu or using the Build MTA command from the command palette. These options activate a default Cloud MTA Build Tool command: “mbt build”. For more details about the default behavior, see the user guide.
If you are not satisfied with the default behavior of the MTA Build menu/command palette options, you can trigger the Cloud MTA Build Tool commands in the terminal according to your needs.
How to deploy an MTA project to the Cloud Foundry environment
Finally, you deploy the mtar file generated during the MTA build step into the target Cloud Foundry space. There are several options to trigger the deployment process:
- Using the Deploy MTA option in the context menu of the MTAR file
- Using the Deploy MTA command in the Command Palette
- Using commands of the MultiApps CF CLI Plugin in the terminal. This option allows you to pass additional parameters to the Deploy command. Use it if the default behavior of the options above is not enough and you need more control over the process.
For more details on these options, see the user guide.
In the future, we will provide a new tool to simplify the deployment tasks. It will also support the deployment of MTA projects and provide an easy way to configure this step, for example, it will automatically trigger an MTA build before deployment or use non-default deploy commands.
This is it. I hope that after reading this blog you find developing full-stack applications based on the MTA model in SAP Business Application Studio much easier.