Skip to content

Updates due to product changes #23012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ author_profile: https://github.com/manuel-stampp
### Create or upload the data model and prepare environment


1. To create a cached service with MBT, you can either upload an existing metadata file or you can use the graphical tools in SAP Business Application Studio to start from scratch.
1. To create a cached service with MBT, you should start with an metadata XML file that you can further edit in XML editor.

- For this tutorial please continue editing or copy the MBT project from [Create a simple OData Service with Mobile Back-End Tools](cp-mobile-backend-tools-simple-odata) mentioned in prerequisites. This is not only about the metadata, but also about service instance creation and binding which are not repeated within this tutorial.

Expand All @@ -53,7 +53,7 @@ author_profile: https://github.com/manuel-stampp

![Subaccount destinations](img_http_destination.png)

- This tutorial assumes that you completed the tutorial [Connect SAP Cloud Platform to Your SAP Gateway Demo System Account (ES5)](cp-portal-cloud-foundry-gateway-connection) where you registered for an ES5 user and learned how to manage an SAP BTP destination. You can alternatively rename your existing `ES5` destination and append the OData service's sub-path ``/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/``to the URL of the destination.
- This tutorial assumes that you completed the tutorial [Connect SAP BTP to Your SAP Gateway Demo System Account (ES5)](cp-portal-cloud-foundry-gateway-connection) where you registered for an ES5 user and learned how to manage an SAP BTP destination. You can alternatively rename your existing `ES5` destination and append the OData service's sub-path ``/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/``to the URL of the destination.

3. Back in SAP Business Application Studio, to allow consumption of the destination in your application, add a service instance of type destination to your application's `mtad.yaml`.

Expand All @@ -70,8 +70,7 @@ author_profile: https://github.com/manuel-stampp
At the end of the file (resources section), paste the following:

