The ESPM (Enterprise Sales & Procurement Model) application is a reference application which demonstrates how to build applications on SAP Business Technology Platform (BTP) with the Java runtime. This version of the ESPM application(cloud-espm-multi-environment) showcases how to adapt a ESPM application developed to run on SAP BTP Neo Environment to run on SAP BTP Cloud Foundry (CF) Environment as well. The adapted application has one code-base for running on both Neo and CF environment.
The business scenario is that of an eCommerce application that sells electronics products.
ESPM application has 2 underlying applications
For Setting up the development environment, refer to the quick start guide
A maven build of the application generates a separate war
file for the Neo
and CF
environment.
Note: Follow the below steps before the maven build to download the ngdbc driver to your local ~.m2 repository, as its not available in central maven repository
Download the SAP Business Technology Platform SDK from https://tools.hana.ondemand.com/#cloud
Take the latest version of "Java Web Tomcat 8" (neo-java-web-sdk-3.70.9.3 or higher) from the download section.
Unzip the archive to an arbitrary location on your laptop/desktop.
Extract the JDBC driver (ngdbc.jar) from the archive (you will find the driver in the archive under: repository/.archive/lib/ngdbc.jar). The driver is closed source, so it is NOT available from public Maven repositories!
Put the driver to your local maven repository with maven command
mvn install:install-file -Dfile=<path-to-file> -DgroupId=com.sap.db.jdbc
-DartifactId=ngdbc -Dversion=2.0.13 -Dpackaging=jar
From the root directory (i.e. cloud-espm-multi-environment), run the following Maven command
mvn clean install
This command builds the application and generates war
for the Neo
and CF
environment.
The war
file for the NEO environment can be found at neo/espm-cloud-web-neo/target/espm-cloud-web-neo.war
.
Open the hanatrial account cockpit and upload the war file as follows.
Go to SAP BTP Cockpit --> Click on Java Application under Applications --> Click on Deploy Application
Add War File Location, Give Application Name "espm", select Runtime Name "Java Web Tomcat 8" and JVM Version as "JRE 8"
After Successful deployment, Click on Start
Configure the application role assignments from the cockpit. You basically need to add the "Retailer" role to your SAP Business Technology Platform user to access the Retailer UI
You can access the application from the URL
Note! The application name must be "espm", else the above URL will change based on the application name given during deployment
Below is the process to bind the database to the java application in BTP trial account using a Shared HANA database
In the cockpit, select an account and choose Persistence -> Databases & Schemas -> in the navigation area.
Click on the new button
In the popup window, enter the below information
Schema ID: espm
Database System: HANA (<shared>)
Version: 1.00*
Click on Save button
In the cockpit, select an account and choose Applications -> Java Application -> Click on the name of the espm application that you deployed
In the navigation area in the cockpit, select Configuration -> Data Source Bindings
Click "New Binding" button in detail plane
In the popup window, enter the below information
Data Source - <default>
DB/Schema ID - select espm (the one that you created above)
Click on Save button
Now you need to restart espm application (stop, if already running and start the application) from the cockpit.
From root folder, navigate to cf
folder.
cf api <api>
cf login -o <org> -s <space>
Depending on the requirement, create a service instance for either of the database (HANA or PostgreSQL).
cf create-service hana schema espm-hana (HANA)
or
cf create-service postgresql v9.4-dev espm-postgres (PostgreSQL)
Create service instance for the XSUAA
cf cs xsuaa application espm-uaa -c xs-security.json
Open the manifest.yml file and edit the following
Replace I/D/C numbers
so that the application name and host name is unique in the CF landscape.
DATABASE_TYPE: <DB name>
Replace the <DB name>
with the Database name for which you have created the service instance
For HANA – hana
For PostgreSQL – postgresql
<DB instance name>
Replace the <DB instance name>
with the service instance that you have created for the database.
cf push -f manifest.yml
For the application to work, the Retailer application needs the template role called "Retailer" assigned to the user.
In your trial account, in the left pane select Role collections under the Security tab.
Add a new Role collection named, "Retailer"
Click on the newly created "Retailer "role collection and add new Role.
Select the application identifier name similar to the one you have given in the xs-security.json file.
Select the role template and assign the Role you have created in the previous step.
We need to assign the role which we have created in the previous step to the user.
In your trial account, in the left pane select "Trust Configuration" under the Security tab.
Click on the default IDP service.
Enter username/email and click on the add Assignment button.
Select the Role as "Retailer" to assign it to the user.
Document services is out of scope currently in Cloud Foundry application
None
Please use GitHub issues for any bugs to be reported.
Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.