Discussing the SAP Gateway and OData Services

Objectives

After completing this lesson, you will be able to:
  • Describe the SAP Gateway and OData
  • Explain the benefits and use of the SAP Gateway

OData

Development of the SAP Gateway

The development of the SAP Gateway was driven by the need for mobile access to business data. Watch the following video on the development of the SAP Gateway.

Explaining the OData Standard

From a development perspective, an important aspect of the architecture of the World Wide Web is the use of abstract interfaces for component communication. These abstract interfaces are presented as connectors. A client and a server each use a connector component.

The connector defines the application protocol and parameters required for establishing a connection and determines how data can be exchanged. It defines the documents, their format, and behavior.

This figure provides you with an overview of the OData Standard.

By using the connector concept, both client and server are largely independent and exchangeable. Each connector translates the documents exchanged on the communication channel to the internal representations both on the server and on the client side, and vice versa.

The Open Data Protocol, or OData, provides the framework for standardizing these communications and the exchange of data. For example, a connector attached to an SAP back-end system translates between ABAP APIs and OData entities. The SAP Gateway is such a connector.

On the other side, a client connector translates between OData entities and the APIs of the consumer platform. The connector is specified here. As a consequence, any client platform with libraries supporting the contracted OData format can communicate with any server supporting the same contract.

Now, let's look in more detail at the OData protocol.

The Open Data Protocol

As you saw in the previous video, OData is a widely-used standard that provides a way to access and manipulate data in a simple and structured way, making it easier for developers to work with data across different platforms and technologies.

This figure tells us about the uses of the Open Data Protocol.

OData is an open standard originally developed by Microsoft but now managed by the Oasis Organization. It is based on the Atom Publishing and Atom Syndication standards, which, in turn, are based on XML (Extensible Markup Language) and HTTP(S) (HyperText Transfer Protocol (Secure)). JSON (JavaScript Object Notation) is an alternative to XML to structure data.

OData follows the Representational State Transfer (REST) architecture design paradigm in the sense that the protocol transfers representations of the state of resources. The term resource denotes data that is addressable and accessible. The standard address representation or resource is the Uniform Resource Identifier (URI). A client requests a resource from a server by sending a request to a URI. The server processes the request by translating the URI to internal address data to access or manipulate the data, and then assemble the response.

The main objective of the OData protocol is to provide a vendor-neutral, web-based API that fully complies with the design principles of Representational State Transfer (REST). This provides SAP application development with several compelling benefits.

This figure lists the benefits of OData.

Additionally, OData provides database-like access to server-side resources. In this context, OData is equivalent to ODBC for the web.

Note

Open Database Connectivity (ODBC) is a widespread database access method.

Finally, OData is also extensible. This enables SAP to supplement the data types used by OData with extra information from the ABAP Data Dictionary. Another example is metadata-driven development for Web and mobile like SAP Fiori elements.

OData is available in version 2 (V2), version 3 (V3), and version 4 (V4). The versions are built on each other extending the previous version by adding new features. The majority of OData services are based on V2. SAP Gateway supports OData V2 since AS ABAP 7.00 and OData V4 since AS ABAP 7.50. OData V3 was skipped in SAP Gateway and is therefore not supported.

SAP Gateway

Understanding the SAP Gateway

As you learned in the previous lesson, SAP adoption of the OData standard illustrates the importance of seamless integration and efficient data access in modern business operations. The SAP Gateway and SAP Gateway Foundation are essential components in achieving this integration and data access within an SAP ecosystem.

In this lesson, you will learn about the SAP Gateway, the SAP Gateway Foundation, the tools available to developers and administrators, and what deployment options are available for your SAP Gateway.

To begin, watch the following video to learn more about the SAP Gateway as an OData provider.

The SAP Gateway acts as a bridge between SAP systems and external applications, allowing for easy access to SAP data and processes from various devices and platforms. Along with the SAP Gateway Foundation, it simplifies the development and deployment of SAP-based applications, as well as the integration of non-SAP applications with SAP systems.

This figure shows that the SAP Gateway acts as a bridge between SAP systems and external applications.

SAP Gateway Service Catalog

By using OData, business data can be shared among multiple environments and platforms. SAP knowledge is not required for the consumption of the data. Usually client-based applications consume SAP Gateway services and interact directly with the user. Applications running in a Web browser are a common example.

This figure shows a screenshot from the SAP Gateway Service Catalog.

It is also possible for an SAP Gateway service to be used as an Application Programming Interface (API) by a server-based application. Additional servers can be added to the communication path to enhance the possibilities for client and server. For mobile devices, SAP Mobile Services add additional value to the applications.

