7.2 SAP Gateway Service Builder
SAP Gateway translates complex data structures into easy-to-consume OData services. SAP Gateway Service Builder is the central interface of SAP Gateway (accessed via Transaction SEGW); it includes both code-based development of OData services for experienced developers and non-code-based generation of services for less experienced developers. We’ll cover only the non-code-based development services in this book.
SAP Gateway Service Builder contains all relevant functions for the modeling and development of OData services in SAP Gateway, and supports the entire development lifecycle of an OData service in SAP Gateway. SAP Gateway Service Builder’s main objective is to provide comprehensive support for building OData services in a declarative way or for reusing existing business objects in the SAP Business Suite system. Later, you’ll see a data model in SAP Gateway Service Builder. This modeling environment follows a project-based approach, and all relevant data is consolidated in these projects.
Now that you understand the terms entities, entity types, entity sets, associations, and so on from the service document and service metadata document, let’s explore these concepts in the SAP Gateway Service Builder. To begin, first navigate to SAP Gateway Service Builder by following these steps:
- Log in to the SAP Gateway server.
- Open SAP Gateway Service Builder by running Transaction SEGW.
-
Open a project by clicking
.
-
Enter the Create Sales Order project details; that is, enter “SRA017_SALESORDER_CREATE” in the Project field and press (Enter) (see Figure 7.13).
Figure 7.13 Create Sales Order Project
You should now see the Sales Order Creation project (see Figure 7.14).
Figure 7.14 SAP Gateway Service Builder
From the screen shown in Figure 7.14, note the following details:
-
Entity Types
Each entity type can have a data dictionary binding to an existing ABAP Data Dictionary (DDIC) structure element. Expand the Customer entity type shown in Figure 7.14, and double-click Properties. Figure 7.15 shows the Customer entity type with the entities. - Navigation Properties: Each entity type contains one or more navigation properties. These properties contain links representing an association; for example, Figure 7.16 shows the navigation properties of the Customer entity type; PartnerAddressSet is the link from the Customer entity to the PartnerAddress entity.
-
Associations
Associations are relationships between two or more entities; for example, Figure 7.17 shows the relationship between CustomerPartnerAddress with the one to many cardinality. With SAP Gateway Service Builder, you can create or edit an association.
Figure 7.15 Entity Type Properties
Figure 7.16 Navigation Properties
Figure 7.17 Associations
-
Entity Sets
As previously mentioned, entities (e.g., customers, order items, etc.) are grouped in entity sets, and these entities are instances of the entity types (e.g., customer ID, customer name, etc.; see Figure 7.18).Figure 7.18 Entity Sets
-
Service Implementation
This folder contains references to the operations and methods of a service. Based on the OData model, the services are implemented under the Service Implementation folder after the project is generated. Under each individual entity set, the following operations can be found: Create, Delete, GetEntity, GetEntitySet, and Update (see Figure 7.19).Figure 7.19 Service Implementation
-
Runtime Artifacts
When you generate an OData service, SAP Gateway Service Builder automatically generates the code (i.e., it generates the runtime artifacts) and registers the OData service to the SAP Gateway server. The following are important runtime artifacts (see Figure 7.20):- Data Provider Base Class (suffix _DPC): This is an ABAP class. DPC provides all the methods required to handle OData requests; for example, it’s used to code your create, read, update, and delete a query (CRUD) methods and function import methods.
- Data Provider Extension Class (suffix _DPC_EXT): You can define all your back-end logic in redefined methods of the DPC extension class.
- Model Provider Base Class (suffix _MPC): This is a base ABAP class. MPC is used to define the EDM of your service. Typically, developers don’t touch this class unless there’s some feature that isn’t available in the SAP Gateway tool and they want to build the service with that feature.
- Model Provider Extension Class (suffix _MPC_EXT): This is the implementation class that inherits the base class. Developers can modify and add features to this class.
- Registered Model (suffix _MDL): This is the technical name of the OData service model—for example, SALESORDER_MDL.
- Registered Service (suffix _SRV): This is the technical name of the OData service—for example, SALESORDER_SRV.
Figure 7.20 Runtime Artifacts
-
Service Maintenance
During the runtime artifacts generation, the ABAP classes are registered to the SAP Business Suite back-end system, and then the technical service names are registered with the SAP Gateway hub system (see Figure 7.21).
Figure 7.21 Service Maintenance
So far, we’ve reviewed the basic OData concepts and SAP Gateway Service Builder components via an example based on the Create Sales Order OData service. Now, let’s look at the most important part of SAP Gateway Service Builder: modeling an OData service.