SAP Graph Early Adopter Release, the free service plan is now available to all BTP customers and partners as well as indie developers under the SAP BTP free-tier service plan offering (subject to T&C) SAP Graph allows to create business data graphs wrapping access to backend data sources by leveraging OAuth2SAMLBearerAssertion destinations to SAP LOB Applications. |
The brief is try to show how to unbox SAP Graph service without writing a single line of code against SAP SuccessFactors and SAP S/4HANA Cloud business applications. Pre-requisites:
Disclaimer:
|
Where | What |
SAP BTP Platform |
|
SAP Graph Key user local machine |
|
hcm | Bank |
s4 | SalesOrder |
WHAT | HOW |
Add SAP Graph service entitlement to sub-account. | |
Goto service market place; locate the SAP Graph service and create a service instance from there as follows: | |
Step1. Make sure you are using the Other runtime environments to provision a service instance. Please use the free service plan if it is available to you; otherwise the beta service plan could be used for service discovery but please read carefully related comments in the Disclaimer section above. | |
Step2. Please add the following json formatted service parameters:
| |
Step3. The service creation will eventually kick off as depicted below: and then you can goto the service instance to continue with the service bindings configuration as follows: |
{
"Name": "Quovadis-SAP",
"Type": "HTTP",
"URL": "https://<api url>/odata/v2",
"Authentication": "OAuth2SAMLBearerAssertion",
"ProxyType": "Internet",
"KeyStorePassword": "<KeyStorePassword>",
"tokenServiceURLType": "Dedicated",
"audience": "www.successfactors.com",
"companyId": "<companyId>",
"Description": "Generic SFSF destination",
"authnContextClassRef": "urn:oasis:names:tc:SAML:2.0:ac:classes:PreviousSession",
"apiKey": "<apiKey>",
"KeyStoreLocation": "quovadis-sap.pfx",
"clientKey": "<clientKey>",
"nameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
"SystemUser": "<BizX user_id>",
"tokenServiceURL": "https://<token url>/oauth/token"
}
{
"Name": "QUOVADIS-ISVENG-JWT",
"Type": "HTTP",
"URL": "https://myXXXXXX.s4hana.ondemand.com/sap/opu/odata/sap/API_SALES_ORDER_SRV",
"Authentication": "OAuth2SAMLBearerAssertion",
"ProxyType": "Internet",
"KeyStorePassword": "<KeyStorePassword>",
"tokenServiceURLType": "Dedicated",
"audience": "https://myXXXXXX.s4hana.ondemand.com",
"authnContextClassRef": "urn:oasis:names:tc:SAML:2.0:ac:classes:x509",
"Description": "API_SALES_ORDER_SRV",
"tokenServiceUser": "<communication user>",
"tokenServiceURL": "https://myXXXXXX-api.s4hana.ondemand.com/sap/bc/sec/oauth2/token",
"tokenServicePassword": "<communication user password>",
"clientKey": "<communication user>",
"KeyStoreLocation": "quovadis_ateam-isveng.p12",
"nameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"scope": "API_SALES_ORDER_SRV_0001",
"userIdSource": "email"
}
graphctl
is a command line tool and requires Node.js version 14 with npm version 6 to run.nvm
, the node version manager, I need to first install the required version of nodejs and then tell nvm
to use the version 14 as follows:$ nvm install 14
Downloading and installing node v14.18.2...
Downloading https://nodejs.org/dist/v14.18.2/node-v14.18.2-darwin-x64.tar.gz.
################################################################################################################################################ 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v14.18.2 (npm v6.14.15)
$ nvm use 14
Now using node v14.18.2 (npm v6.14.15)
graphctl:
$ npm install -g @sap/graph-toolkit
/Users/<userid>/.nvm/versions/node/v14.18.2/bin/graphctl -> /Users/<userid>/.nvm/versions/node/v14.18.2/lib/node_modules/@sap/graph-toolkit/lib/cli.js
+ @sap/graph-toolkit@3.0.3
added 204 packages from 149 contributors in 11.495s
$ graphctl --help
SAP Graph command line interface (v3.0.3)
Usage: graphctl <action> [object] [options] [params]
General actions:
login Log in to configure a business data graph in your landscape
logout Log out from your landscape.
Actions for config:
generate Generate a graph configuration based on destinations in the BTP subaccount
activate Activate a graph configuration to create a business data graph
list List all activated graph configurations / business data graphs in the current landscape
get Retrieve a single graph configuration in the current landscape.
delete Delete a graph configuration and business data graph
General Options:
-v, --version Display the version number
-h, --help Display help on command
Tip:
Use 'graphctl <action> [object] --help' for command-specific help.
Example:
graphctl get config --help
quovadis-sap-graph.txt
$ graphctl login -s quovadis-sap-graph.txt
Authorize uri:
https://theta.authentication.eu10.hana.ondemand.com/oauth/authorize?client_id=sb-d5384116-a446-4b33-...
tokenData.json
file in a hidden .graph
directory as follows:$ ls -ln ~/.graph/
total 24
-rw-r--r--@ 1 501 20 1206 xx Dec 15:27 serviceKey.json
-rw-r--r--@ 1 501 20 4911 xx Dec 15:27 tokenData.json
$ graphctl list config
✔ SAP Graph URL (enter to use default 'https://eu30.graph.sap'): …
This URL is now used as default.
Fetching Graph configurations from https://eu30.graph.sap
┌─────────┐
│ (index) │
├─────────┤
└─────────┘
$ graphctl generate config --help
SAP Graph command line interface (v3.0.3)
Usage: graphctl generate config|c [options]
Generate a graph configuration based on destinations in the BTP subaccount
Options:
-f, --file <graphConfiguration> Write graph configuration to a file
-h, --help Display help on command
Example:
graphctl generate config -f ./graph-configuration-v1.json
$ graphctl generate config -f ./graph-configuration-v1.json
Fetching Graph configuration from https://eu30.graph.sap
Graph Configuration Template generation was successfully started
Waiting for graph configuration template to be generated
checking template generation status on https://eu30.graph.sap/config/v1/sap.graph/GraphConfigurationTemplate
(You can use CTRL + C to exit, this will not stop the generation of the graph configuration)
...
Graph config file has been created at: ./graph-configuration-v1.json
$ cat ./graph-configuration-v1.json
{
"businessDataGraphIdentifier": "v1",
"graphModelVersion": "1.0.0",
"schemaVersion": "1.0.0",
"dataSources": [
{
"name": "s4",
"services": [
{
"destinationName": "QUOVADIS-ISVENG"
},
{
"destinationName": "QUOVADIS-ISVENG-JWT"
}
]
},
{
"name": "hcm",
"services": [
{
"destinationName": "Quovadis-SAP"
}
]
}
],
"locatingPolicy": {
"cues": [],
"rules": [
{
"name": "sap.s4.*",
"leading": "s4",
"local": []
},
{
"name": "sap.hcm.*",
"leading": "hcm",
"local": []
},
{
"name": "sap.graph.*",
"leading": "s4",
"local": ["hcm"]
},
{
"name": "sap.graph.Bank",
"leading": "hcm"
},
{
"name": "sap.graph.Company",
"leading": "hcm"
},
{
"name": "sap.graph.CostCenter",
"leading": "hcm"
},
{
"name": "sap.graph.Country",
"leading": "hcm"
},
{
"name": "sap.graph.Currency",
"leading": "hcm"
},
{
"name": "sap.graph.Job",
"leading": "hcm"
},
{
"name": "sap.graph.Language",
"leading": "hcm"
},
{
"name": "sap.graph.PersonMaritalStatus",
"leading": "hcm"
},
{
"name": "sap.graph.PersonTitle",
"leading": "hcm"
},
{
"name": "sap.graph.TimeSheet",
"leading": "hcm"
},
{
"name": "sap.graph.WorkAssignment",
"leading": "hcm"
},
{
"name": "sap.graph.WorkforcePerson",
"leading": "hcm"
}
]
}
}
$ graphctl delete config v1
Fetching Graph configuration from https://eu30.graph.sap
✔ Do you want to delete the graph configuration with v1? … yes
Deleting graph configuration from https://eu30.graph.sap
Graph configuration with business data graph identifier v1 has been deleted.
$ graphctl activate config -f ./graph-configuration-v1.json
Updating Graph Configuration on https://eu30.graph.sap
Graph Configuration was successfully uploaded
Waiting for graph configuration to be processed
checking status on https://eu30.graph.sap/config/v1/sap.graph/GraphConfiguration/v1
(You can use CTRL + C to exit, this will not stop the processing of the graph configuration)
...
Graph configuration passed validations and deployment has started.
Deployment will be available at https://eu30.graph.sap/api/v1/metadata/entities
[
{
"message": "Entity API_SALES_ORDER_SRV.A_SalesOrder is provided by several destinations of business system s4 : QUOVADIS-ISVENG, apiVersion: 1; QUOVADIS-ISVENG-JWT, apiVersion: 1. The entity will be served by destination: QUOVADIS-ISVENG",
"location": null,
"level": "WARNING"
},
{
"level": "WARNING",
"location": "<location-guid>/translations/PersonMaritalStatus.hcm.jsonc",
"message": "attribute 'id': target: implicit type conversion: expected cds.Integer64, found cds.String"
},
]
$ graphctl list config
Fetching Graph configurations from https://eu30.graph.sap
┌─────────┬─────────────────────────────┬───────────────────┬─────────────┐
│ (index) │ businessDataGraphIdentifier │ graphModelVersion │ status │
├─────────┼─────────────────────────────┼───────────────────┼─────────────┤
│ 0 │ 'v1' │ '1.0.0' │ 'AVAILABLE' │
└─────────┴─────────────────────────────┴───────────────────┴─────────────┘
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
22 | |
14 | |
11 | |
11 | |
9 | |
8 | |
7 | |
7 | |
7 | |
6 |