Developing Transactional Apps from Scratch

Introduction

Let us assume you have to develop a completely new transactional application for SAP Fiori UI in such a way that the persistence model does not provide any GUIDs as primary keys to the consumer, but application-specific semantic keys.

In this chapter, we will develop - step by step - quite a simple sales order application, starting with the creation of a basic persistence model. We will then define a normalized data model, followed by the provision of a service-specific consumption view. After this, we are going to build a Fiori UI using Smart Templates as Fiori building blocks and test the resulting app within the SAP Fiori Launchpad. In our final step, we will extend the application’s business logic with actions that are implemented with the help of BOPF API.

Persistency and Data Model

As with any other business application, a set of database tables and other Dictionary objects defines the persistence model of a transaction application. As a data source for a business object to be generated, a database table needs to be provided for each so-called business object CDS view (also referred to as business object views). Generally, business object views are normalized CDS views that define the hierarchy of entities by using associations and @ObjectModel annotations. A business object view is defined on top of the underlying database table or the CDS view and exposes all elements that are defined in the SELECT list, including the key elements that correspond to the primary keys of the underlying database table. In the transactional scenario of the programming model for SAP Fiori, the business object view is required for business object generation on the basis of the BOPF framework.

A consumption CDS view (also referred to as consumption view) allows the consumption of a business object view in a different manner by different OData services. Each service-specific view is defined on top of a business object view and exposes its fields. A consumption view enhances the data model with metadata, additional associations, or even with transient fields that fit to a given consumption use case. In particular, the consumption views are used to enhance the data model with UI-specific annotations for later consumption in Fiori UIs.

Persistency and Data Model
Figure 39: Persistency and Data Model