{"id":20485027,"url":"https://github.com/sap-samples/cloud-espm-multi-environment","last_synced_at":"2025-08-27T14:24:55.300Z","repository":{"id":41989608,"uuid":"156756001","full_name":"SAP-samples/cloud-espm-multi-environment","owner":"SAP-samples","description":"This sample application demonstrates how to build applications on SAP Business Technology Platform (BTP) with the Java runtime. This version showcases how to adapt an ESPM application developed to run on SAP BTP Neo Environment to run on SAP BTP, Cloud Foundry environment.","archived":false,"fork":false,"pushed_at":"2025-03-07T12:54:24.000Z","size":2437,"stargazers_count":1,"open_issues_count":5,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-13T14:53:39.978Z","etag":null,"topics":["cloud-foundry","espm","neo-environment","sample","sample-code","sap-btp","sap-btp-cloud-foundry","sap-cloud-platform"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-11-08T19:11:09.000Z","updated_at":"2022-11-14T05:25:10.000Z","dependencies_parsed_at":"2025-04-13T14:53:06.550Z","dependency_job_id":"ad3086bb-325f-4e0f-9a7c-b86326f5e59c","html_url":"https://github.com/SAP-samples/cloud-espm-multi-environment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SAP-samples/cloud-espm-multi-environment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcloud-espm-multi-environment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcloud-espm-multi-environment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcloud-espm-multi-environment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcloud-espm-multi-environment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP-samples","download_url":"https://codeload.github.com/SAP-samples/cloud-espm-multi-environment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcloud-espm-multi-environment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272340111,"owners_count":24917322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-foundry","espm","neo-environment","sample","sample-code","sap-btp","sap-btp-cloud-foundry","sap-cloud-platform"],"created_at":"2024-11-15T16:27:07.196Z","updated_at":"2025-08-27T14:24:55.257Z","avatar_url":"https://github.com/SAP-samples.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-espm-multi-environment)](https://api.reuse.software/info/github.com/SAP-samples/cloud-espm-multi-environment)\n# ESPM\n\nThe ESPM (Enterprise Sales \u0026 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.\n\n# Description\n\n## Business Scenario\nThe business scenario is that of an eCommerce application that sells electronics products.\n\n- The Customers can order products and provide reviews on the products.\n- The Retailer can then accept the sales orders created against orders created by customers. The Retailer can also update the product stock information.\n\nESPM application has 2 underlying applications\n\n- Webshop - this application is a web shopping app, which doesn't have any authentication\n- Retailer - this application is used by a retailer to manage stocks, approve/reject sales orders. A user needs to be authenticated and should have a retailer role to perform these operations.\n\n![Architecture Diagram](/docs/architecture.jpg?raw=true)\n\n# Requirements\n\n- [Java8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (version 1.8.0_131 or higher)\n- [Maven](https://maven.apache.org/download.cgi) (version 3.3.9 or higher)\n- [Cloud Foundry CLI](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/4ef907afb1254e8286882a2bdef0edf4.html) (version 6.23.1 or higher)\n- If you do not yet have a SAP Businsess Technology Platform trial or enterprise account, signup for a SAP Business Technology Platform trial account by following the [documentation](https://developers.sap.com/tutorials/hcp-create-trial-account.html).\n\nFor Setting up the development environment, refer to the [quick start guide](https://github.com/SAP/cloud-espm-v2#1-quick-start-guide)\n\n# Download and Installation\n\n## Build the application\nA maven build of the application generates a separate `war` file for the `Neo` and `CF` environment.\n\n\n\n_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_\n\n1. Download the SAP Business Technology Platform SDK from https://tools.hana.ondemand.com/#cloud\n2. Take the latest version of \"Java Web Tomcat 8\" (neo-java-web-sdk-3.70.9.3 or higher) from the download section.\n3. Unzip the archive to an arbitrary location on your laptop/desktop.\n4. 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!\n5. Put the driver to your local maven repository with maven command\n  ```\n    mvn install:install-file -Dfile=\u003cpath-to-file\u003e -DgroupId=com.sap.db.jdbc\n      -DartifactId=ngdbc -Dversion=2.0.13 -Dpackaging=jar\n  ```\n\n6. From the root directory (i.e. cloud-espm-multi-environment), run the following Maven command\n  ```\n    mvn clean install\n\n  ```\n\nThis command builds the application and generates `war` for the `Neo` and `CF` environment.\n\n## Running the application in NEO environment\n\n### 1. Deploy application\n\nThe `war` file for the NEO environment can be found at `neo/espm-cloud-web-neo/target/espm-cloud-web-neo.war` .\n\nOpen the hanatrial account cockpit and upload the war file as follows.\n\n- Go to SAP BTP Cockpit --\u003e Click on Java Application under Applications --\u003e Click on Deploy Application\n\n- Add War File Location, Give Application Name \"espm\", select Runtime Name \"Java Web Tomcat 8\" and JVM Version as \"JRE 8\"\n\n- After Successful deployment, Click on Start\n\n### 2. Configure Roles\n\n   - Configure the application role assignments from the [cockpit](https://help.hana.ondemand.com/help/frameset.htm?db8175b9d976101484e6fa303b108acd.html). You basically need to add the \"Retailer\" role to your SAP Business Technology Platform user to access the Retailer UI\n\n    You can access the application from the URL\n\n    * The eCommerce site can be accessed via the URL: https://espm\\\u003caccount\\\u003e.hanatrial.ondemand.com/espm-cloud-web/webshop\n    * The Retailer UI can be accessed via the URL: https://espm\\\u003caccount\\\u003e.hanatrial.ondemand.com/espm-cloud-web/retailer\n\n    **Note! The application name must be \"espm\", else the above URL will change based on the application name given during deployment**\n\n\n### 3. Bind the database to espm application and start espm application\n\nBelow is the process to bind the database to the java application in BTP trial account using a Shared HANA database\n\n   - In the cockpit, select an account and choose Persistence -\u003e Databases \u0026 Schemas -\u003e in the navigation area.\n   - Click on the new button\n   - In the popup window, enter the below information\n   \t```sh\n  \tSchema ID: espm\n  \tDatabase System: HANA (\u003cshared\u003e)\n  \tVersion: 1.00*\n  \tClick on Save button\n\t```\n\n   - In the cockpit, select an account and choose Applications -\u003e Java Application -\u003e Click on the name of the espm application that you deployed\n   - In the navigation area in the cockpit, select Configuration -\u003e Data Source Bindings\n   - Click \"New Binding\" button in detail plane\n   - In the popup window, enter the below information\n\n   \t```sh\n  \tData Source - \u003cdefault\u003e\n  \tDB/Schema ID - select espm (the one that you created above)\n  \tClick on Save button\n    ```\n\n   - Now you need to restart espm application (stop, if already running and start the application) from the cockpit.\n\n## Running the application in CF environment\n\nFrom root folder, navigate to `cf` folder.\n\n#### 1. Login to Cloud Foundry\n\n```\ncf api \u003capi\u003e\ncf login -o \u003corg\u003e -s \u003cspace\u003e\n```\n\n#### 2. Create Service\n\nDepending on the requirement, create a service instance for either of the database (HANA or PostgreSQL).\n\n```\ncf create-service hana schema espm-hana (HANA)\nor\ncf create-service postgresql v9.4-dev espm-postgres (PostgreSQL)\n```\n\nCreate service instance for the XSUAA\n\n```\ncf cs xsuaa application espm-uaa -c xs-security.json\n```\n\n#### 3. Edit Manifest\n\nOpen the manifest.yml file and edit the following\nReplace \u003ci-number\u003e placeholders with your ```I/D/C numbers``` so that the application name and host name is unique in the CF landscape.\n\n```DATABASE_TYPE: \u003cDB name\u003e```\n\nReplace the ```\u003cDB name\u003e``` with the Database name for which you have created the service instance\n\nFor HANA – ```hana```\n\nFor PostgreSQL – ```postgresql```\n\n```\u003cDB instance name\u003e```\n\nReplace the `\u003cDB instance name\u003e` with the service instance that you have created for the database.\n\n\n\n#### 4. Push the application\n\n```cf push -f manifest.yml```\n\n#### 5. Setup Role collections\n\n\nFor the application to work, the Retailer application needs the template role called \"Retailer\" assigned to the user.\n\n - In your trial account, in the left pane select Role collections under the Security tab.\n\n - Add a new Role collection named, \"Retailer\"\n\n - Click on the newly created \"Retailer \"role collection and add new Role.\n\n - Select the application identifier name similar to the one you have given in the xs-security.json file.\n\n - Select the role template and assign the Role you have created in the previous step.\n\n#### 6. Assign Role to the user\n\nWe need to assign the role which we have created in the previous step to the user.\n\n - In your trial account, in the left pane select \"Trust Configuration\" under the Security tab.\n\n - Click on the default IDP service.\n\n - Enter username/email and click on the add Assignment button.\n\n - Select the Role as \"Retailer\" to assign it to the user.\n\n# Out of Scope\n Document services is out of scope currently in Cloud Foundry application\n\n# Known issues\n None\n\n# Support\n\nPlease use GitHub [issues](https://github.com/SAP/cloud-espm-multi-environment/issues/new) for any bugs to be reported.\n\n# License\n\nCopyright (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](LICENSES/Apache-2.0.txt) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fcloud-espm-multi-environment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap-samples%2Fcloud-espm-multi-environment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fcloud-espm-multi-environment/lists"}