SAP Graph is the new unified and consolidated API for SAP-managed data. Developers use SAP Graph to build applications that access a business data graph of SAP-managed data, regardless of where this data resides.
This is the first part in a developer tutorial on SAP Graph, the API for SAP’s Integrated Intelligent Suite. For an up-to-date overview and publication schedule for the full tutorial series, check the SAP Graph Multi-Part Tutorial: Information Map.
In this multi-part tutorial, we will take you from learning about what SAP Graph entails, all the way to becoming a developer who is proficient in using SAP Graph as an entry point to all business data and insight in the SAP Intelligent enterprise, regardless of where this data resides.
SAP Graph is currently in beta. We want you to be an early adopter of this innovative solution and to provide feedback, but you will not yet be able to use SAP Graph productively. See disclaimers.
With this out of the way, let’s talk about what SAP Graph wants to accomplish.
SAP is famous for its ERP software, but today SAP customers have increasingly more complex requirements and are managing intricate and hybrid on-premise and cloud solutions. Customers want to become Intelligent Enterprises. To support their journey, SAP has augmented its ERP-centric business suite with substantial additional functions through the acquisition of cloud solutions like SAP SuccessFactors, SAP Concur and SAP Ariba. SAP’s Intelligent Suite portfolio now supports all key business processes and span all enterprise functions, but this expanded role has come at the cost of complexity. Many of SAP suite’s products have their own stack: overlapping data models, inconsistent APIs and heterogenous infrastructures, and this complexity is not always well hidden from SAP’s customers.
From the perspective of a software developer, this means that accessing SAP-managed data has become very complex. Data may be federated across hybrid networks of on-premise and cloud systems with different security protocols, replication processes and multiple master data copies. You don’t only have to worry about the data you are interested in, you have to know which copy you need, where that data exactly is located, and how to deal with connecting to these different customer systems. Different products have different connection protocols, security requirements and APIs, and those APIs expose data using different and inconsistent data models. Developing SAP extension apps requires mastering a broad set of skills for even the simplest data queries, and the applications you develop are sensitive to the smallest product and landscape configuration changes.
This is the problem that SAP Graph addresses.
In essence, SAP Graph provides you with a single API for accessing data in SAP-managed landscapes, using a single, consolidated data model, the One Domain Model or ODM.
ODM represents the simplified and consolidated data model of SAP’s integrated intelligent suite, unifying the diverse product data models. ODM follows modular domain driven design principles. ODM focuses on logical addressable entities (business objects or data resources) like Customer, PurchaseOrder, Price, etc., grouped within business domains (also called name-spaces), like sap.odm.procurement, sap.odm.sales and sap.odm.travel. Entities are constructed from simple and structured attributes, which share a common set of base types (Date, String, etc.).
ODM defines a connected graph, with entities serving as the nodes of the graph and edges that represent relationships (which we call associations) between those entities. Together, they form the SAP ODM business graph. Learn more about ODM in this blog.
To illustrate this business graph, it is best if we start with a simple example taken from the enterprise world of sales. A salesperson entered a quote on behalf of a customer. This quote is represented by a CustomerQuote entity in the sap.odm.sales domain. The quote has an association to a Customer entity, which lives in the sap.odm.businesspartner domain. The quote also has multiple items, each of which refer to a Product entity (in the sap.odm.product domain), which in turn has multiple associations to other entities, like Supplier, etc. This is illustrated below:
Each entity has many (sometimes hundreds!) of additional attributes, such as a key (often called id in ODM entities), and various other attributes, which can be flat, arrays, or more complex structured compositions of other attributes. For instance, items is an array of a structured type called CustomerQuoteItem.
With SAP Graph you navigate to and access the data you need, regardless of where this data resides. SAP Graph abstracts the physical landscape and the details of the different product stacks and offers you a simple view of the SAP-managed data, which you can access through a single API and ODM, spanning all key use cases. SAP Graph accesses the data in the customer-configured landscape on your users’ behalf, technically acting as middleware. SAP Graph itself doesn’t store or cache any data.
The above illustration shows your app accessing quote, product, customer and supplier data – but the app cannot tell if this is data is accessed from an on premise SAP S/4 HANA system, SAP Sales Cloud or another system, like SAP Ariba. This will be determined by the specific landscape configuration that SAP Graph accesses on behalf of the app user. As a developer, you are exempted from knowing these system details, or how to access data in these heterogenous systems. More importantly, your application will be portable across multiple and diverse landscapes without changes to your code.
To access data from the business graph, SAP Graph currently supports the
OData v4 protocol. OData (Open Data) is a widely used OASIS standard that defines a set of best practices for using RESTful data APIs. SAP Graph support for GraphQL, another popular data-access API, is planned in the future.
As we shall see, OData RESTful APIs are easy to consume. OData requests operate on resources, the data, and extends this with query options, that let you shape the response to queries. The resources of SAP Graph are the entities of the ODM business graph.
Exploring SAP Graph on SAP API Business Hub
The SAP Graph API is documented on SAP API Business Hub. We have also preconfigured a free SAP Graph tenant with access to an SAP-managed landscape with sandbox data. We refer to this SAP Graph tenant as the sandbox. You can use it to study the documentation and interactively explore the API and data-set. The exposed sandbox data set is currently small, but it will rapidly expand. In a later part of this tutorial we will discuss how to configure your own SAP Graph tenant, to access your own corporate data.
When you follow SAP API Business Hub, you will see a number of tiles. Each tile represents a top-level domain in the One Domain Model. Click on one of them, for instance, click on the sap.odm.sales domain:
On the left, you will see the different resources (entities) supported in this domain. Click on CustomerQuote. This brings up the API reference documentation for quotes (sap.odm.sales/CustomerQuote):
You can study the documentation, and then try out the API right here in the API Business hub, by clicking the Try out button (you must log in with an SAP community login), setting the parameters to the query, and clicking Execute below. For instance, we can set $top to 2, to fetch the first two quotes:
Now click Execute to see the results:
In particular, you can see the OData query (https://sandbox.api.sap.com/sapgraph/sap.odm.sales/CustomerQuote?$top=2) that was used to access the data. The server part (https://sandbox.api.sap.com/sapgraph) redirects to the SAP Graph tenant and sandbox landscape, the rest of the URL is the API query itself (namespace, e.g. sap.odm.sales, the entity, e.g. CustomerQuote, and the query parameters, here $top=2).
Scroll the data, and note again, that you as the developer did not have to specify where the data came from… that is the task and magic of SAP Graph.
With this quick introduction out of the way, follow us to part 2 of this tutorial, in which we will write our first SAP Graph based application.
Chaim Bendelac, Chief Product Manager – SAP Graph
Visit the SAP Graph website at http://explore.graph.sap/
Contact us at firstname.lastname@example.org