Skip to content

Latest commit

 

History

History
154 lines (112 loc) · 5.19 KB

README.md

File metadata and controls

154 lines (112 loc) · 5.19 KB

EPM Business Partner - Consumer App

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:

Run local

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

Deploy to SAP Cloud Platform - Cloud Foundry

Prerequisite

Optional

  • You've connected a SAP Cloud Connector to your subaccount
  • Principal Propagation is setup in the Cloud Connector to the ABAP Backend

Preperation for a Connection to ES5

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

Preperation for on premise connection with principal propagation

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

Build

npm run build:cf

Deploy

npm run deploy:cf

Deploy to SAP HANA XSA on Premise

It's possible to deploy this application also to an on Premise instance of SAP HANA.

Preperation

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

Build

npm run build:xsa

Deploy

npm run deploy:xsa:user

Test

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.