This example application demonstrates how to use an OData Service available on the SAP Gateway Demo Server - ES5 with the SAP Cloud SDK for NodeJS and the SAP Cloud Application Programming Model.
You can also run this app against your on premise ABAP Developer Edition using the SAP Cloud Connector to establish the connection. Here you can then configure end-to-end authentication with principal propagation. In that case the service in the ABAP Backend is called not with a technical user, but with the user that was authenticated in the SAP Cloud Platform.
This example wouldn't work without the help of Dennis Hempfing who steped in to help in this questions:
- First letter of entity attributes converted to lowercase by @sap/cloud-sdk-generator
- Using destination from package.json / default-env.json in implementation
- Unable to build destination for service binding: Unable to find a service binding for given name
To run against the local mock service epmbp-mock-service you have to create a file named default-env.json with the following content:
{
"VCAP_SERVICES": {},
"destinations": [
{
"name": "ES5",
"url": "http://localhost:3000/sap/opu/odata/sap/EPM_REF_APPS_PROD_MAN_SRV"
}
]
}
If you want to da a local test against the ES5 system / S/4HANA Cloud Sandbox then use this content for the default-env.json
{
"VCAP_SERVICES": {},
"destinations": [
{
"name": "ES5",
"url": "https://sapes5.sapdevcenter.com/sap/opu/odata/sap/EPM_REF_APPS_PROD_MAN_SRV",
"username": "<Your ES5 Username>",
"password": "<Your ES5 Password>"
},
{
"name": "APIBusinessHub",
"url": "https://sandbox.api.sap.com/s4hanacloud",
"headers": {
"APIKey": "Your API Key"
}
}
]
}
Then execute:
npm run setup
Followed by:
npm start
- You have a SAP Cloud Platform Trial account
- The Cloud MTA Build Tool (MBT) is installed
- The Cloud Foundry commandline tool is installed
- The MultiApps CF CLI Plugin is installed
- You've connected using
cf login
to your trial account - Three destinations either to the ES5 or your local ABAP system
Optional
- You've connected a SAP Cloud Connector to your subaccount
- Principal Propagation is setup in the Cloud Connector to the ABAP Backend
Destination ES5 used by the approuter, CAP and SAP Cloud SDK:
Description=SAP Gateway Demo System
Type=HTTP
Authentication=BasicAuthentication
WebIDEUsage=odata_abap,ui5_execute_abap,dev_abap,bsp_execute_abap
Name=ES5
WebIDEEnabled=true
URL=https\://sapes5.sapdevcenter.com
ProxyType=Internet
User=<Your ES5 Username>
WebIDESystem=ES5
Destination ES5 used by the approuter, CAP and SAP Cloud SDK:
URL=http\://<Virtual Hostname of your ABAP Backend>\:<Virtual Port of your ABAP Backend>
Name=ES5
ProxyType=OnPremise
Type=HTTP
sap-client=001
Authentication=PrincipalPropagation
npm run build:cf
npm run deploy:cf
It's possible to deploy this application also to an on Premise instance of SAP HANA.
The connection information to the ES5 system is provided via a user-provided service. Such a services needs a configuration file. The actual content can't be used in the destination. Please create default-es5destination.json in the root folder of the project and fill it with:
{
"name": "ES5",
"url": "https://sapes5.sapdevcenter.com"
}
The credentials for the backend access should never appear in a Git repository. That is why I suggest to use a MTA extension. Please create the file xsa.mtaext in the root folder with the following content. Replace YourES5user and YourES5password with your own credentials.
_schema-version: '3.1'
ID: epmbp-consumer-app.extension
extends: epmbp-consumer-app
resources:
- name: es5destination
properties:
name: ES5
username: YourES5user
password: YourES5password
npm run build:xsa
npm run deploy:xsa:user
Start the Application: epmbp-consumer-app-app via the created Application Route from the SAP HANA XS Advanced Cockpit. You should be able to open the Link /catalog/SEPMRA_I_Product_E - Public Service from ES5 and see a list of Products returned as JSON.