When you start with HANA Cloud Platform, you can find a vast amount of documentation, tutorials, online trainings. This information makes it easy to get your first application up and running. However, during our last month in developing on HCP, we found that there is a gap between the examples and a real-life application. This is, of course not a miracle, and, of course, when you start to build a real-life application, you have to think about your programming model and application architecture. In this blog series, I would like to present a programming model that fits business applications with the assumptions listed below.
The programming model that I discus in this blog is “implementation-agnostic”. But, to make it more tangible and discuss it based on a concrete example, I implement the model using the SAP HANA native development approach using HANA CDS defining the data models and HANA XS (XS OData and XS JavaScript) implementing the server side. For the UI side, I implement a small SAP UI5 mobile UI.
The programming model described in this document is based on the following application characteristics that apply for enterprise business applications.
General assumptions:
Assumptions 1 to 4 state that application logic has to be performed on the server side. This
application logic consists of:
Figure 1: Service Adaptation Layer and Business Object Layer
As mentioned before, I will show an example implementation using the SAP HANA native development approach with HANA CDS for defining the data models and HANA XS (XS OData and XS JavaScript) for implementing the server side. For the UI side, I implement a simple SAP UI5 mobile UI (split app).
So, on the server side, the boxes in Figure 1 correspond with the following artifacts:
Box in Figure 1 | Implementation in XS |
---|---|
Protocol Handler (e.g. OData) | XS OData Service |
Service Adaptation: Read service | Database View (CDS) |
Service Adaptation: CUD Service | JavaScript Library (Exit implementation of the XS OData Service) |
BO: BO Read | Database View (CDS) |
BO: Table | Database Table (CDS) |
BO: CUD Services | JavaScript Library |
BO: Business Logic | JavaScript Library / SQL procedure |
At runtime the service provider simply interprets the client request (for example the filter, order clause, etc.), reads the data from the database view and converts the result into the protocol format (for example OData). In Figure 1, the boxes labeled with “Read service” and “BO Read” are implemented as database views.
For a write request, the data transformation has to be implemented. In Figure 1, the boxes labeled with “CUD services” and “CUD / Action API” and “Business Logic” are implemented in a programming language (for example JavaScript), boxes “Business Logic (SQL)” are implemented with database means (for example SQL Script).
Figure 2: Entity model of a Sales Application
Figure 2 shows the entity model of a sales application. It is simplified in comparison to the models that are used in the SAP CRM or SAP Business ByDesign, but it contains examples for real life “complexity”, such as “realistic” calculated fields and time dependency (here for a customer’s address). We will use this example for a discussion of the assumptions and building blocks introduced earlier and for implementation in the following posts.
The (simplified) entity model of the Business Partner is shown in the middle of the Figure. It consists of a business partner business object with 3 entities (Business Partner “main” or “root” entity, a Customer entity that stores customer-specific data, and an Address Information entity that holds the reference to addresses (time-, type- and role-dependent). We ignore the fact that the business partner’s name and other common elements may change over time and model them in the Business Partner “header” entity. The sub-entities Customer and Address Information show patterns that can be repeated for other business partners, for example Empoyee, Supplier, Contact, etc. and other business partner details, for example time-dependent Name and Identification, Bank Details, Business Partner Relationship, and so on.
The Address business object stores an address as a re-usable entity.An address can be used (referenced) from multiple business documents. This, however, means that an address cannot be changed once it was used in a business document. Instead a new address is created when a user changes an address on the UI. Let us have a look at the following use cases and their representation in the entity model:
In the simplified model, I have modelled the address as a flat structure. In reality, many address components (for example phone numbers) may have multiple records, so you would model them as separate entities. The postal address may be stored in multiple script codes (Latin, Chinese, …) to support global business.
The Sales Territory business object stores the assignment of customers to sales territories, which are used to manage access and responsibilities for sales operation. In our example application, a sales rep should be allowed to manage only sales orders for customer in territories he/she is assigned to.
The Sales Order business object consists of three entities, the Sales Order (header information), the Item entity and the Party entity. I think that header and item is self-explaining to everybody who bought something. The party is introduced as an entity to store all involved parties (for example account, ship-to party, sales representative) in a normalized way. The Party entity allows to flexibly add additional parties, for example a service performer when it comes to selling services.
Based on the entity model, we will discuss two UIs in the next blog series:
Figure 3
Figure 4
The next blog in this series shows the implementation of the entity model using HANA CDS: go to A Programming Model for Business Applications (2): Implementing the Entity Model with CDS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
44 | |
23 | |
17 | |
15 | |
11 | |
9 | |
7 | |
7 | |
7 | |
7 |