Note

SAP Mobile Services is a Mobile Application Development Platform (MADP) that enables mobile application development, configuration, and management. It provides services to mobile applications, such as application analytics, app resources, on-boarding, HTTPS configuration and so on. Among others, it contains an offline OData service to optimize data transport between back-end and client offline stores.

The SAP Gateway Foundation

The SAP Gateway Foundation, component (SAP_GRFND), provides the underlying technology and infrastructure for the SAP Gateway, enabling secure and standardized communication between SAP and non-SAP systems. The SAP Gateway Foundation allows users to deploy OData services by providing a set of development and design tools. These tools enable developers to quickly create, modify, and deploy OData services, allowing them to expose business data from various SAP and non-SAP sources in a standardized manner.

Let's have a look at some of the tools and services provided by SAP Gateway Foundation for deploying and managing OData services.

The Gateway Service Builder

The Gateway Service Builder is a tool provided by SAP to create and configure OData services for SAP NetWeaver Gateway. OData services allow for the creation of standardized RESTful APIs that can be easily consumed by various clients, such as web applications or mobile apps. The Gateway Service Builder simplifies the process of creating and configuring these services, thus enabling developers to quickly expose SAP data and business functionality to external applications.

This figure provides you with a screenshot of the SAP Gateway Service Builder.

The Gateway Service Builder introduces a new service development concept, which is organized around projects. Projects are used to store all the artifacts that developers need, to create a service and model together in one place. As projects consolidate all related data, developers can easily work on multiple projects in parallel and reuse the data between projects before generating and activating the actual service.

The Gateway Service Builder also provides a user-friendly interface for developers to define data models, create service definitions, and configure the behavior of OData services. Developers can use the Gateway Service Builder to define entity types, associations, and navigation properties to represent the data model being exposed through the OData service. They can also specify the operations (such as create, read, update, and delete) that should be supported for each entity type, as well as any additional custom actions and functions.

In addition to defining the data model and operations, the Gateway Service Builder allows developers to customize the behavior of OData services using pre-defined templates and code snippets. For example, developers can add custom logic for data validation, authorization, error handling, and more. This customization is achieved through the use of annotations and model extensions, which can be added to the OData service definition using the Gateway Service Builder.

To illustrate how the Gateway Service Builder can be used with OData services, let's consider an example where a developer needs to expose employee data from an SAP system to an external client application. The developer can use the Gateway Service Builder to define an entity type for "Employee" and configure it to include properties such as "EmployeeID", "FirstName", "LastName", and "Department". The developer can also specify the operations that should be supported for the "Employee" entity type, such as read and update.

Furthermore, the developer can use the Gateway Service Builder to add custom logic for data validation and authorization. For instance, the developer can define a custom validation rule to ensure that the "EmployeeID" property is always unique, and they can also specify that only authorized users are allowed to update employee data.

SAP Gateway Client

The Gateway Client is a software component that serves as an intermediary between clients and OData services. It provides a standardized interface for clients to interact with OData services, including querying, creating, updating, and deleting data. The Gateway Client handles the communication between the client and the OData service, translating client requests into OData-compatible requests and processing the responses from the OData service.

This figure shows you a screenshot from the SAP Gateway Client in action.

The Gateway Client can be used in various scenarios with OData services. Here are a few examples of how it can be utilized:

  1. Query Data: The Gateway Client can be used to fetch data from an OData service by sending a GET request to the service's endpoint. For example, a client application may use the Gateway Client to retrieve a list of products from an OData service for display in a user interface.
  2. Create Data: The Gateway Client can be used to create new entries in an OData service by sending a POST request with the relevant data to the service's endpoint. For instance, a client application may use the Gateway Client to add a new customer record to an OData service.
  3. Update Data: The Gateway Client can be used to update existing entries in an OData service by sending a PATCH or PUT request with the updated data to the service's endpoint. For example, a client application may use the Gateway Client to modify the details of a product in an OData service.
  4. Delete Data: The Gateway Client can be used to delete entries from an OData service by sending a DELETE request to the service's endpoint. For instance, a client application may use the Gateway Client to remove a customer record from an OData service.

In each of these examples, the Gateway Client abstracts the complexities of interacting with OData services, such as generating OData-compliant requests, handling authentication and authorization, and parsing OData responses. This allows client applications to focus on their business logic and user interface, while the Gateway Client takes care of the low-level communication with the OData service.

Gateway Service Maintenance

The Service Maintenance component of the SAP Gateway Foundation is a crucial feature that allows administrators to manage and maintain OData services seamlessly. It encompasses various functionalities such as service registration, version management, and service documentation, making it easier for teams to keep track of and update their OData services effectively.

