With SAP Netweaver Gateway becoming the platform to seamlessly connect across several devices, it is imperative that data modelling plays a pivotal role in developing applications. Needless to say, the data model you create consists of the operations you want to perform in runtime, mapped to specie data and attributes. Against this backdrop, this white paper probes into the concepts and functionalities of using Data modelling in SAP Gateway with relevant notes and screen shots, wherever applicable.
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Optimize SAP Gateway Data Modeling for Performance
1. Data Modeling in SAP Gateway –
maximize performance at all levels
With SAP Netweaver Gateway becoming the platform to seamlessly
connect across several devices, it is imperative that data modelling plays a
pivotal role in developing applications. Needless to say, the data model you
create consists of the operations you want to perform in runtime, mapped
to specific data and attributes. Against this backdrop, this white paper
probes into the concepts and functionalities of using Data modelling in SAP
Gateway with relevant notes and screen shots, wherever applicable.
Innovapptive Thought Leadership - Data modelling in SAP Gateway
2. Innovapptive Thought Leadership - Data modelling in SAP Gateway
2
Abstract
Data modelling is a process that is used to define and analyze the data requirements as required to support the
business processes, based on the defined scope of an information system within an organization. In order to
achieve data compatibility, a data model needs to be consistently used across the systems. In this context, the
process of data modelling assumes crucial importance with professional data modelers working consistently with
business stakeholders and potential users of the information system to produce the desired results.
Data modelling is the first stage in database design and object oriented programming as the designers initially
create a conceptual model of how data items relate to each other. Data modelling refer to gradual progression from
conceptual model to logical model to physical schema.
This paper starts with an overview of SAP Gateway, appreciating its features and benefits and slowly delves into the
functionality of Data Modelling including its pre-requisites, role of the service builder, concept of data definition
and various services that are available like Redefine and Include. This paper finally provides an overview of Data
Consumption process.
Overview of SAP Netweaver Gateway
SAP NetWeaver Gateway is a technology that offers an easier way to connect devices, environments and platforms
with SAP software, as per the market standards. The framework enables development of intuitive and innovative
people centric solutions leveraging the power of SAP business software into unique experiences like social and
collaboration environments, mobile and tablet devices and rich internet applications.
SAP Netweaver Gateway offers easier provisioning and consumption of business logic and content of SAP backend
systems for mobile and web applications, irrespective of any type of experience, device or developer. The primary
objective is to minimize the complexity and the skill sets required to access SAP data, ensuring that there are no
barriers in deployment. When you have simple interfaces, it also helps to minimize development times.
Simply stated, Netweaver Gateway is a set of ABAP add-ons to your existing SAP ERP system, offering easy access to
your business information. The Gateway provides an API that is designed to act as an easy-to-use and well defined,
providing access to rich repository of business data and functionality in your SAP systems.
3. Innovapptive Thought Leadership - Data modelling in SAP Gateway
3
Prerequisites
Developers create content that can be accessible through SAP NetWeaver Gateway on popular devices such as
iPhone and Blackberry. You can generate content in two methods such as:
Using the content generator to create content swiftly and automatically without the necessity
to write any code
Writing your own code and generating content manually.
Before you commence OData service development, ensure that the following pre-requisites are met:
Use valid system alias to identify the remote system that is used as a data source. The system
alias used when creating a data model also needs to be configured in all the systems for
which the data model is being transported. Also note that though it can point to varied
physical destinations, it must have the same name. If you do not ensure this pre-requisite,
you cannot open the data model from the content generator in those systems.
Configure a managed RFC connection to the system that you can use to retrieve information
from the data source, in case you are using the content generator.
Approach to Data Modelling – Role of Service Builder
SAP Netweaver Gateway Service Builder supports varied development approaches and life cycles to help develop-
ers to have optimum flexibility to ensure that they can fulfill fluctuating development prerequisites and meet
diverse requirements. If developers need a service to expose specific data, they can opt either of the two methods:
1. Define a completely new data model for the new service and integrate their own source
code
2. Reuse and redefine existing services
In case you have a project that you can apply to a similar case, you can create a copy of an entire project and then
execute minimal changes as required. The Service Builder offers numerous ways of reusing existing data sources
from an SAP Business Suite system, thus quickening the development process considerably.
To put it succinctly, the Service Builder caters to all levels of development experience and offers development
approaches that are custom made to help you save time and enhance efficiency, without compromising on quality.
Whichever development approaches you undertake, the appropriate ABAP classes are generated, thus driving
home the point that developers can retain maximum flexibility, when optimizing or extending OData services. The
following phases for OData services are supported by the Service Builder:
1. Data Model Definition (Model Provider Class (MPC))
2. Service Implementation (Data Provider Class (DPC))
3. Service Maintenance
4. Innovapptive Thought Leadership - Data modelling in SAP Gateway
4
Whichever method you adopt, a data model is generated that you can view from transaction SE80 in the ABAP
Workbench. To build your service, you then create a consumption model and incorporate data models to it. The
created data model consist of the operations you want to accomplish at runtime, mapped to a specified data and
attributes. The data model is exposed to SAP NetWeaver Gateway services that trigger the operations that you defined
at design time and also returns data and fields to the end user. For instance, you can generate a data model that reads
customers’names, addresses and contact details for a sales director to have them readily available on his/her mobile
phone.
OData Model Definition
Before you understand how data modelling works in SAP Gateway, let’s first understand what data model definition is
all about.
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
Import
Redefine Service
Include Service
Let’s have a brief overview of each format:
Define a 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 individu-
al data model elements. The data model consists of various sub-folders for each of the element types as listed below:
Entity Types
Complex Types
Associations
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.
5. Innovapptive Thought Leadership - Data modelling in SAP Gateway
5
Double click the specific data model element in the data model folder and enter the relevant informa-
tion.
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.
Import
There are three types of methods for creating a new data model:
Figure 1: SAP Netweaver Gateway Service Builder showing the Create function
DDIC structure (ABAP Data Dictionary)
Data source (RFC/BOR interface)
Data Model
Apply conditional formatting
You can use any of the 3 methods to accomplish the import process:
Figure 2: Import Process
6. Innovapptive Thought Leadership - Data modelling in SAP Gateway
6
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
Views
Database tables
Structures
1. In the SAP NetWeaver Gateway Service Builder, click Data Model -> Import -> Search Help
The following procedure illustrates how you can import the Search Help DDIC structure:
Figure 3: SAP NetWeaver Gateway Service Builder screen
2. In the Wizard Step 1 of 3: Import from Search Help screen, type Mac in the Entity Type
Name box and click Next.
Figure 4: Wizard Step 1 of 3: Import from Search Help screen
7. Innovapptive Thought Leadership - Data modelling in SAP Gateway
77
Figure 5: Wizard Step 2 of 3: Import from Search Help screen
3. In the Wizard Step 2 of 3: Import from Search Help screen, click to select MATNR and then click Next.
3. In the Wizard Step 3 of 3: Import from Search Help screen, select Is K checkbox and then click Finish.
The Search Help DDIC structure gets imported successfully.
Figure 6: Wizard Step 3 of 3: Import from Search Help screen
8. Mobile Quality Management for SAP® ERP
8
Figure 7: Search Help DDIC structure
Innovapptive Thought Leadership - Data modelling in SAP Gateway
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.
The following procedure illustrates how you can reuse existing RFC/BOR parameters:
1. In the SAP NetWeaver Gateway Service Builder screen, click Import and then click RFC/BOR Interface.
Data source (RFC/BOR interface)
Figure 8: SAP NetWeaver Gateway Service Builder screen
9. 9
Innovapptive Thought Leadership - Data modelling in SAP Gateway
Figure 9: Wizard Step 1 of 3: Create Entity Type from Data Source
Figure 10: Wizard Step 2 of 3: Create Entity Type from Data Source
2. In the Wizard Step 1 of 3: Create Entity Type from Data Source screen, type BAPI_CURRENCY_GET
LIST in the Name box and then click Next.
3. In the Wizard Step 2 of 3: Create Entity Type from Data Source screen, type CURRENCY_GETLIST
in the Name box and then click Next.
10. Innovapptive Thought Leadership - Data modelling in SAP Gateway
10
Figure 11: Wizard Step 3 of 3: Create Entity Type from Data Source
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 2 types of projects, such as:
Service with SAP Annotations
Service with Vocabulary-Based Annotations
Data model
4. In the Wizard Step 3 of 3: Create Entity Type from Data Source screen, select Create Default Entity
Set check box and click Finish. The (RFC)/ (BOR) parameters gets imported.
Figure 12: Import of RFC/BOR parameters
11. Innovapptive Thought Leadership - Data modelling in SAP Gateway
11
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 OData Service (GW) function, you can perform the following activities:
Redefine a service: Select this option if you want to redefine a service for the first time in the
Service Builder.
Extend the existing model: Select this option if you intend to incorporate more artifacts into
your model from an existing model. In case your model already has artifacts from a refer
ence model, you can include more artifacts from this model only.
Overwrite existing model: Select this option to overwrite the existing model in the Service
Builder with a new model from a diverse service.
Redefine service
Once you choose one of the redefinition options, you are provided with various options to choose the appropriate
service you want to redefine (note that you can select only those services that are registered in the current SAP
Business Suite backend system). Once you have selected the service, the model is displayed in a tree view, enabling
you to select the required artifacts (entity types, associations, function imports) for the new model. This Modification
Generator lets you make certain restricted modifications in the services that are created with the help of external
framework like SAP Business Information Warehouse (BW), Service Provider Interface (SPI), and Generic Interaction
Layer (GenIL). For instance, these service might not have a proper label or might not require all the artifacts. In these
cases, the Modification Generator lets you make cosmetic changes without changing the underlying data provider
class and accordingly reuses the existing model.
Two new DPC classes get generated during the generation process. The new DPC inherits from the existing (original)
service, resulting in the availability of the logic for the existing (original) service. The new DPC extension class inherits
from the new DPC base class, letting you to edit the logic for your service.
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 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).
12. 12
Innovapptive Thought Leadership - Data modelling in SAP Gateway
Include service
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.
However, there are certain prerequisites for using this service, which are as follows:
The service of the external data model should be present on the SAP NetWeaver Gateway
hub system and be up and running.
In order to incorporate a model from an external system, you need to have a system with
NetWeaver Gateway SP05 (Software Component IW_BEP 200 SP05)
Figure 13: SAP NetWeaver Gateway Service Builder screen showing Import function
Figure 14: SAP NetWeaver Gateway Service Builder screen showing Import function
13. 13
Innovapptive Thought Leadership - Data modelling in SAP Gateway
Create a Consumption Model
A consumption model denotes an OData service by bundling a set of SAP NetWeaver Gateway data models for a
specific consumption use case. Each data model is represented by one or more corresponding entity types or
collections in the resulting service.
You can create a consumption model using the ABAP Workbench design time in transaction SE80 and consequently
add data models to it. Apart from that, you can also create a consumption model and assign it to a particular data
model in the tree view.
Please note that you need to create the consumption model and the data models within it on the same channel,
which means, you cannot add a data model that was created on the OData Channel to a consumption model that
was created on the Generic channel and vice versa. Apart from that, you cannot incorporate data models that were
created on both channels in the same consumption model.
Conclusion
This white paper provided an overview of SAP NetWeaver Gateway and threw light on the Data Modelling
functionality that is widely used in developing applications using SAP NetWeaver Gateway. Apart from providing a
brief snapshot of how SAP Gateway works and its core functions, this white paper covered the concepts of Data
Modelling in a conceptual manner starting from defining the data definition, various services like Redefine and
Include that can be leveraged to make your job simpler, saving your considerable time and at the same time
providing a robust data model.