Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 

Overcoming Data Integration Challenges: Introducing SAP Graph as a Unified Solution for Multiple Business Systems


  • Business Problem -- You got multiple business systems for example SAP S/4 HANA Cloud / SAP SuccessFactors / SAP S/4 HANA System on Premise but bringing data from these systems using one Unified service is a challenge but that Change got a beautiful solution and that is SAP Graph

  • SAP Graph -- "Streamlining functionality, we provide developers with a single connected and unified view of all their business data through a single endpoint for all purposes."

Resources for learning:

  1. Thank you SAP HANA Academy for such a great Youtube Series on SAP Graph please follow it for building your solutions  end-2-end.

  2. You can also follow SAP Graph tag on SAP Community and blog series on SAP Graph



  1.      BTP Cockpit trial account or Paid Account

  2.      SAP graph Free tier Services ( Check SAP Discovery Center for more detail )

  3.      Create Graph instance and Key Service Key ( Download and Save it )

  4.      Graph Instance parameters - ( Download and save it ) More details on HANA Academy GitHub  - > SAP Graph

  5.      Go to PowerShell or VS Code and install graphctl tool for graph connect


Setup Graph Environment:

  1. Get your free tier service from SAP Discovery center and add the entitlement in your BTP Subaccount

  2. Download your graph key and store it somewhere in your system ( I will not go into detail as there are already few blogs and series on how to set it up but this is needed for start hence adding it for connect)




Sandbox API Destination Configuration:

  1. Get your API Key and API url from SAP' API Sandbox system.

  2. Business Acceleration Hub -

  3. Login with your credentials - go to -> Settings -> Show API Key - Copy and Save it

  4. Somewhere Create destination in BTP Cockpit Destination Config will look like this :-


Login to BTP Subaccount : ( CF LOGIN -a <API> )

  1. Connect your BTP Subaccount - Enter your registered email ID and Password and select working Dev Space

  2. Install graphctl tool using npm : Execute command - npm i @Sap/graph-toolkit



  •      graphctl login -f shagraph-creds.JSON.txt   

  •     ( Note: This is going to open Web Browser login with your BTP Credentials and then close        the window )


Graph Generate & Activate Config:


  1. graphctl generate config -f "C:\Users\Yoga\Desktop\graph\instance-parameters.json" -i cxsales

  2. graphctl activate config -f "C:\Users\Yoga\Desktop\graph\instance-parameters.json" --force


Graph List Config: ( GRAPHCTL LIST CONFIG ):

Graph is available for consumption   








"The graph is now operational and ready to serve. Please generate your service keys on the graph instance and proceed to test the graph API".

We are pleased to inform you that sap.graph is successfully serving the Cloud for Customer entities. You have the flexibility to select any entity and seamlessly integrate or link it directly to your application. This exemplifies the power of SAP Graph - an incredible technology that yields remarkable results.


Test your GRAPH API:

Create One GET Request in POSTMAN Client and Enter your Graph URL ( https://<host>/api/v1/sap.graph ) 

Choose Authorization: Oauth 2.0 Credentials 

 Execute GET Request on Graph Endpoint:


Lets GET Company Information from Graph



"Graph Environment Setup: Integration with SAP Graph and SAP CX Sales Cloud APIs, Business Data Graph Generation, and Successful Testing of Graph APIs in POSTMAN Client"

Congratulations on your successful setup of the graph environment! It's great to hear that you have successfully integrated SAP Graph with SAP CX Sales Cloud APIs. Additionally, generating a business Data Graph for consumption and conducting successful tests of the Graph APIs in the POSTMAN client demonstrate significant progress. Well done!

Part 2: CAP Wrapper for Graph API:



"The architecture diagram illustrates the connection of two business systems to SAP Graph. SAP Graph is exposed as an endpoint (referred to as a destination in the Business Technology Platform), and a CAP App consumes that destination to access and expose the business data."


What all we need ?

  1.      Node in your VS Code / BAS

  2.      Destination for Graph endpoint in BTP Cockpit

  3.      Authentication , Destination and connectivity services in CAP


Create Destination in BTP Cockpit

  1. Obtain the Client ID and secret from the Graph Service Key file.

  2. Log in to the BTP Cockpit.

  3. Navigate to the "Destinations".

  4. Click on "New Destination" .

  5. Provide a name for the destination (e.g., "SAP Graph API").

  6. Fill in the required details, such as the URL endpoint of the SAP Graph API.

  7. In the "Authentication" section, select the appropriate authentication method (e.g., OAuth2 Client Credentials).

  8. Enter the Client ID and secret obtained from the Graph Service Key file in the respective fields.

  9. Save the destination configuration.



Create CAP Application in VS Code


  1. Create Simple CAP Application either in BAS or in VS Code , I am using VS Code

  2. Lets Create one Folder in your workspace in VS Code Name it like getBusinessData

  3. Open VS Terminal and execute

cds init 

cds add mta

Add these in package.json

Add this CDS Section

"cds": {
"requires": {
"shagraph": {
"kind": "odata-v4",
"credentials": {
"destination": "shagraph",
"path": "/sap.graph"

Add sales.cds  file in srv folder and add the below snippet , I have created on function import which will be returning the dynamically generated results from SAP Graph API.

@protocol: 'rest'
service root {
type object {};
function graph(name:String) returns array of object;


Add sale.js file in srv folder
const get = require("./handlers/GET/getSales");

module.exports = cds.service.impl(async function () {
this.on("graph", get.graph);


handler for graph.
const graph = async (req) => {
const srv = await"shagraph");
if ( !== null && != undefined) {
req.query = SELECT.from(;
} else {
req.query = SELECT.from(`sap.graph`);
req.query.SELECT.from.ref[0] = "";
return await;

module.exports = {

Execute these Commands 

cds build

"BAS Does this automatically but in VS Code we can run these commands to Bind the Application"

cds bind -2 destination-srv:key -- Bind your App with Destination using Key

cds bind -2 uaa-srv:key Bind your App with Authentication service using Key

cds watch --profile Hyrbrind ( to run your App locally )



End-2-end execution of CAP Wrapper for Graph API: 

Note: Just created this small Video for executing calls to graph API instead putting screenshots 🙂


Here CAP Endpoint is serving first for sap.graph and after that we are passing entities exposed using business data graph and it comes to an end then.


I hope you have enjoyed the reading and please feel free to post your comments or questions if any 🙂


Thanks Shivam
Labels in this area