Prepare SAP Build Work Zone, Standard Edition Setup
- How to add navigation targets and prepare your UI applications
- How to add SAP Cloud service
- How to add the Destination Service and destinations
Prerequisites
- Step 1
In this tutorial, you will use the SAP Build Work Zone, standard edition to access your CAP service and its UI. Additionally, the SAP Build Work Zone, standard edition provides features like personalization, role-based visibility, theming, and more. You can add multiple applications to one launchpad, including subscribed ones and applications from SAP S/4HANA or SAP BTP.
Navigation targets are required to navigate between applications, but also to start the applications from SAP Build Work Zone, standard edition. In the next steps, you add the navigation targets
Risks-display
andMitigations-display
to the application manifest (manifest.json
) file.Log in to complete tutorial - Step 2
Open the file
app/risks/webapp/manifest.json
.Add the external navigation target to the
sap.app
JSON object. You can add it right behind thesourceTemplate
object:
JSONCopy{ ... "sap.app": { "id": "ns.risks", ... "sourceTemplate": { ... }, "crossNavigation": { "inbounds": { "Risks-display": { "signature": { "parameters": {}, "additionalParameters": "allowed" }, "semanticObject": "Risks", "action": "display" } } } } }
- Step 3
Do the same with the mitigations manifest file
app/mitigations/webapp/manifest.json
, but with thesemanticObject
nameMitigations
.JSONCopy{ ... "sap.app": { "id": "ns.mitigations", ... "dataSources": { ... }, "crossNavigation": { "inbounds": { "Mitigations-display": { "signature": { "parameters": {}, "additionalParameters": "allowed" }, "semanticObject": "Mitigations", "action": "display" } } } } }
Log in to complete tutorial - Step 4
Add your SAP Cloud service at the end of
app/risks/webapp/manifest.json
andapp/mitigations/webapp/manifest.json
files:JSONCopy{ "_version": "", ... "sap.fiori": { ... }, "sap.cloud": { "public": true, "service": "cpapp.service" } }
The name of your SAP Cloud service (
cpapp
in this case) should be unique within an SAP BTP region. It is used to identify the resources that belong to one UI in the SAP Build Work Zone, standard edition.Log in to complete tutorial - Step 5
Add the following lines to the
resources
section of themta.yaml
file:YAMLCopyresources: ... - name: cpapp-destination type: org.cloudfoundry.managed-service parameters: service: destination service-plan: lite config: HTML5Runtime_enabled: true
The SAP Destination service stores URLs and credentials (so called “destinations”) to access applications and services.
The service configuration option
HTML5Runtime_enabled: true
is required to make the destinations available to the SAP Build Work Zone, standard edition.Log in to complete tutorial - Step 6
Add the following lines to the
resources
section of themta.yaml
file:YAMLCopyresources: ... - name: cpapp-html5-repo-host type: org.cloudfoundry.managed-service parameters: service: html5-apps-repo service-plan: app-host
The SAP HTML5 Application Repository service stores static UI files. In the deployment, the SAP Fiori UI applications are uploaded to this service and the SAP Build Work Zone, standard edition serves the UIs from there.
Log in to complete tutorial - Step 7
You add three destinations for the SAP Destination service that are used by the SAP Build Work Zone, standard edition:
cpapp-app-srv
- The destination to the CAP service. It is required by your UIs running in SAP Build Work Zone, standard edition to access your service.cpapp-html5-repo-host
- The destination to your SAP HTML5 Application Repository service instance. It allows the SAP Build Work Zone, standard edition to access your UI applications.cpapp-uaa
- The destination to your XSUAA service instance. The SAP Build Work Zone, standard edition needs it to convert OAuth tokens for use with your CAP service.
Add the following lines to the
modules
section of themta.yaml
file:YAMLCopymodules: ... - name: cpapp-destinations type: com.sap.application.content requires: - name: cpapp-uaa parameters: service-key: name: cpapp-uaa-key - name: cpapp-html5-repo-host parameters: service-key: name: cpapp-html5-repo-host-key - name: srv-api - name: cpapp-destination parameters: content-target: true parameters: content: instance: destinations: - Authentication: OAuth2UserTokenExchange Name: cpapp-app-srv TokenServiceInstanceName: cpapp-uaa TokenServiceKeyName: cpapp-uaa-key URL: '~{srv-api/srv-url}' sap.cloud.service: cpapp.service - Name: cpapp-html5-repo-host ServiceInstanceName: cpapp-html5-repo-host ServiceKeyName: cpapp-html5-repo-host-key sap.cloud.service: cpapp.service - Authentication: OAuth2UserTokenExchange Name: cpapp-uaa ServiceInstanceName: cpapp-uaa ServiceKeyName: cpapp-uaa-key sap.cloud.service: cpapp.service existing_destinations_policy: update build-parameters: no-source: true
What happens now? The
cpapp-app-srv
destination uses the URL exported from thecpapp-srv
module. Besides exporting the CAP service’s URL assrv-url
property, the XSUAA service instance that is required for authentication and authorization checks is added here.YAMLCopymodules: ... provides: - name: srv-api # required by consumers of CAP services (for example, approuter) properties: srv-url: ${default-url} # -------------------- SIDECAR MODULE ------------------------
Log in to complete tutorial - Step 8
-
Install SAPUI5 tooling package as global module in the root folder of your project:
Shell/BashCopynpm install --global @sap/ux-ui5-tooling
-
Install SAP Fiori application generator package as global module:
Shell/BashCopynpm install --global @sap/generator-fiori
-
Install MTA package as global module:
Shell/BashCopynpm install --global mta
Log in to complete tutorial -
- Step 9
Switch to
app/risks
folder:Shell/BashCopycd app/risks
Add deployment configuration:
Shell/BashCopyfiori add deploy-config cf
If the SAP Fiori generator fails, make sure to remove other
.yo-rc.json
files you might have in any of your project’s directories and try again.It will ask for the destination name.
Enter
cpapp-app-srv
for the destination name.
Log in to complete tutorial - Step 10
Repeat the procedure from the previous step for the
app/mitigation
folder.Switch to
app/mitigations
folder:Shell/BashCopycd ../../app/mitigations
Add deployment configuration:
Shell/BashCopyfiori add deploy-config cf
It will ask for the destination name.
Enter
cpapp-app-srv
for the destination name again.
Log in to complete tutorial - Step 11
The newly added modules
nsrisks
andnsmitigations
do the build of the SAP Fiori application. Each build result is a ZIP file that contains optimized UI resources and a ZIP filemanifest-bundle.zip
with themanifest.json
and thei18n
files. The latter is required by the SAP Build Work Zone, standard edition.Check the
risks
application modulensrisks
:YAMLCopymodules: ... - name: nsrisks type: html5 path: app/risks build-parameters: build-result: dist builder: custom commands: - npm install - npm run build:cf supported-platforms: []
Check the
mitigations
application modulensmitigations
:YAMLCopymodules: ... - name: nsmitigations type: html5 path: app/mitigations build-parameters: build-result: dist builder: custom commands: - npm install - npm run build:cf supported-platforms: []
Check the HTML5 application deployer.
The module
cpapp-app-content
deploys the ZIP files from thensrisks.zip
andnsmitigations.zip
to the SAP HTML5 Application Repository service, where it can be accessed by the SAP Build Work Zone, standard edition using the previously added destinations.YAMLCopymodules: ... - name: cpapp-app-content type: com.sap.application.content path: . requires: - name: cpapp-html5-repo-host parameters: content-target: true build-parameters: build-result: resources requires: - artifacts: - nsrisks.zip name: nsrisks target-path: resources/ - artifacts: - nsmitigations.zip name: nsmitigations target-path: resources/
Log in to complete tutorial - Step 12
The SAP Fiori build files do not need to be stored in GitHub. You can add it to your
.gitignore
file:gitignoreCopydist/ resources/ app/*/package-lock.json
Can’t see
.gitignore
?.gitignore
files are excluded by default from the file types shown in the VS Code workspace. In VS Code, go to File (for macOS: Code) → Preferences → Settings, search forfileexclude
, and delete the setting for.gitignore
files under the Workspace tab.Log in to complete tutorial - Step 13
-
Build your project with the MTA Build Tool (MBT) in the root folder of your project:
Shell/BashCopymbt build -t ./
-
Deploy your project to SAP BTP:
Shell/BashCopycf deploy cpapp_1.0.0.mtar
Your SAP HANA Cloud instance will be automatically stopped overnight, according to the server region time zone. That means you need to restart your instance every day before you start working with it.
Additional Documentation:
-
Go to SAP BTP Cockpit to check the deployed content.
Log in to complete tutorial -
- Prepapre UI applications
- Add navigation target for Risks UI
- Add navigation target for Mitigations UI
- Add SAP Cloud service
- Add the SAP Destination service
- Add SAP HTML5 Application Repository service
- Add destinations
- Install required UI tools and MTA
- Add deployment configuration for the SAP Fiori elements Risks application
- Add deployment configuration for the SAPUI5 freestyle Mitigations application
- Check the results in mta.yaml
- Add UI build files to .gitignore
- Re-build and re-deploy the .mtar file