Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
marc_vornetran
Advisor
Advisor

In this part of the series on Graph – the new API for connecting to your business data – we will discuss the concepts and configuration of the Business Data Graph. Please refer to the Information Map to see all parts of this series. The Graph documentation on the Help Portal provides an in-depth look at many of the concepts featured in this part.  

The “data graph” concept is central to the Graph capability. The business data graph is essentially the artifact that connects the business data together. The administrator is responsible for creating and shaping how the data in the business systems is reflected in the business data graph.  

A data graph consists of mirrored entities, which are projections of the business objects that Graph automatically discovered in the business systems. They are mirrored one-to-one in the data graph and grouped in namespaces that correspond to each business system. Then the mirrored entities are connected through additional semantic connections.  

marc_vornetran_0-1708674195264.png


Additional projections, called
unified entities, are created on top of the mirrored entities. They connect semantically common business concepts from multiple data sources and are created in the namespace sap.graph. It is also possible for customers to extend the data graph by creating custom entities. We will address model extensions in a separate blog post. 

Finally, the data graph is activated to create a business data graph, which is a runtime artifact based on the configured data graph, and accessible as a unified API.  

The official documentation set provides goes more in-depth of what is described in this section and can be accessed here: SAP Help Portal: Graph - Business Data Graph  

We pick up from where we left off at the end of the previous blog. You previously set up Graph in SAP Integration Suite, created destinations to data source endpoints, and assigned yourself the dedicated Graph role collections. Also, you created a service binding for Graph and generated and downloaded the credentials text file. 

In the following steps, you will construct a business data graph from the data sources you previously configured as SAP BTP destinations and explore the business data graph in the Graph Navigator tool. 

Construct the Business Data Graph  

1. In the SAP Integration Suite application, select Graph under Design Artifacts in the left-side menu. 

marc_vornetran_1-1708674195265.png

 

2. Select Create new business data graph in the center panel.  

marc_vornetran_2-1708674195266.png

 

3. Provide an ID for the business data Graph. Use lowercase letters, numbers, and hyphens.  

marc_vornetran_3-1708674195267.png

 

4. Select the data sources you would like to include in your business data graph. These are the destinations you previously configured in the SAP BTP cockpit. Select Next. 

marc_vornetran_4-1708674195268.png

 

5. Skip the optional Model Extension step for now, by selecting Next. Your draft business data graph gets generated. 

6. Review the configuration file and select Create to activate the business data graph. 

marc_vornetran_5-1708674195269.png

 

7. Wait for the Status to update to be Available. Eventually, the status goes from Processing to Available. 

marc_vornetran_6-1708674195272.png

 

Note: You can navigate to more information about individual business data graphs by selecting >. You can edit or delete the business data graph, or view the logs.  

Screenshot 2024-02-23 at 09.12.22.png

 

marc_vornetran_8-1708674195273.png

 

Explore the business data graph in the Graph Navigator  

You just created your business data graph. Wouldn’t it be cool to explore the semantic connections between the data entities and even try out a few OData queries on the real data in the business systems? You can do exactly that using the Graph Navigator within API Business Hub Enterprise! This section takes you through exploring the business data graph you created in the previous section, using the Graph Navigator tool.

1. Open the Graph Navigator tool in API Business Hub Enterprise by selecting the menu icon in the top panel and then Graph Navigator. 

marc_vornetran_9-1708674195275.png

2. The Graph Navigator automatically lists all the business data graphs in your SAP BTP subaccount. Select the business data graph you previously created. 

marc_vornetran_10-1708674195275.png

3. On the left, in the Entities index, you see a search window, and collections of the available entities, grouped per namespace. 

marc_vornetran_11-1708674195275.png

 

4. Depending on the data sources you included in your business data graph, you may have three namespaces containing the business objects from SAP SuccessFactors (sap.hcm), SAP S/4 HANA (sap.s4) and SAP Sales and Service Cloud (sap.c4c). Open one of these three namespaces. For instance, pick the sap.c4c namespace, and then select SalesQuoteCollection under Sales Quote. 

marc_vornetran_12-1708674195276.png

 

5. You can easily see which operations are allowed (create, read, update, and delete), review the list of attributes, and see an actual data example. Take the time to explore the root entities (potentially representing 4,500+ entities and sub-entities in SAP systems), in the different namespaces, within the Graph Navigator context. 

marc_vornetran_13-1708674195277.png

6. Explore one of the unified entities in the sap.graph namespace, the top namespace in the list on the left. Unified entities are simplified projections on some of the most complex business objects in SAP systems. They are useful in particular for apps that only require basic, essential information. 

For instance, you can search for sales quote (or SalesQuote) in the search box on the left and pick the first search result: sap.graph/SalesQuote. 

This too is a synthetic entity, a projection, of the actual sales information in your systems. 

marc_vornetran_14-1708674195278.png

7. Now switch to the Try Out tab at the top. 

marc_vornetran_15-1708674195278.png

8. You can see an OData request, for one record of sap.graph/SalesQuote ($top=1). Click Run. You will see your Sales Quote appear on the screen. 

marc_vornetran_16-1708674195278.png

9. Now let's have some fun. Use the $expand button to check _salesOrganization and _distributionChannel. Did you see how this automatically changed the OData request? 

marc_vornetran_17-1708674195279.png

10. Click run to see the result of this query. Scroll down to see the expanded sales organization and distribution channel information. As you can see, this is a (mock) quote from one of BestRun's direct sales customers in the US. 

marc_vornetran_18-1708674195279.png

11. We could try out different variations of "$expand", to get of sense of all the data. Here is another fun query we can try:

/sap.graph/SalesQuote?$top=1&$expand=items($expand=_product) 

and learn that the customer was quoted a single calculator which is of product type 3. 

marc_vornetran_19-1708674195280.png

12. When dealing with a specific single record, we can also navigate across the data to access other pertinent information. First, let's expand the customer (a business partner) on our order to find out the type: 

/sap.graph/SalesQuote/c4c~1?$expand=_soldToParty 

marc_vornetran_20-1708674195280.png

13. This is a corporation, so we can navigate to:  

/sap.graph/SalesQuote/c4c~1/_soldToParty/_corporateAccount  

Let's also add some options to the query before we run it:  

/sap.graph/SalesQuote/c4c~1/_soldToParty/_corporateAccount?$expand=addresses,contacts  

marc_vornetran_21-1708674195281.png

14. Expanding and navigating are two powerful capabilities. But what makes data graphs even more useful are queries that combine these capabilities with other features, such as:  

$select: return only the attributes you need  

$filter: use data selection criteria  

$orderby: return results in sort-order.  

For instance, the following query lists ten sorted (ascending order) quotes by netAmount greater than 2000, with customer names and sales organization:  

/sap.graph/SalesQuote?$top=10&$expand=_soldToParty($select=name)&$filter=netAmount ge 2000&$select=id,netAmount,salesOrganization&$orderby=netAmount  

marc_vornetran_22-1708674195282.png

 

In summary 

This part of the series concludes the basic introduction to Graph. In the previous partwe learned how to set up a landscape for Graph, which we used in this part to create a business data graph and explore it in the Graph Navigator tool. 

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

Marc Vornetran, Product Owner – Graph in SAP Integration Suite 

Learn more about Graph in the SAP Community