Data modeling in SAP Gateway for OData Services
Data Model Definition
OData services require a data model definition, referred as model provider class. For client development projects, the development process mandatorily commences with a previously-defined data model, which is outside-in approach. Based on your specific requirements, you can define a data model in the following formats:
- Define new data model
- Redefine Service
- Include Service
Let’s have a brief overview of each format:
Define new data model
This model offers optimum flexibility, wherein it requires manual definition of individual data model elements and their properties.
What are data model elements?
Within the tree view of the Service Builder, you can use the data model folder structure to create and edit the individual data model elements. The data model consists of various sub-folders for each of the element types as listed below:
- Entity Types
- Complex Types
- Entity Sets
- Association Sets
- Function Imports
You can create and define any of the above data elements, directly in the data model folder of your project. Once you create a new model element, it is inserted in the relevant predefined sub-folder within the data model folder.
There are three types of methods for creating a new data model:
- Double click the specific data model element in the data model folder and enter the relevant information.
- Right click the data model folder, click Create and then click the data model element you want to create.
- Expand the data model folder, right click the data model element you want to create and then click Create.
You can use any of the 3 methods to accomplish the import process:
- DDIC structure (ABAP Data Dictionary)
- Data source (RFC/BOR interface)
- Data Model
DDIC structure (ABAP Data Dictionary)
This structure minimizes the time required to create entity and complex types in your data model.
In order to minimize the time required to create complex types and entity types in your data model, SAP NetWeaver Gateway Service Builder provides the Import DDIC structure function that lets you import an existing ABAP (DDIC) structure and later reuse this data to create new complex types and entity types with minimal effort.
You can import the following DDIC structures into the Service Builder:
- Search Help
- Database tables
Data source (RFC/BOR interface)
This lets you to reuse existing remote function calls (RFC)/business object repository (BOR) parameters to create entity types with minimal effort. Hence, you can tap into a multitude of RFCs and business application interfaces (BAPIs) from the BOR. Once you have imported an existing interface definition, you can map the operations from the same RFC or BAPI to get the service operations you require, eliminating the need to write additional ABAP source code.
It enables you to reuse an existing data model for more than one service. The file import function is incorporated to enable import of data model files, as defined by external model editors such as Visual Studio (edmx files) and metadata file types (xml) into the Service Builder to create a data model. You can import such files into the Service Builder for the 2 types of projects, such as:
- Service with SAP Annotations
- Service with Vocabulary-Based Annotations
You can use this feature in the following scenarios:
- To import a metadata/edmx file for a new project in certain instances where you create a project and import a file.
- To import a metadata/edmx file for an existing project that already has a data model created (re-import).
It lets you redefine existing SAP NetWeaver Gateway services or services created from a framework within your SAP system landscape (Ex: Service Provider Interface (SPI), SAP Business Information Warehouse (BW Query), Generic Interaction Layer (GenIL).
Using the Redefine service, you can reuse the diverse business objects and services, existing in your SAP system landscape. Apart from that, it connects existing service operations, eliminating the need to create an individual service implementation. Accordingly, you can skip the service implementation phase. The Service Builder enables you to redefine both OData services created in NetWeaver Gateway and external services like SPI, BW Query, GenIL that have been created with the help of varied backend frameworks.
You can use this service to incorporate an existing SAP NetWeaver Gateway service without the need to recreate its data model. For enhanced usage, it lets you integrate one or more existing services in a new service. You can even skip the service implementation phase, if you choose to include one or more existing services.
Including an OData service
At the time of creating an association, there may be instances when you wish to link to an existing model without the necessity to recreating it. In such scenarios, you can use the Including OData Service function to include models in the Service Builder and then create associations using the included models.
Let’s take an example of a purchase order. To create a purchase order, we require list of vendors and products. For the purchase order service, two types of master data are required such as vendor and product. You can utilize the Include Model function, since the vendor and product services already exist, enabling you to reuse them.
If you would like to request a demo of Innovapptive’s SAP Certified Mobile Applications, please click on the link. Alternatively, if you would like to discuss with an Innovapptive solution expert, you can reach out to us by emailing us at firstname.lastname@example.org or you can reach a sales representative at (713) 275-1804.