This figure provides you with a screenshot of the Gateway Service Maintenance.

Service maintenance in the SAP Gateway Foundation provides the following:

  1. Service Registration: This feature allows administrators to register OData services within the system, making it accessible to the end-users and other stakeholders. It includes metadata registration and endpoint configuration to ensure that the services are properly integrated into the system.
  2. Version Management: OData services often undergo updates and changes over time. The version management functionality in SAP Gateway Foundation allows for smooth version control, making it easier to manage multiple versions of OData services and ensure that users have access to the most up-to-date version.
  3. Service Documentation: Proper documentation is essential for understanding and utilizing OData services effectively. The service maintenance component provides tools for documenting service metadata, annotations, and other relevant information, ensuring that users have the necessary information to work with the services.
  4. Service Monitoring: The service maintenance component also includes monitoring tools to track the usage and performance of OData services. This helps administrators identify any potential issues and optimize the services for better performance.

The SAP Gateway Foundation Technical Operations Guide is the starting point for maintenance tasks that have to be carried out in the system landscape in which SAP Gateway Foundation components run. Technical operations refer to the tools and documentation needed to carry out various administration tasks, such as monitoring, backup and restore, transports, and tests.

For the complete list the tools and activities, refer to the SAP Gateway Foundation Technical Operations Guide section in the SAP S/4HANA online documentation (at Enterprise Technology → ABAP Platform → Administrating the ABAP Platform → Technical Operations for the ABAP Platform).

Security Services

The Security Services component of the SAP Gateway Foundation is a crucial part of the overall framework, designed to provide robust security features to protect the OData services and the data they expose. The security services ensure that only authorized users and applications can access the OData services, helping to prevent unauthorized access, data breaches, and other security threats.

The Security Services component of the SAP Gateway Foundation includes the following key features:

  1. Authentication: This feature ensures that users are verified and authenticated before accessing OData services. It supports various authentication methods such as basic authentication, OAuth2.0, SAML, and X.509 certificates.
  2. Authorization: This feature controls access to OData services based on the user's role and permissions. It allows for fine-grained access control, ensuring that only authorized users can access specific OData services and perform relevant actions.
  3. Secure Communication: This feature provides a secure channel for communication between clients and OData services by supporting transport layer security (TLS) and secure socket layer (SSL) encryption.
  4. Single Sign-On (SSO): The Security Services component supports single sign-on functionality, enabling seamless authentication and access across multiple applications and systems.

Consider a scenario where an organization wants to expose employee data from its SAP ERP system through OData services for consumption by a custom web application built using modern technologies such as Angular or React. The organization can leverage the Security Services component of the SAP Gateway Foundation to ensure secure access to the employee data.

First, the organization can configure the Authentication feature to use OAuth2.0 for user authentication, ensuring that only authenticated users with proper credentials can access the OData services. Then, the Authorization feature can be utilized to define roles and permissions for different user groups, so that only authorized users can read, create, update, or delete employee data.

In addition, the Secure Communication feature can be used to enable a secure channel for communication between the web application and the OData services, ensuring that data is transmitted securely over the network. Finally, the SSO feature can be implemented to provide a seamless login experience for users accessing the web application and the OData services.

SAP Gateway Deployment Options

There are three possible deployment options for SAP Gateway (hub is a synonym for front-end server (FES)):

  1. Hub deployment with development in back-end server (BES)
  2. Hub deployment with development in front-end server (FES)
  3. Embedded deployment
Deployment Options for SAP Gateway
Hub deployment with development in back-end server (BES)
  • A hub deployment offers the possibility of routing and composition of multiple back-end systems. It is the single point of access to back-end systems when using OData. This increases security and flexibility in operation.
  • This is the recommended setup for SAP Business Suite.
Hub deployment with development in front-end server (FES)
  • When developing in the FES, data is only read by RFC-enabled function modules from the BES, which enables access to data of a BES not able to provide an OData service on its own. This grants more freedom in selecting a system as data source.
  • This is the recommended setup for integrating multiple BES with different releases.
Embedded deployment
  • When developing in the BES, the application source code has direct access to the definition of the data and other repository objects. This increases performance and efficiency in development.
  • This is the recommended setup for SAP S/4HANA.

For additional information on deployment options for the SAP Gateway, see the official SAP Fiori Deployment Options and System Landscape Recommendations.

Summary

You should now be able to describe the SAP Gateway and Open Data Protocol. Also, you can explain the benefits and use of the SAP Gateway and the SAP Gateway Foundation.

Log in to track your progress & complete quizzes