```YAML
-
name: MbtEpmDemoService-destination
- name: MbtEpmDemoService-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
Expand All @@ -87,8 +86,7 @@ author_profile: https://github.com/manuel-stampp
_schema-version: "3.3"
version: 1.0.0
modules:
-
# application
- # application
name: MbtEpmDemoService
# module
path: srv/target/odata-service-1.0.0.war
Expand All @@ -105,12 +103,10 @@ author_profile: https://github.com/manuel-stampp
- name: MbtEpmDemoService-destination
# Providing default-url can be re-used for the app router
provides:
-
name: mbtepmdemo-odata
- name: mbtepmdemo-odata
properties:
url: ${default-url}
-
# approuter
- # approuter
name: MbtEpmDemoService-approuter
type: nodejs
path: srv/approuter
Expand All @@ -128,15 +124,13 @@ author_profile: https://github.com/manuel-stampp
{"name":"odata","url":"~{mbtepmdemo-odata/url}","forwardAuthToken": true}
]
resources:
-
name: MbtEpmDemoService-xsuaa
- name: MbtEpmDemoService-xsuaa
type: org.cloudfoundry.managed-service
parameters:
service: xsuaa
service-plan: application
path: srv/xs-security.json
-
name: MbtEpmDemoService-destination
- name: MbtEpmDemoService-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
---
parser: v2
author_name: Manuel Stampp
author_profile: https://github.com/Manuel-Stampp
title: Understand Full-Stack Development with Mobile Back-End Tools
description: Understand how SAP Mobile Services Mobile Back-End Tools (MBT) can solve common mobile offline challenges.
keywords: tutorial
auto_validation: true
time: 10
tags: [ tutorial>beginner, topic>mobile, products>sap-business-technology-platform, products>sap-mobile-services, products>sap-business-application-studio]
primary_tag: topic>mobile

parser: v2
---


# Understand Full-Stack Development with Mobile Back-End Tools
<!-- description --> Understand how SAP Mobile Services Mobile Back-End Tools (MBT) can solve common mobile offline challenges.

## Prerequisites
- It might be helpful to know the [Basic concepts of OData protocol](odata-01-intro-origins) for better understanding of the topic.
- It might be helpful to know the [Basic concepts of OData protocol](odata-01-intro-origins) for better understanding of the topic.

## You will learn
- Why you might want to use Mobile Back-End Tools
- What is the relation between OData and the database
- Why you might want to cache data for a mobile use case
- How client registrations and filters can solve some common mobile offline challenges

---

### Introduction to Mobile Back-End Tools

- Why you might want to use Mobile Back-End Tools
- What is the relation between OData and the database
- Why you might want to cache data for a mobile use case
- How client registrations and filters can solve some common mobile offline challenges

## Intro
In essence, MBT is a set of tools that allow you to generate a full featured OData web service without writing a line of code. The tools are designed to transparently convert OData models into a persistence and offer transparent OData functionality including delta calculations out of the box.

Beyond that over-simplification, MBT, as a feature of SAP Mobile Services, is a set of tools that have the target of solving several challenges which may arise in mobile application's synchronisation for offline capabilities.
Expand All @@ -33,85 +32,66 @@ Therefore they offer (optional) features, e.g. targeting integration (as a cache

MBT is available as a [Marketplace extension](https://marketplace.visualstudio.com/items?itemName=SAPSE.vsc-extension-mbt) for Visual Studio Code or as part of SAP Business Application Studio in the preset for *"SAP Mobile Application"*.



### What you will build


This tutorial and it's mission will give you an introduction to possible usage of Mobile Back-end Tools [Cache Databases](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/cache-databases.html). It is intended to give a simplified scenario with technical introduction of the technology while keeping requirements also available to trial users.

You can run so-generated OData services in SAP Business Technology Platform (BTP) or on Premise (on Apache Tomcat, TomEE or Eclipse Virgo).

- If you plan to run the generated service in SAP BTP
- If you plan to run the generated service in SAP BTP

- SAP Business Application Studio will be better choice for most developers as it allows you to leverage the same environment during design time and run time.
- SAP Business Application Studio will be better choice for most developers as it allows you to leverage the same environment during design time and run time.

- The CSDL graphical modeler is only available in SAP Business Application Studio.
- SAP Business Application Studio as a cloud solution will run out of the box with the preset for *SAP Mobile Services* and does not require a manual setup of your development environment as well as being OS agnostic

- SAP Business Application Studio as a cloud solution will run out of the box with the preset for *SAP Mobile Services* and does not require a manual setup of your development environment as well as being OS agnostic
- If you plan to run the generated service in an on premise architecture

- If you plan to run the generated service in an on premise architecture
- You can still connect it via SAP Cloud Connector to SAP Mobile Services, but you might want to generate and develop the service in an on-premise architecture leveraging the Visual Studio Code extension for mobile back-end tools

- You can still connect it via SAP Cloud Connector to SAP Mobile Services, but you might want to generate and develop the service in an on-premise architecture leveraging the Visual Studio Code extension for mobile back-end tools

- For Visual Studio Code you need to [setup your own environment locally](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/setup.html#visual-studio-code-extension)
- For Visual Studio Code you need to [setup your own environment locally](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/setup.html#visual-studio-code-extension)

The following diagram depicts an exemplary architecture for an MBT-based service in mobile solution context:
![Example target architecture](img_target_arch.png)

>In this tutorial's mission, the target system is connected as a publicly available HTTP destination. In a real-world scenario, you might connect your system in a similar way if it is a cloud system or via SAP Cloud Connector if it is an on premise system.



### Role of CSDL and database


OData's declarative way of defining the model as well as operations works in a way that allows a mapping between OData operations and operations on an actual database.

Therefore, usually MBT's central starting point is the metadata file, respectively Common Schema Definition Language (CSDL) document. In SAP Business Application Studio, MBT can leverage the CSDL graphical modeler to simplify working with OData models.
Therefore, usually MBT's central starting point is the xml-based metadata file, respectively Common Schema Definition Language (CSDL) document.

On the one hand, MBT provides runnable tasks that generate a database persistence or persistence descriptor (SQL), reflecting the whole OData model. On the other hand, MBT can build a transparent OData service [based on existing database tables](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/existing-tables.html).

Different database types are supported depending on the runtime. Following databases may e.g. be used with the tools in certain environments (Derby and H2 only for testing, please refer to [documentation](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/service-generator.html#option-bind-db-typedb-name) and/or Product Availability Matrix for official support statements):

- SAP ASE

- Apache Derby
- SAP ASE

- H2 database
- Apache Derby

- SAP HANA
- H2 database

- Azure SQL or Microsoft SQL Server
- SAP HANA

- Oracle Database
- Azure SQL or Microsoft SQL Server

- PostgreSQL
- Oracle Database

- SAP SQL Anywhere
- PostgreSQL

- SAP SQL Anywhere

### Benefit of caching mobile app data


Most of the applications built in an enterprise environment are not a stand-alone use case but must be integrated into existing ecosystems, data and business processes. Therefore, MBT offers to link and map operations on your OData service to operations on another interface.

Typically, when developing a new Mobile App, you have to choose a technology as best-fit for your architecture. You can therefore build new services on the source system, replicate data to another system or cache relevant parts of your data for easy-to-use mobile consumption.

This may come in handy if you want to build a service on top of legacy interfaces, if you want to decrease load on the referenced system or if you want to add more efficient delta capabilities for better user experience of your client apps without modifying the back-end interface.


### Benefit of client registrations


In MBT, [Client Registrations](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/client-registrations.html), beyond the user identity, reflect one specific offline data store. This identification allows precise change determination beyond timestamp-based calculation, especially in combination with client filters.

A client registration requires the service to contain an entity on which an offline store registers with a `uuid`. This ID must be sent with any upcoming user request in the HTTP-header `Client-Instance-ID`.


### What is a Client Filter?


Many use cases shall allow the user to select what data can be downloaded into the client database.

This can e.g. be geographical, organisational or historical requirements. MBT therefore allows `ClientFilter`-annotated entities that are supposed to be leveraged in [custom download queries](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/change-tracking.html#download-queries-using-filter-entities) for a specific offline store.
Expand All @@ -120,11 +100,6 @@ After registering to the service, clients can therefore upload one or more entit

Example:

- A sales representative working in one specific area on a specific day could upload a filter to only retrieve customer data with sales orders for customers in that specific area within the last two years.


---
- A sales representative working in one specific area on a specific day could upload a filter to only retrieve customer data with sales orders for customers in that specific area within the last two years.

**Congratulations!** You have now learned about some of the features MBT offers, so you can proceed to try them out in this mission's further tutorials.

---
Binary file modified ...ials/cp-mobile-backend-tools-simple-odata/animation_create_approuter_files4.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading