For the past year I’ve been using the method I will describe in this blog to build .mtar files for Fiori applications so we can deploy them as solutions into customers sub-accounts in the SCP Neo environment. I saw recently this blog here from Wouter Lemaire where he explains an approach to deploy an app creating an MTA application in WebIde and then adding the Fiori app as an HTML5 module. This method works, however I find it easier to use the method I will show you now and that way you can chose which one to use depending on your scenario.
As you know, if you want to move applications between sub-accounts (emulating how transports work in SAP NW) you need to package your application first. Then you can chose whether you use CTS+ to move them from your DEV sub-account to the QA and PROD sub-accounts, or whether you deploy them by hand directly from the SCP cockpit. Which ever method you chose, the .mtar file resulting from this method will work just fine.
Here are the steps:
- Open the project folder of your custom or enhanced application.
- Create a folder. I like calling it “mta” to keep it consistent across my projects. This step is optional, but if you are using WebIde Fullstack I strongly suggest creating the folder because the WebIde developers including some logic that tries to convert your application from “sap.web” to “sap.mta” and then next time your tried to build it will ask you for a Cloud Foundry endpoint and won’t build. So if you want to avoid the headaches of dealing with a corrupted project, put your mta.yaml in a folder.
- Create a file called “mta.yaml”
- Open the “mta.yaml” file in the code editor and enter the following:
_schema-version: '2.1' parameters: hcp-deployer-version: '1.1.0' ID: <unique_id> version: 1.0 modules: - name: <app_id> type: com.sap.hcp.html5 path: ../dist parameters: name: <app_name> version: <app_version> active: true display-name: <app_display_name> destinations: - name: <destination_name> type: HTTP
Here is how to fill out the values in the <> placeholders:
- <unique_id>: can be anything as long as is unique for your sub-account. I like using the application id; the same you find in your manifest.json under “sap.app”.
- <app_id>: this is the app id, found in the manifest.json under “sap.app”.
- <app_name>: is the same name you used for when you deployed the app to SCP cloud platform. It doesn’t need to be the same, but I suggest making it match so your DEV sub-account matches your other ones.
- <app_version>: the version number. I suggest as making it match to the version of your manifest.json
- <app_display_name>: this can be anything, I just put the same value as the <app_name>
- <destination_name>: this also can be anything, but unless you want to have to remap the destinations for every app you deploy I’d suggest making it match the name of the destination(s) you have configured in cloud platform.
Here is an example of how it should look like:
_schema-version: '2.1' parameters: hcp-deployer-version: '1.1.0' ID: com.test.demo version: 1.0 modules: - name: com.test.demo type: com.sap.hcp.html5 path: ../dist parameters: name: demo version: '1.0.1' active: true display-name: demo destinations: - name: S4HANA1709 type: HTTP
For a reference of what parameters you can use for your mta.yaml file check the link below:
- Export your project and extract the .zip file. I like doing it in the same folder where I keep the mta builder Java application which you can download here.
- Run the following command in a terminal. Make sure you are in the folder where your mta.yaml file is located.
java -jar <path to your .jar> --build-target=NEO build
There result looks like this
- Retrieve your .mtar file and done !
As you can see, this method is a bit more straight forward than having to create an MTA application and then adding an HTML5 module. So now you have an alternative to creating the .mtar files to move applications between sub-accounts. I hope that you find this useful.