PUBLIC Document Version: 1.0 – 2018-11-14

Using SAP Cloud Platform Mobile Service, mobile development kit company. All rights reserved. affiliate

THE BEST RUN 2018 SAP SE or an SAP © Content

1 Developing Apps Using the Mobile Development Kit...... 4

2 Language Support...... 7

3 Administrator Guide...... 8 3.1 Getting Started...... 8 3.2 Creating MDK Apps on SAP Cloud Platform Mobile Service for Development and Operations...... 9 3.3 Setting Up App Security...... 10 3.4 Setting Up SAP Web IDE Full-Stack to Work with Mobile Development Kit...... 10 Creating Destination for Mobile Services in Neo Environment...... 11 Creating Destination for Mobile Services in Cloud Foundry Environment...... 12 3.5 Managing Your App Life Cycle with App Update ...... 13 3.6 Building your MDK Client SDK...... 14 3.7 Branding Your Customized App...... 16

4 Business Process Expert Guide...... 24 4.1 Setting Up the Editor in SAP Web IDE Full-Stack...... 24 4.2 Importing App Metadata into the Editor...... 25 4.3 Cloning App Metadata from Git Repository...... 25 4.4 Reusing App Components...... 26 4.5 Deploying App Metadata from Editor to Mobile Services...... 27 4.6 Creating a New Project Using an Editor Template...... 28 Metadata Definitions...... 29 Metadata Validation...... 166 Migrating App Metadata...... 167

5 Developer Guide...... 169 5.1 Customizing Advanced Rules...... 169 5.2 Creating Extension Controls with Nativescript...... 173 5.3 Creating Custom Extension Controls in Swift...... 174

6 MDK Extension for Visual Studio Code...... 176 6.1 Installing MDK Extension for Visual Studio Code...... 177 6.2 Editing Metadata with MDK Language for VS Code...... 177 6.3 Bundling MDK App with VS Code Build Task...... 180 6.4 Debugging MDK App with VS Code Debugger...... 182 6.5 Creating MDK metadata object with VS Code editor...... 183 Creating a new MDK metadata object using the Command Palette...... 183

Using SAP Cloud Platform Mobile Service, mobile development kit 2 PUBLIC Content Creating a new MDK metadata object using the context menu...... 184 Creating a CIM file using the context menu...... 184 6.6 Restrictions and Troubleshooting...... 184

7 Mobile Backend Generator...... 186 7.1 Generating an OData Service...... 186 Customizing the Generated Service...... 188 Server OData API...... 191 7.2 Deploying the Generated Service...... 192 Deploying to SAP Cloud Platform – Neo...... 193 Deploying to SAP Cloud Platform – Cloud Foundry...... 194 7.3 Monitoring the Generated Service...... 195 Monitoring the Generated Service – Neo...... 196 Monitoring the Generated Service – Cloud Foundry...... 196 7.4 Securing the Generated Service...... 197 SAP Cloud Platform Security...... 201 7.5 Appendix...... 205

8 User Guide...... 210 8.1 Onboarding to the MDK Client App...... 210 8.2 Installing the App on a User's Device...... 211 8.3 Updating an App on a User's Device...... 212

Using SAP Cloud Platform Mobile Service, mobile development kit Content PUBLIC 3 1 Developing Apps Using the Mobile Development Kit

The Mobile Development Kit for SAP Cloud Platform Mobile Services is a metadata-based application development platform.

The Mobile Development Kit (MDK) lets you customize, deploy, and manage your customized apps in the cloud. The Mobile Development Kit editor lets you edit various aspects of your application using the MDK editor. It also provides native client support and consumes mobile services such as onboarding, offline OData, life cycle management, and supportability through the SAP Cloud Platform using the Mobile Development Kit client.

MDK allows business process experts to customize the app in a cloud-based editor using the SAP Web IDE for Full-Stack Development, and developers to edit code directly in the metadata files.

The end-to-end use case for MDK includes tasks involving the following roles:

● Administrator ● Business process expert ● Developer ● User

Depending on your company and setup, you may have variations of this role breakdown. The workflow below is intended to help you set up your system and get started with using MDK. The typical task order is top-down, based on the roles noted above. You might not need to perform some of these tasks based on what you are trying to accomplish. The following workflow is a suggested use case only.

Using SAP Cloud Platform Mobile Service, mobile development kit 4 PUBLIC Developing Apps Using the Mobile Development Kit

Using SAP Cloud Platform Mobile Service, mobile development kit Developing Apps Using the Mobile Development Kit PUBLIC 5 ● Getting Started [page 8] ● Creating MDK Apps on SAP Cloud Platform Mobile Service for Development and Operations [page 9] ● ● Setting Up the Editor in SAP Web IDE Full-Stack [page 24] ● Importing App Metadata into the Editor [page 25] ● Creating a New Project Using an Editor Template [page 28] ● Customizing Advanced Rules [page 169] ● Creating Extension Controls with Nativescript [page 173] ● ● Managing Your App Life Cycle with App Update [page 13] ● ● Building your MDK Client SDK [page 14] ● Installing the App on a User's Device [page 211] ● ● Updating an App on a User's Device [page 212]

Using SAP Cloud Platform Mobile Service, mobile development kit 6 PUBLIC Developing Apps Using the Mobile Development Kit 2 Language Support

The Mobile Development Kit SDK includes localized versions of end-user facing texts that are part of the UI controls.

End-user facing texts have been translated into these languages:

● English (en) ● German (de) ● French (fr) ● Portugese (pt) ● Spanish (es)

To know about locale based formatting in the MDK editor, see the following topics:

● Internationalization and Localization of App Metadata [page 32] ● Usage of Internationalized and Localized Data [page 35]

Using SAP Cloud Platform Mobile Service, mobile development kit Language Support PUBLIC 7 3 Administrator Guide

The following tasks are typically completed by an administrator.

Getting Started [page 8] Set up your landscape to begin using Mobile Development Kit.

Creating MDK Apps on SAP Cloud Platform Mobile Service for Development and Operations [page 9] As an administrator, you can create MDK applications using the Mobile service for development and operations cockpit, in both Neo and Cloud Foundry environment.

Setting Up App Security [page 10] After creating your application, you can define the initial app security configuration to allow for the Mobile Development Kit editor to set up the service connection.

Setting Up SAP Web IDE Full-Stack to Work with Mobile Development Kit [page 10] Set up SAP Web IDE for Full-Stack Development to work with Mobile Development Kit by subscribing to it in the cloud, creating destinations, configuring Git, and connecting remote systems.

Managing Your App Life Cycle with App Update [page 13] While creating a new app using the Mobile service for development and operations cockpit, if you specify Mobile Development Kit as the app type, then the App Update feature is assigned to the app by default.

Building your MDK Client SDK [page 14] Build and run the MDK client to connect to your SAP Cloud Platform mobile application. You can also package your app so that it can be posted to the iOS Enterprise App Store.

Branding Your Customized App [page 16] Brand your app to customize it based on your company's requirements before you post it to the Enterprise App Store.

3.1 Getting Started

Set up your landscape to begin using Mobile Development Kit.

Begin by setting up the following:

Set up Description Link

SAP Cloud Platform Cockpit Set up SAP Cloud Platform cockpit to Getting a Global Account build, deploy, and manage your applications.

SAP Cloud Platform Mobile Service for Set up SAP Cloud Platform Mobile Getting Started with SAP Cloud Development and Operations Service for Development and Platform Mobile Service for Operations cockpit to administer your Development and Operations applications.

Using SAP Cloud Platform Mobile Service, mobile development kit 8 PUBLIC Administrator Guide Set up Description Link

Mobile Development Kit Set up Mobile Development Kit SDK for Building your MDK Client SDK [page metadata-based rendering of your 14] applications.

3.2 Creating MDK Apps on SAP Cloud Platform Mobile Service for Development and Operations

As an administrator, you can create MDK applications using the Mobile service for development and operations cockpit, in both Neo and Cloud Foundry environment.

Context

This interface enables you to manage your apps.

You can view information about the APIs, user registrations, and usage analytics of your MDK app type. You can also perform operations such as delete, export, and publish on your app though this interface.

Procedure

1. On the Home screen of the mobile service for development and operations cockpit, select Create new app. 2. From the Config Templates list, select Mobile Development Kit. 3. Fill in the other details, such as ID, name, description, and vendor. For more information about these fields, see Defining Applications in the SAP Cloud Platform documentation.

Once you have created your application, you see a list of features that are automatically assigned to the app.

 Note

For an MDK app type, the App Update feature is assigned to your app by default if you are accessing the SAP Cloud Platform cockpit in the Neo environment.

If you are accessing the SAP Cloud Platform cockpit in the Cloud Foundry environment, manually add the Connectivity feature (used for retrieving backend data) and the App Update feature (used for deploying the app).

4. To view a list of all your apps, select Projects Mobile Applications Native/Hybrid . 5. Click on the desired app to see the Application Details screen, which shows the ID, name, description, vendor, and a list of features assigned to the app. 6. To add features to your app, select the + button on the right side of your Assigned Features list, choose or search for a desired feature and click OK.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 9 Alternatively, you can select your desired feature from the Features screen and select Add to Application.

3.3 Setting Up App Security

After creating your application, you can define the initial app security configuration to allow for the Mobile Development Kit editor to set up the service connection.

Procedure

1. From the Assigned Features list for your app, click Security Configuration . 2. In the Application Settings pane, provide the value for the Security Configuration parameter as OAuth.

3. Click Save OK .

3.4 Setting Up SAP Web IDE Full-Stack to Work with Mobile Development Kit

Set up SAP Web IDE for Full-Stack Development to work with Mobile Development Kit by subscribing to it in the cloud, creating destinations, configuring Git, and connecting remote systems.

Set up Description Procedure

SAP Web IDE for Full-Stack Enable SAP Web IDE for Full-Stack Opening SAP Web IDE Development Development in the cloud.

Destination for mobile services Create destinations for mobile services Creating Destination for Mobile on the SAP Cloud Platform cockpit, to Services in Neo Environment [page connect to the backend system and to 11] upload your MDK app metadata.

You can create your destinations in Creating Destination for Mobile either Neo or Cloud Foundry platform, Services in Cloud Foundry Environment based on the environment you use to [page 12] access the SAP Cloud Platform cockpit.

Git Configure the corporate Git Connecting to your Corporate Git connectivity service to manage the System metadata sources.

Using SAP Cloud Platform Mobile Service, mobile development kit 10 PUBLIC Administrator Guide 3.4.1 Creating Destination for Mobile Services in Neo Environment

If you are accessing the SAP Cloud Platform cockpit in the Neo environment, you can create a destination for mobile services and connect to the back-end system from the MDK editor.

Procedure

1. Go to the SAP Cloud Platform cockpit from SAP Web IDE Full-Stack by selecting Tools SAP Cloud Platform Cockpit .

2. In the SAP Cloud Platform cockpit, select Connectivity Destinations New Destination to create a new destination for mobile services. 3. In the Destination Configuration wizard, enter the following:

Field Value

Destination Name Provide a name for the destination.

Type HTTP

Description Provide a description for your destination. This is optional.

URL Provide the URL that the app uses to access data on the back-end system or service.

Proxy Type Internet

Authentication AppToAppSSO

HandleRedirects false

SkipSSOTokenGenerationWhenNoUser true

WebIDEUsage mobile

WebIDEEnabled true

 Note

Not all the values appear in the drop-down menu. For any values not appearing, type in the name of the property.

4. Check the Use default JDK truststore option. 5. Click Save.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 11 3.4.2 Creating Destination for Mobile Services in Cloud Foundry Environment

If you are accessing the SAP Cloud Platform cockpit in the Cloud Foundry environment, you can create a destination for mobile services and connect to the back-end system from the MDK editor.

Procedure

1. Go to the SAP Cloud Platform cockpit from SAP Web IDE Full-Stack by selecting Tools SAP Cloud Platform Cockpit .

2. In the SAP Cloud Platform cockpit, select Connectivity Destinations New Destination to create a new destination for mobile services. 3. In the Destination Configuration wizard, enter the following:

Field Value

Destination Name Provide a name for the destination.

Type HTTP

Description Provide a description for your destination. This is optional.

URL Provide your mobile service URL that the app uses to ac­ cess data on the back-end system.

In the URL, include the organization and space informa­ tion that you provided while logging in to your Cloud Foun­ dry environment.

The format for the URL is https:///org/ /space//.

Proxy Type Internet

Authentication BasicAuthentication

In the Cloud Foundry environment, only basic authentica­ tion is supported in runtime.

If you select the AppToAppSSO authentication type, it will downgrade to Basic in runtime, and prompt you to provide your username and password.

HandleRedirects false

SkipSSOTokenGenerationWhenNoUser true

WebIDEUsage mobile

WebIDEEnabled true

Using SAP Cloud Platform Mobile Service, mobile development kit 12 PUBLIC Administrator Guide  Note

Not all the values appear in the drop-down menu. For any values not appearing, type in the name of the property.

4. Check the Use default JDK truststore option. 5. Click Save.

3.5 Managing Your App Life Cycle with App Update

While creating a new app using the Mobile service for development and operations cockpit, if you specify Mobile Development Kit as the app type, then the App Update feature is assigned to the app by default.

Context

Use App Update to keep your apps and app configurations up-to-date, maintain multiple versions, and manage the apps' life cycles.

Procedure

1. Select the App Update Configuration tab to display the configuration page, where you can view the version details of your app:

○ New - a version that has been uploaded to the cockpit, but not yet deployed to users. ○ Current - the version that is currently being used by users.

The new versions of the app appear on the configuration page if it was deployed directly from SAP Web IDE Full-Stack. For details, see Deploying App Metadata from Editor to Mobile Services [page 27]. 2. If deploying the app metadata directly from SAP Web IDE Full-Stack fails, select the Upload icon in the top- right corner. Import the .zip file containing the app metadata for the new version of your app from your local system, and then click Upload.

The status of a newly uploaded app or a newer version of an app appears as New Version.

3. To deploy the new app version to the Current state, select Actions Deploy . 4. (Optional) To delete a new version of the app, select the Delete icon. You cannot delete an app in the Current state, you must instead deploy a new version to the Current state.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 13 3.6 Building your MDK Client SDK

Build and run the MDK client to connect to your SAP Cloud Platform mobile application. You can also package your app so that it can be posted to the iOS Enterprise App Store.

Prerequisites

Before building your MDK Client SDK, you must install some prerequisites.

To do this easily, run the MDK Dependencies Installer.app tool contained within the MDK_SDK-2.1.000-Universal.zip folder. This checks and prepares the environment for the MDK client development by automatically detecting all the components you need to install or update, and allowing you to install them instantly.

Alternatively, you can install the following prerequisites manually:

● Homebrew using the following command: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/ install)" ● Update Homebrew using the following command: brew update ● NodeJS version manager using the following command: brew install nvm ● NodeJS version using the following command: nvm install ● Use proxy settings for Node.js (only needed if a proxy is used) using the following commands: config set proxy $http_proxy npm config set https-proxy $https_proxy ● Cocoa Pods using the following command: $ sudo gem install version (install from App Store) using the following command: gem install xcodeproj ● NativeScript version (install via npm) using the following command: npm install --global nativescript@

To know about the currently supported versions of all the above software and the supported devices, see the README_SDK_Installer.md file in the MDKClient_SDK.zip folder bundled within the MDK_SDK-2.1.000- Universal.zip folder.

Procedure

1. Download the MDK Client SDK from the SAP Store . Registration is required. 2. Install the SDK dependencies by running the install.command command from the terminal or finder. The create-client.command file appears in the SDK directory.

Using SAP Cloud Platform Mobile Service, mobile development kit 14 PUBLIC Administrator Guide 3. Browse to the MDKClient_SDK.zip folder within the MDK_SDK-2.1.000-Universal.zip folder, and unzip the MDKClient_SDK.zip file to a workspace, such as …/MDK_Workspace/MDKClient_SDK/.

The unzipped file should contain the following folders and files: ○ App_SDK/ ○ application.definitions/ ○ Branding.md ○ CustomControls.md ○ ExtensionSample/ ○ Frameworks/ ○ MDCFramework/ ○ install.command ○ README_SDK_Installer.md ○ template.mdkproject/ ○ tools/ 4. Modify the MDKProject. and BrandedSettings.json files to specify information like application connection, passcode policy settings, application icon, etc. To know more about how you can brand your app, see Branding Your Customized App [page 16]. 5. Place your app definition files in the application.definitions folder. If you do not have a default bundled app, a script is provided to generate an app from your application definitions. 6. Create the SDK client by running the create-client.command command. You must provide the path to a valid .mdkproject directory. 7. To run the app on the iOS Simulator, use the tns run --emulator command. 8. To run the app on an iOS device, use the tns run ios --device command. You can find the value of the device identifier by attaching the device to your mac system and running the tns device ios command. 9. To run the app in XCode, open the generated project in XCode and in the Identity section, and add a provisioning profile team ID and an application bundle ID. 10. To generate the IPA for an iOS device, use thetns build ios --for-device --release command. You can also generate the IPA using the Creating an iOS App File instructions on the Apple Developer website .

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 15 3.7 Branding Your Customized App

Brand your app to customize it based on your company's requirements before you post it to the Enterprise App Store.

You can personalize an app before making it available to users on the Enterprise App Store, by making changes in the .mdkproject directory. Components that you can brand include:

Application connection information

The configured file will be copied into the generated project at /app/branding/ BrandedSettings.json. To update the branded settings without having to run the create- client.command script again, modify the file in the project and redeploy the app.

You can find the application connection information in the MDKClient_SDK/branding/ BrandedSettings.json file.

● AppID ● ClientID ● SapCloudPlatformEndpoint ● AuthorizationEndpointUrl ● TokenUrl ● RedirectUrl ● ServiceTimeZoneAbbreviation

The settings mentioned above are required for onboarding the end-user to the MDK client app.

Passcode policy settings

Use the PasscodePolicySettings property to specify the settings for passcode.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Setting Description

IsDigitsOnly The passcode should contain only digits if this property is true. If the property is true, HasDigit, HasUpper, HasLower, and HasSpecial settings are all ignored.

MinLength The minimum number of characters in passcode. The validate function returns false if the length of the passcode is fewer characters than specified in this setting.

Using SAP Cloud Platform Mobile Service, mobile development kit 16 PUBLIC Administrator Guide Setting Description

HasLower Indicates whether the passcode is required to use lowercase characters. The validate function returns false if HasLower is true, but there aren't any lowercase characters in the passcode.

HasUpper Indicates whether the passcode is required to use uppercase characters. The validate function returns false if HasUpper is true, but there aren't any uppercase characters in the passcode.

HasSpecial Indicates whether the passcode is required to have special characters. The validate function will return false if HasSpecial is true and there are no special characters in the passcode.

AllowsTouchID Allows the passcode be stored in a Touch ID-protected keychain item.

RetryLimit The number of login attempts that are allowed before the app locks.

HasDigit Indicates whether the passcode is required to use digits. The validate function returns false if HasDigit is true, but there aren't any digits in the passcode.

MinUniquechars The number of unique characters the passcode is required to include. The validate function returns false if the number of unique characters in the passcode is less than specified in this setting.

Application name

Use the ApplicationDisplayName property to specify the name of the application while deploying the project initially.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Application default language

Use the DefaultAppLanguage property to specify the default language of the app. Accept ISO 639-1 two letter code, for example, en for english.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 17 Detail label text

Use the DetailLabelViewText property to specify the subtitle that appears on the welcome page. This should be a brief description of the app.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Passcode timeout

Use the PasscodeTimeout property to specify how long the application can remain in the background before the passcode is required. Your app always requires a passcode.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

● If the value is -1, the passcode screen is never displayed. ● If the value is 0, the passcode is always required. This is the default value. ● If the value is >0, it denotes the timeout value in seconds after which the passcode screen is displayed.

Debugging options

The settings in the DebugSettings property are for development use and should not be enabled in a production setting.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Setting Description

DebugODataProvider Adds a console logger to the OData provider set to Debug level

TracingEnabled Turns on Tracing (execution time) for rules, actions, etc.

Logging options

Use the LogSettings property if you would like the logger to be started as soon as the MDK client is launched.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Setting Description

FileName File-name to be used for the log file

MaxFileSizeInMegaBytes Maximum file size in mega bytes. When the specified max size is reached, it rolls.

The default value is 5 .

Using SAP Cloud Platform Mobile Service, mobile development kit 18 PUBLIC Administrator Guide Setting Description

LogLevel Value can be of the following: ● Error ● Warn ● Info ● Debug

Database encryption

Use the EncryptDatabase property to specify the database encryption.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

● Set value to true if you want the database to be encrypted. ● Set value to false if you do not want the database to be encrypted.

Onboarding customization

Use the OnboardingCustomizations property to customize the strings used in FUIPasscodeSetupView, FUIPasscodeView, FUITouchIDView and EULA page.

You can find this option in the MDKClient_SDK/branding/BrandedSettings.json file.

Key Default String

eulaTitleString End User License Agreement

agreeButtonString Agree

disagreeButtonString Disagree

authenticationFailedMessageString Authentication failed. Please try again

enterCredentialsMessageString Please sign in to reset the passcode

maxAttemptsReachedMessageString No more attempts left

resetPasscodeButtonString Reset Passcode

attemptsLeftMessageFormat You have % attempts left

authenticateWithTouchIDMessageString Authenticate with Touch ID

changePasscodeTitleString Change Passcode

choosePasscodeTitleString Choose Passcode

confirmPasscodeString Confirm your passcode

confirmPasscodeTitleString Confirm Passcode

digitsLabelString Digits (0-9)

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 19 Key Default String

enableButtonString Enable

enterPasscodeAgainString Enter your passcode again

enterYourCurrentPasscodeMessageString Enter your current passcode

enterYourPasscodeMessageString Enter your passcode

faceIDEnableMessage1String Please enable Face ID for fast and secure access

faceIDEnableMessage2String If Face ID is deactivated, you will be asked for your device passcode

faceIDMessage1String Enabling Face ID will give you faster access to your information

faceIDMessage2String You can turn this feature On or Off anytime from Settings

faceIDTitleString Face ID

includeRequiredGroupMessage Include the following:

learnMoreFaceIDLinkString Learn more about Face ID

learnMoreTouchIDLinkString Learn more about Touch ID

lowerCaseLabelString Lower case (a-z)

nextItemString Next

nonAlphabeticLabelString Symbols (!@#...)

notNowActionString Not Now

notNowButtonString Not Now

okButtonString OK

oneAttempLeftMessageFormat You have 1 attempt left

passcodeNotMatchMessageString Passcodes did not match. Try again

passcodeRejectedMessageString Passcode was rejected by FUIPasscodeControllerDelegate

passcodeTitleString Passcode

passcodeValidationFailedMessageString Passcode validation failed

retryButtonString Retry

retryPasscodeMessageString Incorrect passcode. Try again

setPasscodeMessageFormat Choose a passcode with at least %d characters for unlocking the app

setPasscodeWithDigitsMessageFormat Choose a passcode with at least %d digits for unlocking the app

settingsActionString Settings

touchIDEnableMessage1String Please enable Touch ID for fast and secure access

touchIDEnableMessage2String If Touch ID is deactivated, you will be asked for your device passcode

Using SAP Cloud Platform Mobile Service, mobile development kit 20 PUBLIC Administrator Guide Key Default String

touchIDMessage1String Enabling Touch ID will give you faster access to your information

touchIDMessage2String You can turn this feature On or Off anytime from Settings

touchIDTitleString Touch ID

upperCaseLabelString Upper case (A-Z)

Demo application

If you want to access the app in the demo mode, place your application definitions in /app/demo.js.

If you want different connection settings when the client launches in the demo mode, add them under the Demo section. If you launch the demo mode without adding a connection setting, it falls back to the live settings.

Use the DemoAppLanguage property (found in the MDKClient_SDK/branding/BrandedSettings.json file) to specify the language code (example en for english) if the demo database supports the required language parameters.

Demo database for Offline OData

You can brand a demo database of your app for users to try the app without having to authenticate with the SAP Cloud Platform mobile service for development and operations.

The database comes in the form of two files with the extensions .udb and .rq.udb. The names of both of these files must match the destination name for the OData service. You can include them in the app by adding them to the /app/branding directory.

For example, if the app uses a destination called com.sap.sam.swe, you can brand the Offline OData store by including com.sap.sam.swe.udb and com.sap.sam.swe.rq.udb in the branding directory. If multiple destinations are used by the app, include additional pairs of database files for each additional destination. When the app is built with one or more branded databases, click Try the Demo on the launch screen to use those databases.

You can obtain these database pairs from an existing application after the offline OData has been initialized. Since only unencrypted databases are supported in the demo mode, you must set the EncryptDatabase flag in MDKClient_SDK/branding/BrandedSettings.json to false for this step.

To get the files from the Simulator, go to the Terminal app and use the following command to list all the .rq.udb files sorted in reverse chronological order:

find ~/Library/Developer/CoreSimulator -name '*.rq.udb' -print0 | xargs -0 ls -lt

The corresponding .udb file can be found in the same location.

If the app is installed on a device, you can obtain the files using a third party file manager application.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 21 If you want different connection settings for when users launch the app in the demo mode, specify the settings under the Demo section.

Configuration of MDKProject.json file

Configure the following settings in the MDKProject.json file before running the create-client.command:

Setting Description

AppName This determines the name of the application project and the app as they appear on an iOS device

BaseProject The subdirectory of metadata where the project is found

BundleID The ID used for code signing

Externals A list of NPM modules that should not be included in the application bundle.

You can use this option for dependencies that you expect to be in the environment when the application is built.

Note that the modules file-system and ui/dialogs are automatically used as externals because they are included in the client application.

UrlScheme Allows you to specify a custom URL scheme which opens the client.

If the URL includes connection settings as URL parameters, these settings will override the ones used by the client. The default is mdkclient.

Application version

The mobile development kit client keeps track of several versions, which can be viewed in the iOS Settings menu. These are identified as the application version, the definitions version and the framework versions for the frameworks used in the client build.

You can specify the application version while generating a client project. This allows you to version the client project itself, which may be useful if you make changes to extension controls or other branded settings.

To specify the application version, specify the AppVersion property in MDKProject.json before running the create-client.command.

To further customize your app's entry in the iOS Settings, you can manually edit /app/App_Resources/iOS/Settings.bundle/Root.plist after the script has completed. You can add new entries, but it is recommended that you do not remove any existing entries, in order for the app to function properly.

Using SAP Cloud Platform Mobile Service, mobile development kit 22 PUBLIC Administrator Guide Custom extensions

Any extensions to be used by the app should be included in the extensions directory. The base directory for each extension should be placed here. Each of these extension base directories should have the following structure:

Setting Description

controls The TypeScript code for extension controls

i18n The localization resource file for extension module

plugin The NativeScript plugin used by the extension, including TypeScript and Swift frameworks.

Custom app resources

You can include custom application resources by placing the files in <.mdkproject directory>/ App_Resources/iOS. This may include one of the following:

Setting Description

Assets.xcassets An asset catalog to be used by the app.

This can include an AppIcon.appiconset directory for custom app icons and a LaunchImage.launchimage directory for custom launch images.

Custom icons Custom icons which can be referenced in the metadata and shown in the app.

For example, an image called menuIcon.png is included in <.mdkproject directory>/App_Resources/ iOS/. It can be accessed by the app with the identifier res://menuIcon.

EULA text Custom text for the EULA page can be specified in EULAText.txt.

Built-in metadata

To use a pre-bundled file as the initial metadata for your app, copy an exported editor project or a pre-bundled bundle.js file into the metadata directory.

This is also used as the metadata for the demo mode. If this directory is left blank, the default app metadata is used.

This acts as a blank application that tries to connect to the app update feature on mobile services.

Using SAP Cloud Platform Mobile Service, mobile development kit Administrator Guide PUBLIC 23 4 Business Process Expert Guide

The following tasks are typically completed by a business process expert.

Setting Up the Editor in SAP Web IDE Full-Stack [page 24] To create and develop applications using the Mobile Development Kit editor feature, you must first enable the feature on SAP Web IDE Full-Stack. It is not enabled by default.

Importing App Metadata into the Editor [page 25] You can import the generated code for an application and the resources that are contained in a project into the Mobile Development Kit editor workspace using SAP Web IDE Full-Stack.

Cloning App Metadata from Git Repository [page 25] You can clone the generated code for an app and the resources that are contained in the github repository into the Mobile Development Kit editor workspace.

Reusing App Components [page 26] As an app developer, you can reuse components that you have created for an app in your base (currently selected) app during the metadata building process.

Deploying App Metadata from Editor to Mobile Services [page 27] Upload your updated app as a metadata webpack file directly from the Mobile Development Kit editor to the SAP Cloud Platform mobile service for development and operations cockpit.

Creating a New Project Using an Editor Template [page 28] You can create a new project by using the predefined templates provided with SAP Web IDE Full-Stack.

4.1 Setting Up the Editor in SAP Web IDE Full-Stack

To create and develop applications using the Mobile Development Kit editor feature, you must first enable the feature on SAP Web IDE Full-Stack. It is not enabled by default.

Procedure

1. On the SAP Web IDE Full-Stack home page, choose Tools Preferences . 2. Choose Features. 3. From the Features list, select Mobile Development Kit Editor and Layout Editor. 4. To enable these editors, click the switch buttons next to the Mobile Development Kit Editor and Layout Editor features. 5. Choose Save. 6. Refresh your browser.

Using SAP Cloud Platform Mobile Service, mobile development kit 24 PUBLIC Business Process Expert Guide Results

You can now use the Mobile Development Kit editor feature to create and develop your project.

4.2 Importing App Metadata into the Editor

You can import the generated code for an application and the resources that are contained in a project into the Mobile Development Kit editor workspace using SAP Web IDE Full-Stack.

Procedure

1. Import your application for use with Mobile Development Kit editor by following the steps contained in Importing Projects from an Archive. 2. To confirm that your project type is correct, perform the following steps in the editor: a. From the left navigation panel of the repository browser, right-click your MDK project and select Project Settings. b. Select Project Types. c. Select Mobile Development Kit if not already selected. d. Select Save.

4.3 Cloning App Metadata from Git Repository

You can clone the generated code for an app and the resources that are contained in the github repository into the Mobile Development Kit editor workspace.

Procedure

1. In the editor workspace, right-click the Workspace folder and select Git Clone Repository . 2. Provide the URL of the git repository containing the app resources that you want to clone and click Clone. You can see the app cloned into the editor with the same folder structure as present in the git repository. If your app metadata folder is not at the root path in the git repository, the cloned app will display the same folder structure in the editor workspace.

For example, your app metadata could be in //src/metadata/definitions/.

3. Right-click the root folder of your cloned repository, choose Project Settings Mobile Development Kit , and click Save.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 25 4. To filter out all the non-related apps from the project folder structure and view only the MDK apps, click the MDK Development perspective on the left panel. You can switch between the MDK development perspective and the SAP Web IDE Full-Stack development perspective at any time.

4.4 Reusing App Components

As an app developer, you can reuse components that you have created for an app in your base (currently selected) app during the metadata building process.

Context

Create Component Integration Metadata (CIM) files using the editor in SAP Web IDE Full-Stack, to describe references between your base application and dependent components.

Accomplish integration between an app and a component by replacing definitions from one project with those of another, using integration points.

Procedure

1. In the editor workspace, right-click the MDK project folder and select New CIM File. 2. On the CIM Creation Page, choose the desired MDK component app from the dropdown list under Project Name.

When you choose an MDK component app, the other property fields, like CIM File Name, Application Name, and Display Name are automatically fetched and populated from the Application.app file of the selected component app. 3. Fill the Component Version field manually if applicable.

4. To complete creation of the CIM file, click Next Finish . 5. To define an integration point on the new CIM file, click Add and select a metadata object type from the dropdown. 6. Under New Integration Point, specify the Source and Target metadata and click Accept.

A new integration point is created. This means that the content of the source file would overlay the content of the target file at the time of metadata bundling.

Results

A .cim app component file is created and is ready for reuse. To know about deploying the app via webpack bundling, see Deploying App Metadata from Editor to Mobile Services [page 27].

Using SAP Cloud Platform Mobile Service, mobile development kit 26 PUBLIC Business Process Expert Guide 4.5 Deploying App Metadata from Editor to Mobile Services

Upload your updated app as a metadata webpack file directly from the Mobile Development Kit editor to the SAP Cloud Platform mobile service for development and operations cockpit.

Context

Once you have finished editing your app, upload it and choose to deploy it directly from the MDK editor to the mobile service for development and operations cockpit.

Procedure

1. In the editor, right-click the project folder, and select MDK Deploy and Activate.

In the Deploy to Mobile Services wizard, the application name is automatically fetched and populated from the Application.app file. 2. Under Filter Files, specify the files from your app that you want to exclude from bundling in the webpack. 3. Under Externals, specify the list of NPM modules from your app that you want to exclude from bundling in the webpack. 4. Perform one of the following:

○ To upload your app metadata directly to the mobile service for development and operations cockpit, select Upload application bundle to Mobile Services. ○ To download the app metadata to your local machine, select Download application bundle to local machine. 5. Click Next.

If you selected Download application bundle to local machine, you can later manually upload the app metadata to mobile services.

If you selected Upload application bundle to Mobile Services, a factory project folder that bundles your app metadata and uploads it to the mobile services is created automatically the first time you deploy your MDK project.

 Note

Do not edit or manipulate the contents of the factory project folder.

A popup message displays the latest version of the app in the server. 6. In the Deploy to Mobile Services wizard, provide the destination name and application ID. ○ If the application already exists in the mobile services, you see the following message: Successfully found application in mobile services. ○ If the application does not exist in the mobile services, you see the following error message: Application not found in mobile services.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 27 ○ If the destination is not configured in the mobile services, the server connection might fail, and you see the following error message: Failed to connect mobile services destination. For details about configuring the destination, see Setting Up SAP Web IDE Full-Stack to Work with Mobile Development Kit [page 10]. 7. Perform one of the following:

○ If you want to deploy your app automatically to mobile services after the upload is complete, check Automatically deploy after uploading. ○ If you want the admin to deploy the app using the app update service on mobile services, do not check the Automatically deploy after uploading option. For details, see Managing Your App Life Cycle with App Update [page 13].

Results

The latest revision of the app is now available on SAP Cloud Platform mobile service for development and operations.

4.6 Creating a New Project Using an Editor Template

You can create a new project by using the predefined templates provided with SAP Web IDE Full-Stack.

Procedure

1. On the SAP Web IDE Full-Stack version, right click Workspace, choose New New Project from Template . 2. On the Template Selection screen, choose Mobile Development Kit Application from the Category dropdown list. 3. Choose Mobile Development Kit Application, then assign a name to the new project and click Next. 4. On the Application Creation Page, provide the application name and display name. You can choose the application name to be same as the project name, which is fetched by default, or assign a different name. 5. Click Finish.

Results

A new empty Mobile Development Kit project is created.

Using SAP Cloud Platform Mobile Service, mobile development kit 28 PUBLIC Business Process Expert Guide 4.6.1 Metadata Definitions

The An experienced developer can customize the metadata properties in the metadata zip file, if required.

The following table provides information about the metadata definitions available in the editor and the format in which these metadata definitions are stored in the editor. The MDK client receives these metadata definitions as a bundle.

Metadata Definition Directory Description

Application.app Application.app A JSON file with a fixed name (Application.app) containing the main application definition.

Actions Actions/ Actions are configurable event handlers that can perform tasks the developer must provide JavaScript code for. In this way actions can be considered to be canned business logic, but are limited by the properties that can be configured.

Globals Globals/ Global variables that remain constant and can be used more than once in the app.

Images Images/ .png and .jpeg image files used in the application.

Objects Objects/ Objects are strings that provide access to entity properties.

Pages Pages/ Pages contain the control definitions that make up each app page.

Rules Rules/ Rules are JavaScript modules that can export functionality using es5 or es6 syntax. Currently, only default exports are supported.

Services Services/ The .service file defines an OData service destination. TheDestinationName property is used as the suffix to the SAP Cloud Platform Cockpit URL for mobile services when queries are made using this service.

A service can run in an online or offline mode.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 29 Metadata Definition Directory Description

To configure a service for online mode, set the OfflineEnabled parameter in the .service file to false. In this case, the MDK client communicates directly with the OData service. You can configure your apps to perform reads and updates to synchronize the client data.

To configure a service for offline mode, set the OfflineEnabled parameter in the .service file to true. In this case, the MDK client communicates with the OData service via the offline OData provider. You can configure your apps to initialize a data store and synchronize it with the OData service.

Styles Styles- Styles provides the client with a NativeScript CSS-like style file used to style the Nativescript controls. These are also sometimes refered to as built- in controls.

Configuration

To customize metadata properties, you must understand the order in which the above properties can be used. The following tree view explains how these properties can be used together and the parameters that can be set for each.

● Application.app ○ Services ○ OData Service ○ Pages ○ Extension controls ○ Form cell controls ○ Actions ○ OnFailure ○ OnInvalid ○ OnSuccess ○ OnSuccessLog ○ OnInvalidLog ○ OnFailureLog ○ ShowActivityIndicator ○ ValidationRule

Using SAP Cloud Platform Mobile Service, mobile development kit 30 PUBLIC Business Process Expert Guide ○ Globals ○ Type ○ Value ○ Rules ○ es5 syntax ○ es6 syntax

4.6.1.1 Application.app file

The Application.app file is a JSON file that contains the MDK app definition.

The following table displays the contents and properties of the Application.app file:

Property Type Description

MainPage (String) Refers to a file underneath the project root's Pages folder that has a .page extension.

Example: /_Name/Pages/ SomePage.page

OnExit Action, Rule This event is raised when the app is about to be exited.

OnLaunch Action, Rule This event is raised when the app is launched.

OnUnCaughtError Action, Rule This event is raised when an uncaught app error is present.

OnWillUpdate Action, Rule A .action or .js file that runs with the existing definitions prior to update

OnDidUpdate Action, Rule A .action or .js file that runs with the new definitions recieved from the update. If rejected/fails, revert to previous definitions

OnSuspend Action, Rule This event is raised when the application is suspended, for example, when the app goes into the background.

OnResume Action, Rule This event is raised when the application is resumed after being suspended, for example, when the app comes back to the foreground.

OnReceiveForegroundNotific Rule A .js file that is triggered when a ation notification is about to get presented to the app

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 31 Property Type Description

OnReceiveFetchCompletion Rule A .js file that is triggered when a remote notification arrived that indicates there is data to be fetched

OnReceiveNotificationRespo Rule A .js file that is called to let your app nse know which action was selected by the user for a given notification

Styles Style Reference The Styles metadata provides the client with a NativeScript CSS-like style file used to style the Nativescript controls.

These are also known as built-in controls.

SDKStyles SDK Style Reference The SDKStyles metadata provides the client with a NUI NSS style file used to style the SDK controls.

_Name String Literal Used as the base in definition reference

Version String Literal, Global, A string, .global or .js file that returns a Rule string representing the version of updated metadata

Localization Localization Reference Refers to any file underneath the project root's i18n folder that has a .properties extension

Example: /_Name/i18n/ i18n.properties

DisplayName String Literal A human-readable name for the application

4.6.1.2 Internationalization and Localization of App Metadata

As an app developer, you can easily internationalize your app, in order to localize it to multiple languages and locales based on your target audience. This topic introduces the app metadata (folder structure, file name and structure, content and syntax) for the internationalized files in the MDK project.

Definitions

● Internationalization (i18n) refers to the design and development of a product, app or document content enabling easy localization for target audiences that vary in culture, region or language.

Using SAP Cloud Platform Mobile Service, mobile development kit 32 PUBLIC Business Process Expert Guide ● Localization (L10n) refers to the adaptation of a product, app or document content to meet the language, cultural and other requirements of a specific target market or locale.

Folder layout in metadata definition

In the editor, the i18n directory under the MDK project contains all the files and resources related to internationalization and localization. It currently consists of the language resource files. The folder layout is as follows:

● ProjectName/ : (Directory) ○ i18n/ : (Directory) ○ i18n.properties : (ResourceFile, Required) ○ i18n_en_GB.properties : (ResourceFile, Optional) ○ i18n_en_US.properties : (ResourceFile, Optional) ○ i18n_en_zh_Hans.properties : (ResourceFile, Optional) ○ i18n_en_zh_Hant.properties : (ResourceFile, Optional) and other supported languages

Application configuration

For internationalization and localization of your app, the following app configurations must be defined:

● In the Application.app file, set the value of the Localization property to the location of your default i18n properties file. The filename defined here is used as the basename to search for other translated properties files.

Example:

"Localization": "/ProjectName/i18n/myi18n.properties"

myi18n is the basename of the file

● In the BrandedSettings.json file, your admin must have set the DefaultAppLanguage property to en (english).

Example:

"DefaultAppLanguage" : "en"

Nomenclature of i18n files

The language and locale specific strings are stored in the .properties file.

The file-name structure can consist of up to the following three parts: .properties

● base_filename is the mandatory base file-name that should match the file name defined for the Localization property in the Application.app file.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 33 Example: myi18n.properties refers to the default properties file. ● language_code should be set to the short-form language code that its content has been translated to. Example: myi18n_en.properties refers to the properties file for the English language, without the conntry specifier. ● country_specifier is optional and can be set if its content is adapted to the specified country. Example: myi18n_en_GB.properties refers to the properties file for the British English language.

Content of i18n files

Each .properties file contains a list of localization strings that come in a key and value pair. It has the following syntax: =

The following table lists the parameters that you need to set for the .properties file:

Parameter Type Required/Optional Description

Localization_Key String literal Required Key to identify the localization string

It must not contain any space.

Localization_Value String literal Required Translated value for the localization string

You can add parameters for formatting the text in the localized string.

For example: Use {n} such as {1}, {2} ... {n} as placeholder for parameter values, and replace them with real values at runtime.

Example of a .properties file:

# This line is a comment and it will be ignored HOMEPAGE_TITLE=Home Page FULL_NAME=Full Name # Localized string with parameters {n} WRONG_AMOUNT={1} is less than the minimum required amount: {2} WRONG_PASSCODE=Wrong Passcode. {1} attempts remaining PUSH_RECEIVED_ITEM={1} has sent item {2} to you PUSH_NEW_ORDER=New order {1} has been placed

To know about how to consume localization strings in metadata definitions, see Usage of Internationalized and Localized Data [page 35].

Using SAP Cloud Platform Mobile Service, mobile development kit 34 PUBLIC Business Process Expert Guide 4.6.1.3 Usage of Internationalized and Localized Data

In the MDK editor, you can specify the type of data in binding and format it according to your desired locale.

You can include all your language properties files and resources in the i18n directory created under your MDK project folder. The various supported types are listed below:

Localizable String

This type returns the localized string for the specified key according to the device's or app's current locale. The following table displays the parameters of a Localizable String:

Parameter Type and Value Required/Optional Comments

Localization Key String Literal Required Defines the localization properties file

Additional Param X String Literal, Optional Value for format parameter Binding {0} , {1} and so on, defined for the specified key

Usage: $(L, , , , ...)

Number Format

Format the provided value as a number according to the device's or app's current locale and format options (if provided). The following table displays the parameters of a Number Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Format Options JSON object Optional Optional format options

Supported properties and ● minimumIntegerDi values are: gits: The number of integer digits allowed as ● minimumIntegerDi output gits (default is 1) ● minimumFractionD ● minimumFractionD igits: The minimum igits (default is 0) number of digits after the decimal separator allowed as output

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 35 Parameter Type and Value Required/Optional Comments

● maximumFractionD ● maximumFractionD igits (default is 2) igits: The maximum number of digits after ● (default useGrouping the decimal separator is true) allowed as output ● useGrouping: Determines whether the display should show the group separator

Usage: $(N, , , )

Currency Format

Format the provided value as currency according to the specified currency code, current locale of the device and format options (if provided). The following table displays the parameters of a Currency Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding

Currency Code String Literal, Required Currency Code to be used in Binding the formatter

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Format Options JSON object Optional Optional format options

Supported properties and ● minimumIntegerDi values are: gits: The number of integer digits allowed as ● minimumIntegerDi output gits ● minimumFractionD ● minimumFractionD igits: The minimum igits number of digits after the decimal separator The default values for the allowed as output above options are managed by the system default based on the currency codes.

Usage: $(C, , , , )

Using SAP Cloud Platform Mobile Service, mobile development kit 36 PUBLIC Business Process Expert Guide Percentage Format

Format the provided value as a percentage according to the device's or app's current locale and format options (if provided). The following table displays the parameters of a Percentage Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Format Options JSON object Optional Optional format options

Supported properties and ● minimumIntegerDi values are: gits: The number of integer digits allowed as ● minimumIntegerDi output gits (default is 1) ● minimumFractionD ● minimumFractionD igits: The minimum igits (default is 0) number of digits after the decimal separator ● maximumFractionD allowed as output igits (default is 2) ● maximumFractionD ● useGrouping (default igits: The maximum is true) number of digits after the decimal separator allowed as output ● useGrouping: Determines whether the display should show the group separator

Usage: $(P, , , )

Scientific Notation Format

Format the provided value as a scientific notation according to the device's or app's current locale and format options (if provided). The following table displays the parameters of a Scientific Notation Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 37 Parameter Type and Value Required/Optional Comments

Format Options String Literal Optional Optional format options

Supported properties and ● minimumIntegerDi values are: gits: The number of integer digits allowed as ● minimumIntegerDi output gits (default is 1) ● minimumFractionD ● minimumFractionD igits: The minimum igits (default is 0) number of digits after the decimal separator ● maximumFractionD allowed as output igits (default is 2) ● maximumFractionD ● useGrouping (default igits: The maximum is true) number of digits after the decimal separator allowed as output ● useGrouping: Determines whether the display should show the group separator

Usage: $(S, , , )

DateTime Format

Format the provided date-time value according to the device's or app's current locale and timezone. The result includes the date and the time portion. The following table displays the parameters of a DateTime Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding If a literal string is passed, the formatter assumes that the timezone is UTC+0

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Timezone String Literal Optional This is optional. If this is not provided, the device's current timezone is used.

Usage: $(DT, , , )

Using SAP Cloud Platform Mobile Service, mobile development kit 38 PUBLIC Business Process Expert Guide Date Format

Format the date-time value according to the device's or app's current locale and timezone. The result includes only the date portion. The following table displays the parameters of a Date Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding If a literal string is passed, the formatter assumes that the timezone is UTC+0

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Timezone String Literal Optional This is optional. If this is not provided, the device's current timezone is used.

Usage: $(D, , , )

Time Format

Format the provided date-time value according to the device's or app's current locale and timezone. The result includes only the time portion. The following table displays the parameters of a Time Format:

Parameter Type and Value Required/Optional Comments

Value String Literal, Required Value to be formatted Binding If a literal string is passed, the formatter assumes that the timezone is UTC+0

Locale String Literal Optional This is optional. If this is not provided, the value will be formatted with the current device/app locale.

Timezone String Literal Optional This is optional. If this is not provided, the device's current timezone is used.

Usage: $(T, , , )

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 39 4.6.1.4 Registering Extension Control

The extension controls that you have created to extend the functionality of your app can be used as base controls by registering them using the MDK editor.

Procedure

1. In the editor, right-click the project folder, and select New MDK Extension Control .

The first time you create an extension control, a directory named MDKExtensionControls is automatically created under the MDK app project workspace. 2. In the MDK Extension Control editor, provide the Control Name, Class, Module and Display information.

A file named ControlName.extension is generated based on the control name you provided.

The Module and Class properties are used to identify the extension control.

The Display property is used for the image to be displayed on the page editor to represent the extension control. Use the binding button to select an image from the Workspace\MDKExtensionControls \Images folder. 3. Define the properties of the extension control in the Extension Properties Schema window.

You can also import a property sample. 4. Click Generate Schema to generate the schema info

Results

After you register an extension control, a file named Module.Class.extensions is created under the folder Workspace\MDKExtensionControls.

All the registered extension controls present in the Workspace\MDKExtensionControls folder are displayed in the Registered Extension Control section of the control panel in the page editor. A developer can set the properties of a registered extension control using the editor. For details, see Registered Extension Control [page 124]

Using SAP Cloud Platform Mobile Service, mobile development kit 40 PUBLIC Business Process Expert Guide 4.6.1.5 Create Pages

The Pages folder contains the metadata definitions for a page. After you have created your new Mobile Development Kit project, a Main.page file is automatically created under the Pages folder.

Prerequisites

You must have a valid MDK project.

Procedure

1. Under your newly created MDK project, right-click the Pages folder and click New MDK page. 2. In the Template Section pane, select one of the following, based on the type of page you want to create: ○ Form Cell Page [page 42] ○ Section Page [page 74]

3. Provide a name for the page and click Next Finish .

A new blank page of the desired type is created under the Pages folder. 4. To start working with a page, double-click it or right-click and Open MDK Page Editor or Open Code Editor.

 Note

Changes made in the page editor simultaneously appear in the code editor.

You can select the default editor from Preferences Default Editors .

Page Editor

The Page Editor view contains the Controls and Outline tabs on the left-hand side, where you can see the controls applicable for your app. Each of the three page types contains different controls.You can simply drag and drop UI elements from the Controls tab directly into the Page Editor of the page you created.

The Outline tab shows the control hierarchy of the page you are designing. When you add a control, it is displayed under the Outline tab. Also, you can easily choose nested controls from this view.

On the right-hand side of the Page Editor, you can see the Properties and Events tabs, which contain the properties of the currently selected control and the events that you can associate with the selected controls.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 41 Code Editor

The Code Editor view displays the codes for your metadata elements. As you add or modify contents in the Page Editor, the changes simultaneously reflect in the Code Editor.

4.6.1.5.1 Form Cell Page

A Form Cell Page is suitable for pages that generate new objects or modify existing objects. It includes a form cell container by default. You can add form sections, multiple containers or action controls to this page. Under each container section, you can add various container items.

When you drag and drop a control, the relevant section/container where you can add the control is highlighted in the Page Editor.

Listed below are the different categories of controls that you can add in the Form Cell Page:

● Action: This category contains controls that allow end users to trigger some actions in a page. It has two controls: ○ Action Bar Item [page 43] ○ Toolbar Item [page 45] ● Container: This category includes controls that act as containers for other controls, such as container items. A container is constant for all pages. The size of a container depends on the controls and contents included inside. For example, when used in the header, the header defines the size of the container, and when used in the content section, the page content decides the size of the container. It has one control: ○ Section [page 47] ● Container Item: This category includes controls to be included in the Container. It has the following controls: ○ Attachment [page 48] ○ Button [page 49] ○ Date Picker [page 50] ○ Duration Picker [page 52] ○ Extension [page 54] ○ Filter [page 56] ○ List Picker [page 58] ○ Note [page 61] ○ Segmented [page 63] ○ Simple Property [page 66] ○ Sorter [page 68] ○ Switch [page 70] ○ Title [page 72] ● Registered Extension Control [page 124]: This category includes the extension controls that you have created to extend the functionality of your app and can be used as base controls by registering them using the MDK editor. To know how to register an extension control, see Registering Extension Control [page 40].

Using SAP Cloud Platform Mobile Service, mobile development kit 42 PUBLIC Business Process Expert Guide 4.6.1.5.1.1 Action Bar Item

This is a button that users can use to fire actions when pressed. You can add an Action Bar Item only to the Action Bar (normally at the top of the page). You can drag the item to position it to the left or right side of the action bar.

The following table displays the parameters and events that you can add to an Action Bar Item:

Parameter Type and Value Required/Optional Comments

Icon (AppResourceReferen Optional Displays icon on your action ce) bar item.

If present, overwrites the Text. Icon must have the correct size. You can find the expected iOS sizes at: https:// developer.apple.com/ios/ human-interface-guidelines/ graphics/custom-icons/ Example value: res:// image_name

AppResourceReferenc e are image resources in the MDK Client’s app/ App_Resources/iOS folder. For example, if you have myProfileIcon.png in that folder, then the AppResourceReferenc e value for that image will be res://myProfileIcon.

You can find details about how to add an image resource here:https:// docs.nativescript.o rg/ui/ images#adding-ios- resources

 Note This cannot be done in MDK editor in SAP Web IDE Full-Stack.

SystemItem (SystemItemReferenc Optional Adds predefined system- e) supplied icon or text.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 43 Parameter Type and Value Required/Optional Comments

Values can be one of the Overwrites Text and Icon if specified. following:

● Done ● Cancel ● Edit ● Save ● Add ● FlexibleSpace ● FixedSpace ● Compose ● Reply ● Action ● Organize ● Bookmark ● Search ● Refresh ● Stop ● Camera ● Trash ● Play ● Pause ● Rewind ● FastForward ● Undo ● Redo

Text (String) Optional You can change the display text of the item. You can also bind the value to various objects like OData Objects, UI properties, and Rules, etc.

OnPress Action, Rule Optional You can define an action or a rule that will be executed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js

Using SAP Cloud Platform Mobile Service, mobile development kit 44 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.2 Toolbar Item

A Toolbar is a horizontal container that includes toolbar items and can display buttons, labels, selects, and other input controls.

The following table displays the parameters and events that you can add to a Toolbar Item:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

SystemItem (SystemItemReferenc Optional Adds predefined system- e) supplied icon or text. Overwrites Title and Values can be one of the Image if specified. following:

● Done ● Cancel ● Edit ● Save ● Add ● FlexibleSpace ● FixedSpace ● Compose ● Reply ● Action ● Organize ● Bookmark ● Search ● Refresh ● Stop ● Camera

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 45 Parameter Type and Value Required/Optional Comments

● Trash ● Play ● Pause ● Rewind ● FastForward ● Undo ● Redo

Image (ImageReference) Optional Adds an image to your toolbar. Overwrites Title if specified.

Metadata path reference: / ProjectName/Images/ image_name

App Resource reference: res://image_name

Caption (String) Optional Displayed label of the toolbar item. Default value is Literal, Global, _Name. Rules, Object Binding

Enabled (Boolean) Optional

Literal, Global, Rules, Object Binding

Values can be one of the following:

● True (default) ● False

Width (Float) Optional Width of the control

Mandatory if SystemItem is set to FixedSpace, optional for Caption and Image.

By default, the caption and image widths are calculated automatically.

OnPress Action, Rule Optional You can define an action or a rule that will be executed when the event is triggered.

Using SAP Cloud Platform Mobile Service, mobile development kit 46 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

Clickable (Boolean) Optional Indicates if the toolbar item is clickable. Values can be one of the following: If the value is false, the item cannot be enabled, and ● True (default) behaves like a a label. ● False

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.3 Section

Section acts as a container for container items. You can add multiple section containers to a page to group different controls.

The following table displays the parameters and events that you can add to a Section container:

Parameter Type and Value Required/Optional Comments

Caption (String) Optional Displays a caption label at the header of the section. Literal, Global, Rule

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 47 4.6.1.5.1.4 Attachment

This container item allows users to add or take a photo as an attachment.

The following table displays the parameters and events that you can add to an Attachment:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

AttachmentActionTyp Array of strings Required List of supported e attachment types. Currently, Values can be one of the AddPhoto and following: TakePhoto are supported. ● AddPhoto ● TakePhoto

AttachmentAddTitle (String) Optional Title string for the add attachment popover

Default value is "AddAttachment".

AttachmentCancelTit (String) Optional Title string for the Cancel le button on the add attachment popover

Default value is "Cancel".

AttachmentTitle (String) Optional String for the attachment header.

Parameterized strings are also accepted, for example, "Photos [%d]", where the parameter is substituted by the number of attachments.

Default value is "Attachment (%d)".

Value Rule, Array of Optional List of resources which are to strings be added by default.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid

Using SAP Cloud Platform Mobile Service, mobile development kit 48 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

entity set or readlink that is subscribed to will cause the control to update when the data changes.

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.5 Button

A button communicates the action that it is going to initiate. Users can tap a button to begin a process or workflow, or to trigger an action.

The following table displays the parameters and events that you can add to a Button:

Parameter Type and Value Required/Optional Comments

Title (String) Optional ● Object Binding is a string that provides Object Binding, access to an entity Global Reference, property. Represented Rule Reference, by entity property name String Literal enclosed in {} Eg: {Order ID}. ● Global Reference refers to a path to a file with a .global extension

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 49 Parameter Type and Value Required/Optional Comments

Eg: /SomeProject/ Globals/ SomeGlobal.globa l ● Rule Reference denotes the path to a file with a .js extension. Eg: /SomeProject/ Rules/ SomeRule.jsn ● String Literal denotes free form text

TextAlignment Values can be one of the Optional Choose one of the options based on how you want the following: text alignment on your ● center (default) button to appear. ● left ● right

OnPress Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.6 Date Picker

Date Picker allows users to select date or time entries. Users can use this control to specify a date, a time of day, or a combination of both.

The following table displays the parameters and events that you can add to a Date Picker:

Using SAP Cloud Platform Mobile Service, mobile development kit 50 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Object Binding, Global, Literal, Rule

FormatRule Rule Optional If specified, the given rule executes when a control is initialized or when a value changes.

Default value is "".

IsEditable Binding, Global, Optional Disables or enables Literal, Rule interaction

Value can be one of the following:

● True (default) ● False

Mode Value can be one of the Required Date picker mode for the following: date picker ● DateTime (default) ● Date ● Time

Value Binding, Global, Optional Selected value of the Date Literal, Rule and Time

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string Eg: "ffffff"

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 51 Parameter Type and Value Required/Optional Comments

● ValidationMessag ● ValidationMessag eColor e- The validation ● ValidationViewBa message ckgroundColor ● ValidationMessag ● SeparatorIsHidde eColor- The color of n the validation message as a hexadecimal string ● ValidationViewIs Eg: "ffffff" Hidden ● ValidationViewBa Can be Binding, Global, ckgroundColor- The Literal, Rule background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.7 Duration Picker

Duration Picker allows the users to specify a duration by selecting a start time and an end time.

The following table displays the parameters and events that you can add to a Duration Picker:

Using SAP Cloud Platform Mobile Service, mobile development kit 52 PUBLIC Business Process Expert Guide Required/ Parameter Type and Value Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Required Displays label on the control

Object Binding, Global, Literal, Rule

FormatRule Rule Optional If specified, the given rule executes when a control is initialized or when a value changes.

Default value is "".

IsEditable (Boolean) Optional Disables or enables interaction

Binding, Global, Literal, Rule

Value can be one of the following:

● True (default) ● False

MinuteInterval Binding, Global, Literal, Optional Interval in minutes in picker Rule Default is 5 minutes, max is 30.

Unit Binding, Global, Literal, Required Unit of duration Rule It can be hour or minute. The return value can be one of the following:

● 'M' ● 'MIN' ● 'H' ● 'HOUR'

Value Binding, Global, Literal, Optional Duration value in hours or minutes. Rule It depends on the unit.

DataSubscripti Array of strings Optional DataSubsriptions is an array of ons strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 53 Required/ Parameter Type and Value Optional Comments

ValidationProp ● SeparatorBackground Optional ● SeparatorBackgroundColo erties Color r- The background color of the ● ValidationMessage separator as a hexadecimal string ● ValidationMessageCo Eg: "ffffff" lor ● ValidationMessage- The ● ValidationViewBackg validation message roundColor ● ValidationMessageColor- ● SeparatorIsHidden The color of the validation message as a hexadecimal string ● ValidationViewIsHid Eg: "ffffff" den ● ValidationViewBackgroun Can be Binding, Global, dColor- The background color Literal, Rule of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidden- The visibility of the separator ● ValidationViewIsHidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.8 Extension

This control renders a custom control extension in a Form Cell Container, which you can use to customize your app and extend its functionality. Use this control to display a single custom extension.

The following table displays the parameters and events that you can add to a Formcell Extension:

Using SAP Cloud Platform Mobile Service, mobile development kit 54 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Height Integer, Rule, Global Optional Height of the control

Class (String) Required The name of the exported class in the module that is to be used for the extension

Extension Object Optional Additional custom properties Properties specific to the extension

Module (String) Required The name of the file under app/extensions/ that contains the extension class

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 55 Parameter Type and Value Required/Optional Comments

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.1.9 Filter

Filter allows users to narrow down the results from a long list by setting some criteria. Users can reset the filter to go back to the complete list of results.

The following table displays the parameters and events that you can add to a Filter:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Binding, Global Reference, String Literal

AllowEmptySelection Value can be one of the Optional Disables or enables the selection of empty value set following:

● True ● False (default)

AllowMultipleSelect Value can be one of the Optional Disables or enables the selection of multiple entries ion following:

● True (default) ● False

IsEditable (Boolean) Optional Disables or enables interaction Binding, Global Reference, Boolean Literal

Value can be one of the following:

Using SAP Cloud Platform Mobile Service, mobile development kit 56 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

● True (default) ● False

FilterProperty Global Reference, Optional The property of the Entities String Literal, Rule being filtered that the Reference, Array of EntitySet will be filtered Objects on

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: /

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 57 Parameter Type and Value Required/Optional Comments

SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.10 List Picker

The following table displays the parameters and events that you can add to a List Picker:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Binding, Global Reference, String Literal

SearchEnabled Boolean, Rule, Global Optional Enables search on the ListPicker

BarcodeScanner Boolean, Rule, Global Optional Enables the use of a barcode scanner in search

MinCharaterThreshol Integer, Rule, Global Optional The d MinimumCharacterThr eshold is limited to a non- negative integer number and represents the minimum number of characters required before a search is executed.

If the MinimumCharacterThr eshold is zero, every character will be searched. In this case, no minimum character count is effective.

Using SAP Cloud Platform Mobile Service, mobile development kit 58 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

If MinimumCharacterThr eshold is greater than 0, a minimum of Y characters will be accepted in the search field before the search is executed.

SearchDelay Integer, Rule, Global Optional The value of SearchDelay is limited to a non-negative integer number. It represents the number of milliseconds to delay after the last key press, before the search is executed.

If SearchDelay is set to zero or not defined then no delay will be used and the search will be executed as soon as the user enters the minimum character count.

If SearchDelay is greater than zero, then the delay will be reset each time the user enters or deletes a character under the minimum character count.

SearchPlaceholder String, Rule, Global Optional Placeholder text for the search field of the list picker when the field is empty

AllowEmptySelection Value can be one of the Optional Disables or enables the selection of empty value set following:

● True (default) ● False

AllowMultipleSelect Value can be one of the Optional Disables or enables the selection of multiple entries ion following:

● True ● False (default)

IsEditable (Boolean) Optional Disables or enables interaction

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 59 Parameter Type and Value Required/Optional Comments

Binding, Global Reference, Boolean Literal

Value can be one of the following:

● True (default) ● False

IsSelectedSectionEn Binding, Global Optional Enables the section abled Reference, Boolean containing the selected Literal, Rule entries at the top of the list Reference By default, the section Value can be one of the containing the selections is following: not visible.

● True ● False (default)

PickerItems Rule Reference, Optional An array of items for this String Literal, picker Target It can be simple key and value items or Object Cell items.

Value Binding, Global Optional When Value is not Reference, String specified or not found in the Literal PickerItems , no selection is made.

PickerPrompt Binding, Global Optional Text to display when nothing Reference, String is selected Literal

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule

Using SAP Cloud Platform Mobile Service, mobile development kit 60 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.11 Note

Note is a multi-line text entry control.

The following table displays the parameters and events that you can add to a Note:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

FormatRule Rule Optional Rule to perform on value

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 61 Parameter Type and Value Required/Optional Comments

IsAutoResizing Binding, Global, Optional Disables or enables vertical Literal, Rule resizing depending on the content Value can be one of the following:

● True ● False (default)

IsEditable Binding, Global, Optional Disables or enables Literal, Rule interaction

Value can be one of the following:

● True (default) ● False

Value Binding, Global Optional Text to displayText to display Reference, String Literal

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Placeholder Binding, Global, Optional Placeholder text to display if Literal, Rule value is empty

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string

Using SAP Cloud Platform Mobile Service, mobile development kit 62 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.12 Segmented

A segmented control is a horizontal bar divided into two or more mutually-exclusive buttons. This control provides users easy access to specific categories of content.

The following table displays the parameters and events that you can add to a Segmented control:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 63 Parameter Type and Value Required/Optional Comments

AutoAdjustWidths Binding, Global Optional Automatically adjusts the Reference, Boolean width of each segment by Literal the size of its content

Value can be one of the following:

● True ● False (default)

Caption (String) Optional Displays label on the control

Binding, Global Reference, String Literal

IsEditable Binding, Global Optional Disables or enables Reference, Boolean interaction Literal

Value can be one of the following:

● True (default) ● False

Segments Rule Reference, Optional An array of string, each String Literal, representing a segment in Target the Segmented Form Cell

Value Binding, Global Optional When not specified or not Reference, String found in the Segments, no Literal selection is made.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string

Using SAP Cloud Platform Mobile Service, mobile development kit 64 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

● ValidationMessag Eg: "ffffff" eColor ● ValidationMessag ● ValidationViewBa e- The validation ckgroundColor message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Eg: "ffffff" Can be Binding, Global, ● ValidationViewBa , Literal Rule ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 65 4.6.1.5.1.13 Simple Property

The Simple Property control is a simple label that users can use to convey any information.

The following table displays the parameters and events that you can add to a Simple Property control:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Binding, Global, Literal, Rule

FormatRule Rule Optional If specified, the given rule executes when a control is initialized or when a value changes.

Default value is "".

IsEditable Binding, Global, Optional Disables or enables Literal, Rule interaction

Value can be one of the following:

● True ● False (default)

KeyboardType Binding, Global, Optional Shows the appropriate Literal, Rule keyboard type

Value can be one of the To streamline data entry, the following: keyboard displayed when editing a SimpleProperty ● DateTime form cell should be ● Email appropriate for the type of ● Number content in the field. ● Phone For example, if your app asks ● Url for an email address, it ● Default should display the email address keyboard.

Value String Optional Text to display

Binding, Global, Literal, Rule

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Using SAP Cloud Platform Mobile Service, mobile development kit 66 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Placeholder String Optional Placeholder text to display if Value is empty Binding, Global, Literal, Rule

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 67 Parameter Type and Value Required/Optional Comments

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.14 Sorter

This control renders a Sorter form cell to be used in a filter-options page. It allows user to choose the field to be used as sorter.

The following table displays the parameters and events that you can add to a Sorter:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Binding, Global Reference, String Literal

AllowEmptySelection (Boolean) Optional Disables or enables the selection of empty value set Value can be one of the following:

● True ● False (default)

AllowMultipleSelect (Boolean) Optional Disables or enables the ion selection of multiple entries Value can be one of the following:

● True (default) ● False

IsEditable Binding, Global, Optional Disables or enables interaction Literal, Rule

Using SAP Cloud Platform Mobile Service, mobile development kit 68 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Value can be one of the following:

● True (default) ● False

SortByItems Global, Literal, Required For Global, Literal or EntitySetTarget, Rule Rule, the value is interpreted as an array.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 69 To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.15 Switch

The switch control is used to toggle two mutually exclusive states, On and Off.

The following table displays the parameters and events that you can add to a Switch:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

Caption (String) Optional Displays label on the control

Binding, Global, Literal, Rule

IsEditable (String) Optional Disables or enables interaction Binding, Global, Literal, Rule

Value can be one of the following:

● True (default) ● False

Value Boolean Optional Sets the switch in on/off mode Binding, Global, Literal, Rule

Value can be one of the following:

● True ● False (default)

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the

Using SAP Cloud Platform Mobile Service, mobile development kit 70 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

control to update when the data changes.

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 71 To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.1.16 Title

This is a single-line text entry control.

The following table displays the parameters and events that you can add to a Title:

Parameter Type and Value Required/Optional Comments

Name (String) Required Unique identifier name for the control

FormatRule Rule Optional Applies rule on a form cell

IsEditable (Boolean) Optional Disables or enables interaction Binding, Global, Literal, Rule

Value can be one of the following:

● True (default) ● False

Value (String) Optional Text to display

Binding, Global, Literal, Rule

Value can be one of the following:

● True ● False

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Placeholder (String) Optional Placeholder text to display if Value is empty

Using SAP Cloud Platform Mobile Service, mobile development kit 72 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Binding, Global, Literal, Rule

ValidationPropertie ● SeparatorBackgro Optional ● SeparatorBackgro s undColor undColor- The ● ValidationMessag background color of the e separator as a hexadecimal string ● ValidationMessag Eg: "ffffff" eColor ● ValidationViewBa ● ValidationMessag ckgroundColor e- The validation message ● SeparatorIsHidde ● ValidationMessag n eColor- The color of ● ValidationViewIs the validation message Hidden as a hexadecimal string Can be Binding, Global, Eg: "ffffff" Literal, Rule ● ValidationViewBa ckgroundColor- The background color of the validation view as a hexadecimal string Eg: "ffffff" ● SeparatorIsHidde n- The visibility of the separator ● ValidationViewIs Hidden- The visibility of the validation view

OnValueChange Action, Rule Optional Action or rule to be performed after value is changed.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 73 To see how this control might look on your app, search with the control name in the Fiori for iOS Design Guidelines page.

4.6.1.5.2 Section Page

A Section Page is suitable for pages that are used to display items, for example, a list of items or details of a single item. When you create a section page, a page with a blank section is created.

You can add actions controls, compound controls, container items (within containers) and section bar to a section page.

When you drag and drop a control, the relevant section/container where you can add the control is highlighted in the Page Editor.

Listed below are the different categories of controls that you can add in the Section Page:

● Action: This category contains controls that allow end users to trigger some actions in a page. It has two controls: ○ Action Bar Item [page 43] ○ Toolbar Item [page 45] ● Compound: A compound control contains a group of other controls. Unlike in a container control where you can add your own child controls (container items), the child controls in a compound control are fixed. You can populate each of its child control by defining its data binding, depending on which the child controls are created. It has the following controls: ○ Contact Cell Table [page 75] ○ Extension Object Collection [page 77] ○ Extension Section [page 79] ○ Image Collection [page 81] ○ Object Collection [page 83] ○ Object Table [page 88] ○ Section Grid Table [page 94] ○ Simple Property Collection [page 97] ● Container: This category includes controls that act as containers for other controls, such as container items. A container is constant for all pages. The size of a container depends on the controls and contents included inside. Each container type in a Form Cell Page can contain specific controls (container items). The table below lists the different container controls and the container items that they can include:

Container Can include Container Item

Object Header [page 100] Object Header Extension

To know about the properties of this control, see Object Header [page 100].

Section Button Table [page 103] Section Button

Using SAP Cloud Platform Mobile Service, mobile development kit 74 PUBLIC Business Process Expert Guide Container Can include Container Item

To know about the properties of this control, see Section Button Table [page 103].

Static Contact Cell [page 105] Contact Cell Item

To know about the properties of this control, see Static Contact Cell [page 105].

Static Image Collection [page 107]

Static Key Value [page 107] Key Value Item

To know about the properties of this control, see Static Key Value [page 107].

Static Object Collection [page 109] Object Cell Item

To know about the properties of this control, see Static Object Collection [page 109].

Static Object Table [page 114] Object Cell Item

To know about the properties of this control, see Static Object Table [page 114].

Static Simple Property Collection [page 118] Simple Property Cell Item

To know about the properties of this control, see Static Simple Property Collection [page 118].

● Section: This category includes the Header and the Footer controls. ○ Footer [page 121] ○ Header [page 123] ● Registered Extension Control [page 124]: This category includes the extension controls that you have created to extend the functionality of your app and can be used as base controls by registering them using the MDK editor. To know how to register an extension control, see Registering Extension Control [page 40].

4.6.1.5.2.1 Contact Cell Table

This is a table view container used to provide quick information about a contact and also provide access to the various methods of communicating with a contact. It is used for displaying and managing contact cells.

The following table displays the parameters and events that you can add to a Contact Cell Table:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It is a combination of: cell in the collection

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 75 Parameter Type and Value Required/Optional Comments

1. EntitySet 1. EntitySet: The name of the entity set to use 2. QueryOptions for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Description (String) Optional Description text displayed in the cell table Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell table

Headline Object Binding, Optional Text for the headline label Global Reference, String Literal, Rule Reference

Subheadline Object Binding, Optional Text for the sub-headline label Global Reference, String Literal, Rule Reference

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

ActivityItems Phone, Email, Optional Activity items to be VideoCall, Detail displayed in the control (Alert), Message

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set

Using SAP Cloud Platform Mobile Service, mobile development kit 76 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Caption Object Binding, Optional Caption label to be displayed in the contact cell table Global Reference, String Literal, Rule Reference

HidesFooter Boolean Optional Choose if you want to hide the footer in the contact cell Value can be one of the table following:

● True (default) ● False

Style Object Binding, Optional An NSS style to be applied Global Reference, on this control String Literal, Rule Reference

4.6.1.5.2.2 Extension Object Collection

This is a control that you can use to display one or more custom extensions.

The following table displays the parameters and events that you can add to an Extension Object Collection:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 77 Parameter Type and Value Required/Optional Comments

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

NumberOfColumns (Integer) Optional The number of columns to be displayed Default value is 2

.

Class (String) Required The name of the exported class in the module that is to be used for the extension

Extension (String) Optional Additional custom properties Properties specific to the extension in JSON object format

Module (String) Required The name of the file under app/extensions/ that contains the extension class

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

Using SAP Cloud Platform Mobile Service, mobile development kit 78 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.3 Extension Section

This is a control that you can use to display a single custom extension.

The following table displays the parameters and events that you can add to an Extension Section:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 79 Parameter Type and Value Required/Optional Comments

Height Integer, Rule, Global Optional Height of the control

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

Class (String) Required The name of the exported class in the module that is to be used for the extension

Extension Object Optional Additional custom properties Properties specific to the extension

Module (String) Required The name of the file under app/extensions/ that contains the extension class

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file

Using SAP Cloud Platform Mobile Service, mobile development kit 80 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.4 Image Collection

This container manages and displays a set of images with titles in a grid-like arrangement, which you can configure in different layout types.

The following table displays the parameters and events that you can add to an Image Collection:

Parameter Type and Value Required/Optional Comments

Title Object Binding, Optional Title text displayed on the cell Global Reference, String Literal, Rule Reference

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Image Image Reference, Rule Optional Image to be displayed Reference

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 81 Parameter Type and Value Required/Optional Comments

ImageIsCircular Boolean Literal, Optional If the value is True, the image is displayed in a Object Binding, circular shape. Global Reference, String Literal, Rule Reference

Value can be one of the following:

● True ● False (default)

Image Height Number Literal Optional Height of the image to be displayed

The default value is 120

Image Width Number Literal Optional Width of the image to be displayed

LayoutType String Literal Optional

Value can be one of the following:

● HorizontalFit (default) ● HorizontalScroll ● Vertical

MinimumInterimSpaci Number Literal Optional The minimum horizontal ng space between two items. The default value is 20

.

MinimumLineSpacing Number Literal Optional The minimum space between two lines.

The default value is 20

.

Caption (String) Optional Displayed label of the image collection item Literal, Global, Rules, Object Binding

HidesFooter Boolean Optional Choose if you want to hide the footer Value can be one of the following:

● True (default) ● False

Using SAP Cloud Platform Mobile Service, mobile development kit 82 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Style Object Binding, Optional Global Reference, String Literal, Rule Reference

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.5 Object Collection

This control includes a view that manages and displays an ordered collection of object cells. Use Target binding to populate its cells.

The following table displays the parameters and events that you can add to an Object Collection:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 83 Parameter Type and Value Required/Optional Comments

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

DetailImageIsCircul Boolean Optional If the value is True, the ar image is displayed in a Value can be one of the circular shape. following:

● True ● False (default)

Footnote (String) Optional Text to be displayed in the footnote OData Binding, Global Reference, Rule Reference, String Literal

Icons Image Reference, Rule Optional Icons to be displayed in the Reference cell

PreserveIconStackSp Boolean Literal, Optional Choose whether you want to acing Binding, Global preserve spacing for icons in Reference, Rule the cell even when there are Reference no icons/images added to the icon stack. Value can be one of the following:

● True (default) ● False

ProgressIndicator String Literal, Rule Optional Shows progress indicator Reference icon in the cell

Value can be one of the If both AccessoryType following: and ProgressIndicator ● toDownload properties are set, only the ● inProgress ProgressIndicator is ● open shown.

Status (String) Optional Status text/icon to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Subhead (String) Optional Subhead text to be displayed on the cell OData Binding, Global Reference, Rule

Using SAP Cloud Platform Mobile Service, mobile development kit 84 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Reference, String Literal

Substatus (String) Optional Substatus text/icon to be displayed on the cell (below OData Binding, Global Status) Reference, Rule Reference, String Literal

Title (String) Optional Title text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor ProgressIndicator is ● DetailDisclosure shown. Button ● Checkmark ● DetailButton

FormatRule Rule Optional If FormatRule is specified, the given rule executes when the control is initialized or when the value changes.

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

NumberOfColumns (Integer) Optional The number of columns to be displayed

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 85 Parameter Type and Value Required/Optional Comments

rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

FootnoteStyle (String) Optional An NSS style to be applied on the footnote Object Binding, Global Reference, Rule Reference, String Literal

StatusTextStyle (String) Optional An NSS style to be applied on the status text Object Binding, Global Reference, Rule Reference, String Literal

SubheadStyle (String) Optional An NSS style to be applied on the subhead Object Binding, Global Reference, Rule Reference, String Literal

SubstatusTextStyle (String) Optional An NSS style to be applied on the substatus text Object Binding, Global Reference, Rule Reference, String Literal

TitleStyle (String) Optional An NSS style to be applied on the title Object Binding, Global Reference, Rule Reference, String Literal

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

Using SAP Cloud Platform Mobile Service, mobile development kit 86 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

OnAccessoryButtonPr Action, Rule Optional Action or rule to be ess performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 87 Parameter Type and Value Required/Optional Comments

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.6 Object Table

This is a table style UI component for displaying information about an object.

The following table displays the parameters and events that you can add to an Object Table:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It is a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Description (String) Optional Description text displayed on the cell Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

DetailImageIsCircul Boolean Optional If the value is True, the ar image is displayed in a Value can be one of the circular shape. following:

● True ● False (default)

Footnote (String) Optional Text to be displayed in the footnote OData Binding, Global Reference, Rule

Using SAP Cloud Platform Mobile Service, mobile development kit 88 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Reference, String Literal

Icons Image Reference, Rule Optional Icons to be displayed in the Reference cell

PreserveIconStackSp Boolean Literal, Optional Choose whether you want to acing Binding, Global preserve spacing for icons in Reference, Rule the cell even when there are Reference no icons/images added to the icon stack. Value can be one of the following:

● True (default) ● False

ProgressIndicator String Literal, Rule Optional Shows progress indicator Reference icon in the cell

Value can be one of the If both AccessoryType following: and ProgressIndicator ● toDownload properties are set, only the ● inProgress ProgressIndicator is ● open shown.

Status (String) Optional Status text/icon to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Subhead (String) Optional Subhead text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Substatus (String) Optional Substatus text/icon to be displayed on the cell (below OData Binding, Global Status) Reference, Rule Reference, String Literal

Title (String) Optional Title text to be displayed on the cell OData Binding, Global Reference, Rule

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 89 Parameter Type and Value Required/Optional Comments

Reference, String Literal

SearchEnabled (Boolean) Optional Enables the search function on the table. You can enable Boolean, Rule, Global Search on an Object Table provided it is the only section Value can be one of the on a SectionedTable following: and does not have a ● True MaxItemCount set. ● False (default)

BarcodeScanner (Boolean) Optional Enables the use of a barcode scanner in search Boolean, Rule, Global

Value can be one of the following:

● True ● False (default)

MinCharaterThreshol (Integer) Optional The d Integer, Rule, Global MinimumCharacterThr eshold is limited to a non- negative integer number and represents the minimum number of characters required before a search is executed.

If the MinimumCharacterThr eshold is zero, every character will be searched. In this case, no minimum character count is effective.

If MinimumCharacterThr eshold is greater than 0, a minimum of Y characters will be accepted in the search field before the search is executed.

SearchDelay (Integer) Optional The value of SearchDelay Integer, Rule, Global is limited to a non-negative integer number. It represents the number of milliseconds

Using SAP Cloud Platform Mobile Service, mobile development kit 90 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

to delay after the last key press, before the search is executed.

If SearchDelay is set to zero or not defined then no delay will be used and the search will be executed as soon as the user enters the minimum character count.

If SearchDelay is greater than zero, then the delay will be reset each time the user enters or deletes a character under the minimum character count.

SearchPlaceholder String, Rule, Global Optional Placeholder text for the search field when the field is empty

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor ProgressIndicator is ● DetailDisclosure shown. Button ● Checkmark ● DetailButton

FormatRule Rule Optional If FormatRule is specified, the given rule executes when the control is initialized or when the value changes.

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 91 Parameter Type and Value Required/Optional Comments

rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

DescriptionStyle (String) Optional An NSS style to be applied on the description Object Binding, Global Reference, Rule Reference, String Literal

FootnoteStyle (String) Optional An NSS style to be applied on the footnote Object Binding, Global Reference, Rule Reference, String Literal

StatusTextStyle (String) Optional An NSS style to be applied on the status text Object Binding, Global Reference, Rule Reference, String Literal

SubheadStyle (String) Optional An NSS style to be applied on the subhead Object Binding, Global Reference, Rule Reference, String Literal

SubstatusTextStyle (String) Optional An NSS style to be applied on the substatus text Object Binding, Global Reference, Rule Reference, String Literal

TitleStyle (String) Optional An NSS style to be applied on the title Object Binding, Global Reference, Rule Reference, String Literal

Using SAP Cloud Platform Mobile Service, mobile development kit 92 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

OnAccessoryButtonPr Action, Rule Optional Action or rule to be ess performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 93 Parameter Type and Value Required/Optional Comments

extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.7 Section Grid Table

This is a container that allows you to use labeled columns in a grid and present numbers, text, or images in a tabular format. You can include Grid Row Items in this section.

The following table displays the parameters and events that you can add to a Section Grid Table:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

AccessoryType String Optional

Can be one of the following:

● None(default) ● Checkmark ● DetailButton ● DetailDisclosure Button ● DisclosureIndica tor

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a

Using SAP Cloud Platform Mobile Service, mobile development kit 94 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

IsUsingPercentage Boolean Required Allows you to specify whether the column width is Can be one of the following: a percentage of the total ● True width or is a fixed amount ● False

Spacing Number Literal Optional The spacing between columns

Caption (String) Optional Caption to be displayed when the section is empty Literal, Global, Rules, Object Binding

HidesFooter Boolean Optional Choose if you want to hide the footer when the section Value can be one of the is empty following:

● True (default) ● False

Style Object Binding, Optional An NSS style to be applied Global Reference, on the caption when the String Literal, Rule section is empty Reference

OnPress Action, Rule Optional Action or rule to be performed when a row is selected.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: /

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 95 Parameter Type and Value Required/Optional Comments

SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

OnAccessoryButtonPr Action, Rule Optional Action or rule to be ess performed when the accessory view of a row is selected.

The following table displays the parameters and events that you can add to a Grid Row Item:

Parameter Type and Value Required/Optional Comments

Image Image Reference, Rule Optional Image to be displayed Reference Only Image or Text is allowed at a time.

An image overwrites the text if both text and image are specified.

ImageSizeAffectsRow Can be one of the following: Optional Specify whether the height Height of the image is to be taken ● True into account when ● False calculating the row height

LineBreakMode Value can be one of the Optional Specify how you want the line break to be displayed. following: This option is supported only ● WordWrapping with Text. ● CharWrapping ● Clipping ● TruncatingHead ● TruncatingTail ● TruncatingMiddle

NumberOfLlines Number Literal Optional The maximum number of lines to render the item label The defaut value is 1 . with

This option is supported only with Text.

A value of 0 denotes that there is no restriction on the number of lines.

Text Object Binding, Optional Text to diaplyed on the grid Global Reference, table

Using SAP Cloud Platform Mobile Service, mobile development kit 96 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

String Literal, Rule Only Image or Text is Reference allowed at a time.

TextAlignment (String) Optional Text alignment in the grid table Value can be one of the following: This option is supported only with Text. ● Center ● Left ● Right ● Natural ● Justified

Width Integer Optional Fixed width of the column that you can specify if IsUsingPercentage is False

WidthPercentage Number Optional Array of column width percentages in fractions of 1 , shown if IsUsingPercentage is True.

A width percentage of -1 denotes auto-width, that is, it takes up all the remaining space.

There can only be one -1 width item per section.

Style Object Binding, Optional An NSS Style to be applied Global Reference, on this control String Literal, Rule This is supported only with Reference Text.

Only font-color and font- name are supported at this time.

4.6.1.5.2.8 Simple Property Collection

This is a reusable UI component that you can use to display a key-value pair property. You can add header and footer to this control.

The following table displays the parameters and events that you can add to a Simple Property Collection:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 97 Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It is a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

KeyName (String) Required The key name of the cell

Object Binding, Global Reference, String Literal, Rule Reference

Value (String) Required The value of the property

Object Binding, Global Reference, String Literal, Rule Reference

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor ProgressIndicator is ● DetailDisclosure shown. Button ● Checkmark ● DetailButton

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

Using SAP Cloud Platform Mobile Service, mobile development kit 98 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

NumberOfColumns (Integer) Optional The number of columns to be displayed

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 99 Parameter Type and Value Required/Optional Comments

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.9 Object Header

This is a container that you can use to display information about the header of an object. You can include an Object header extension cell item to display a custom extension in the Object Header container. You can add only one Object header as the first section in a table.

The following table displays the parameters and events that you can add to an Object Header:

Parameter Type and Value Required/Optional Comments

BodyText Binding, Global Optional Text for the body label in the additional info view Reference, String Literal, Rule Reference

Description (String) Optional Description text displayed on the cell Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

DetailImageIsCircul Boolean Optional If the value is True, the ar image is displayed in a Value can be one of the circular shape. following:

● True ● False (default)

Footnote Binding, Global Optional Text to be displayed in the footnote Reference, Rule Reference, String Literal

HeadlineText Binding, Global Optional Text for the headline label Reference, Rule Reference, String Literal

Using SAP Cloud Platform Mobile Service, mobile development kit 100 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

PreserveIconStackSp Boolean Literal, Optional Choose whether you want to acing Binding, Global preserve spacing for icons in Reference, Rule the cell even when there are Reference no icons/images added to the icon stack. Value can be one of the following:

● True (default) ● False

ProgressIndicator String Literal, Rule Optional Shows progress indicator Reference icon in the cell

Value can be one of the If both AccessoryType following: and ProgressIndicator ● toDownload properties are set, only the ● inProgress ProgressIndicator is ● open shown.

Status (String) Optional Status text/icon to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Subhead (String) Optional Subhead text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Substatus (String) Optional Substatus text/icon to be displayed on the cell (below OData Binding, Global Status) Reference, Rule Reference, String Literal

Tags Array, String Optional A list of tag labels to be shown below the Subhead

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 101 Parameter Type and Value Required/Optional Comments

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

DescriptionStyle (String) Optional An NSS style to be applied on the description Object Binding, Global Reference, Rule Reference, String Literal

FootnoteStyle (String) Optional An NSS style to be applied on the footnote Object Binding, Global Reference, Rule Reference, String Literal

StatusTextStyle (String) Optional An NSS style to be applied on the status text Object Binding, Global Reference, Rule Reference, String Literal

SubheadStyle (String) Optional An NSS style to be applied on the subhead Object Binding, Global Reference, Rule Reference, String Literal

SubstatusTextStyle (String) Optional An NSS style to be applied on the substatus text Object Binding, Global Reference, Rule Reference, String Literal

TitleStyle (String) Optional An NSS style to be applied on the title Object Binding, Global Reference, Rule Reference, String Literal

The following table displays the parameters and events that you can add to an Object Header Extension:

Using SAP Cloud Platform Mobile Service, mobile development kit 102 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Class (String) Required The name of the exported class in the module that is to be used for the extension

ExtensionProperties (String) Optional Additional custom properties specific to the extension in JSON object format

Module (String) Required The name of the file under app/extensions/ that contains the extension class

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

4.6.1.5.2.10 Section Button Table

Section Button Table is a container that can display one or more buttons on a section page. You can include Section Button controls in a Section Button Table to fire actions when pressed.

The following table displays the parameters and events that you can add to a Section Button Table:

Parameter Type and Value Required/Optional Comments

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 103 Parameter Type and Value Required/Optional Comments

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

The following table displays the parameters and events that you can add to a Section Button:

Parameter Type and Value Required/Optional Comments

TextAlignment (String) Optional Text alignment of the button

Object Binding, Global Reference, String Literal, Rule Reference

Title (String) Optional Label to be displayed on the button Object Binding, Global Reference, String Literal, Rule Reference

Value can be one of the following:

● Centre (default) ● Left ● Right

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid

Using SAP Cloud Platform Mobile Service, mobile development kit 104 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

entity set or readlink that is subscribed to will cause the control to update when the data changes.

Style (String) Optional An NSS Style to be applied on this control Object Binding, Global Reference, String Literal, Rule Reference

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.11 Static Contact Cell

This is a container that can display one or more cotanct cell items on a section page. A Contact Cell item can contain an image, several labels and activity items.

The following table displays the parameters and events that you can add to a Static Contact Cell:

Parameter Type and Value Required/Optional Comments

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 105 Parameter Type and Value Required/Optional Comments

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

The following table displays the parameters and events that you can add to a Contact Cell Item:

Parameter Type and Value Required/Optional Comments

Description (String) Optional Description text displayed on the cell Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

Headline Object Binding, Optional Text for the headline label Global Reference, String Literal, Rule Reference

Subheadline Object Binding, Optional Text for the sub-headline label Global Reference, String Literal, Rule Reference

Using SAP Cloud Platform Mobile Service, mobile development kit 106 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

ActivityItems Phone, Email, Optional Activity items to be VideoCall, Detail displayed in the control (Alert), Message

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

4.6.1.5.2.12 Static Image Collection

4.6.1.5.2.13 Static Key Value

This is a container that can display one or more key value pair items on a section page. In this container, you can include a Key Value Item, a simple key value cell that displays a label and a text pair.

The following table displays the parameters and events that you can add to a Static Key Value container:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It is a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 107 Parameter Type and Value Required/Optional Comments

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

NumberOfColumns (Integer) Optional The number of columns to be displayed

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

The following table displays the parameters and events that you can add to a Key Value Item:

Parameter Type and Value Required/Optional Comments

KeyName (String) Required The key name of the cell

Object Binding, Global Reference, String Literal, Rule Reference

Value (String) Required The value of the property

Object Binding, Global Reference,

Using SAP Cloud Platform Mobile Service, mobile development kit 108 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

String Literal, Rule Reference

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

4.6.1.5.2.14 Static Object Collection

This container includes a view that manages and displays an ordered collection of object items. In this container, you can include Object Cell items, which display information about objects.

The following table displays the parameters and events that you can add to a Static Object Collection container:

Parameter Type and Value Required/Optional Comments

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

NumberOfColumns (Integer) Optional The number of columns to be displayed

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 109 Parameter Type and Value Required/Optional Comments

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

The following table displays the parameters and events that you can add to an Object Cell Item:

Parameter Type and Value Required/Optional Comments

Description (String) Optional Description text displayed on the cell Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

DetailImageIsCircul Boolean Optional If the value is True, the ar image is displayed in a Value can be one of the circular shape. following:

● True ● False (default)

Footnote (String) Optional Text to be displayed in the footnote OData Binding, Global Reference, Rule Reference, String Literal

Icons Image Reference, Rule Optional Icons to be displayed in the Reference cell

PreserveIconStackSp Boolean Literal, Optional Choose whether you want to acing Binding, Global preserve spacing for icons in Reference, Rule the cell even when there are Reference

Using SAP Cloud Platform Mobile Service, mobile development kit 110 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Value can be one of the no icons/images added to the icon stack. following:

● True (default) ● False

ProgressIndicator String Literal, Rule Optional Shows progress indicator Reference icon in the cell

Value can be one of the If both AccessoryType following: and ProgressIndicator ● toDownload properties are set, only the ● inProgress ProgressIndicator is ● open shown.

Status (String) Optional Status text/icon to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Subhead (String) Optional Subhead text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Substatus (String) Optional Substatus text/icon to be displayed on the cell (below OData Binding, Global Status) Reference, Rule Reference, String Literal

Title (String) Optional Title text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 111 Parameter Type and Value Required/Optional Comments

● DetailDisclosure ProgressIndicator is Button shown. ● Checkmark ● DetailButton

FormatRule Rule Optional If FormatRule is specified, the given rule executes when the control is initialized or when the value changes.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

DescriptionStyle (String) Optional An NSS style to be applied on the description Object Binding, Global Reference, Rule Reference, String Literal

FootnoteStyle (String) Optional An NSS style to be applied on the footnote Object Binding, Global Reference, Rule Reference, String Literal

StatusTextStyle (String) Optional An NSS style to be applied on the status text Object Binding, Global Reference, Rule Reference, String Literal

SubheadStyle (String) Optional An NSS style to be applied on the subhead Object Binding, Global Reference, Rule Reference, String Literal

Using SAP Cloud Platform Mobile Service, mobile development kit 112 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

SubstatusTextStyle (String) Optional An NSS style to be applied on the substatus text Object Binding, Global Reference, Rule Reference, String Literal

TitleStyle (String) Optional An NSS style to be applied on the title Object Binding, Global Reference, Rule Reference, String Literal

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

OnAccessoryButtonPr Action, Rule Optional Action or rule to be ess performed when the event is triggered.

This event will only be triggered by pressing the detail button if AccessoryType is set to detailButton or detailDisclosureBut ton.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 113 4.6.1.5.2.15 Static Object Table

This is a table styled view that manages and displays ordered collection of object items. In this container, you can include Object Cell items, which display information about objects.

The following table displays the parameters and events that you can add to a Static Object Table:

Parameter Type and Value Required/Optional Comments

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

The following table displays the parameters and events that you can add to an Object Cell Item:

Parameter Type and Value Required/Optional Comments

Description (String) Optional Description text displayed on the cell Object Binding, Global Reference, String Literal, Rule Reference

DetailImage Image Reference, Rule Optional Image to be displayed in the Reference cell

Using SAP Cloud Platform Mobile Service, mobile development kit 114 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

DetailImageIsCircul Boolean Optional If the value is True, the ar image is displayed in a Value can be one of the circular shape. following:

● True ● False (default)

Footnote (String) Optional Text to be displayed in the footnote OData Binding, Global Reference, Rule Reference, String Literal

Icons Image Reference, Rule Optional Icons to be displayed in the Reference cell

PreserveIconStackSp Boolean Literal, Optional Choose whether you want to acing Binding, Global preserve spacing for icons in Reference, Rule the cell even when there are Reference no icons/images added to the icon stack. Value can be one of the following:

● True (default) ● False

ProgressIndicator String Literal, Rule Optional Shows progress indicator Reference icon in the cell

Value can be one of the If both AccessoryType following: and ProgressIndicator ● toDownload properties are set, only the ● inProgress ProgressIndicator is ● open shown.

Status (String) Optional Status text/icon to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Subhead (String) Optional Subhead text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 115 Parameter Type and Value Required/Optional Comments

Substatus (String) Optional Substatus text/icon to be displayed on the cell (below OData Binding, Global Status) Reference, Rule Reference, String Literal

Title (String) Optional Title text to be displayed on the cell OData Binding, Global Reference, Rule Reference, String Literal

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor ProgressIndicator is ● DetailDisclosure shown. Button ● Checkmark ● DetailButton

FormatRule Rule Optional If FormatRule is specified, the given rule executes when the control is initialized or when the value changes.

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

DescriptionStyle (String) Optional An NSS style to be applied on the description Object Binding, Global Reference,

Using SAP Cloud Platform Mobile Service, mobile development kit 116 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Rule Reference, String Literal

FootnoteStyle (String) Optional An NSS style to be applied on the footnote Object Binding, Global Reference, Rule Reference, String Literal

StatusTextStyle (String) Optional An NSS style to be applied on the status text Object Binding, Global Reference, Rule Reference, String Literal

SubheadStyle (String) Optional An NSS style to be applied on the subhead Object Binding, Global Reference, Rule Reference, String Literal

SubstatusTextStyle (String) Optional An NSS style to be applied on the substatus text Object Binding, Global Reference, Rule Reference, String Literal

TitleStyle (String) Optional An NSS style to be applied on the title Object Binding, Global Reference, Rule Reference, String Literal

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 117 Parameter Type and Value Required/Optional Comments

extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.16 Static Simple Property Collection

This is a container to display one or more Simple Property Cell items, which are reusable UI components used to display key-value pair properties.

The following table displays the parameters and events that you can add to a Static Simple Property Collection:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It is a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

KeyName (String) Required The key name of the cell

Object Binding, Global Reference, String Literal, Rule Reference

Value (String) Required The value of the property

Object Binding, Global Reference, String Literal, Rule Reference

AccessoryType (String) Optional Optional accessory icon to displayed in the cell

Using SAP Cloud Platform Mobile Service, mobile development kit 118 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

Value can be one of the If both AccessoryType following: and

● None (default) ProgressIndicator properties are set, only the ● DisclosureIndica ProgressIndicator is tor shown. ● DetailDisclosure Button ● Checkmark ● DetailButton

MaxItemCount (Integer) Optional The maximum number of items to be displayed in the section

If MaxItemCount is not specified, then all the records are displayed.

MinimumInteritemSpa (Integer) Optional The minimum horizontal cing space between two items

NumberOfColumns (Integer) Optional The number of columns to be displayed

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

EmptySection.Captio Object Binding, Optional Caption label to be displayed n for the extension when the Global Reference, section is empty String Literal, Rule Reference

EmptySection.HidesF Boolean Optional Choose if you want to hide ooter the footer if the section is Value can be one of the empty following:

● True (default) ● False

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 119 Parameter Type and Value Required/Optional Comments

EmptySection.Style Object Binding, Optional An NSS style to be applied Global Reference, on the String Literal, Rule EmptySection.Captio Reference n

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

The following table displays the parameters and events that you can add to a Simple Property Cell Item:

Parameter Type and Value Required/Optional Comments

KeyName (String) Required The key name of the cell

Object Binding, Global Reference, String Literal, Rule Reference

Value (String) Required The value of the property

Object Binding, Global Reference, String Literal, Rule Reference

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor

Using SAP Cloud Platform Mobile Service, mobile development kit 120 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

● DetailDisclosure ProgressIndicator is Button shown. ● Checkmark ● DetailButton

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.17 Footer

This is a section bar control to add a footer bar to compound and container controls. You can drag a footer into any compound or container control (except object header) in a section page.

The following table displays the parameters and events that you can add to a Footer:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 121 Parameter Type and Value Required/Optional Comments

AttributeLabel Object Binding, Optional Text label for the attribute content Global Reference, String Literal, Rule Reference

Caption Object Binding, Optional Text label for the caption content Global Reference, String Literal, Rule Reference

FooterStyle Title (default), Optional A style to be applied on the Attribute, Help footer control

UseBottomPadding (Boolean) Optional Shows or hides the bottom padding of the section footer Value can be one of the (gray seperator) following:

● True (default) ● False

AccessoryType (String) Optional Optional accessory icon to displayed in the cell Value can be one of the following: If both AccessoryType and ● None (default) ProgressIndicator ● DisclosureIndica properties are set, only the tor ProgressIndicator is ● DetailDisclosure shown. Button ● Checkmark ● DetailButton

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

Using SAP Cloud Platform Mobile Service, mobile development kit 122 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

To know more about Actions and Rules, see Metadata Definitions [page 29].

4.6.1.5.2.18 Grid Header

This is a section bar control to add a header bar to the Grid Table. After adding a Grid Header to a section, you can add Grid Row Items into it.

The following table displays the parameters that you can add to a Grid Header:

Parameter Type and Value Required/Optional Comments

IsUsingPercentage Boolean Required Allows you to specify whether the column width is Can be one of the following: a percentage of the total ● True width or is a fixed amount ● False

UseTopPadding (Boolean) Optional Shows or hides the top padding of the section Value can be one of the header (gray seperator) following:

● True (default) ● False

For details about how to configure the row items , see Section Grid Table [page 94].

4.6.1.5.2.19 Header

This is a section bar control to add a header bar to compound and container controls.

The following table displays the parameters and events that you can add to a Header:

Parameter Type and Value Required/Optional Comments

Caption Object Binding, Optional Text label for the caption content Global Reference, String Literal, Rule Reference

UseTopPadding (Boolean) Optional Shows or hides the top padding of the section Value can be one of the header (gray seperator) following:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 123 Parameter Type and Value Required/Optional Comments

● True (default) ● False

4.6.1.5.2.20 Registered Extension Control

This category includes the extension controls that you have created and registered using the MDK editor.

All the registered extension controls are present in the Workspace\MDKExtensionControls folder and are displayed under this category. The following table displays the parameters and events that you can add to a Registered Extension Control:

Parameter Type and Value Required/Optional Comments

Target OData EntitySet 1. Required The properties of OData Binding 2. Optional EntitySet to be used as binding for populating each 3. Required It can be a combination of: cell in the collection 1. EntitySet 1. EntitySet: The name 2. QueryOptions of the entity set to use for this operation 3. Service 2. QueryOptions: A string which can be used to customize the query 3. Service: The Service definition to use for this target

Height Integer, Rule, Global Optional Height of the control

Class (String) Required The name of the exported class in the module that is to be used for the extension

Extension Object Optional Additional custom properties Properties specific to the extension

Module (String) Required The name of the file under app/extensions/ that contains the extension class

DataSubscriptions Array of strings Optional DataSubsriptions is an array of strings. It can be from globals or string literals. It can also be set by a rule that evaluates to an array of strings.

Each of these strings should be a valid OData entity set

Using SAP Cloud Platform Mobile Service, mobile development kit 124 PUBLIC Business Process Expert Guide Parameter Type and Value Required/Optional Comments

name or readlink. Any valid entity set or readlink that is subscribed to will cause the control to update when the data changes.

OnPress Action, Rule Optional Action or rule to be performed when the event is triggered.

ActionReference denotes the path to a file with a .action extension. Eg: /SomeProject/ Actions/ SomeAction.action

RuleReference denotes the path to a file with a .js extension. Eg: / SomeProject/Rules/ SomeRule.js

To know more about Actions and Rules, see Metadata Definitions [page 29].

To know how to register an extension control, see Registering Extension Control [page 40].

4.6.1.6 Create Actions

Actions are configurable event handlers that can perform tasks in your application. You can choose from predefined action types to quickly and easily create actions that would otherwise need to be defined manually using JavaScript.

Prerequisites

You must have a valid Mobile Development Kit project. A ClosePage.action file is automatically created under the Actions folder.

Context

The following steps describe how to create a new action:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 125 Procedure

1. Right-click on the Actions folder and select New MDK Action. 2. On the Template Selection page, choose the type of action you want to create and select Next. 3. On the new page, provide a name for the action. Depending on the action type, you can optionally add existing services to bind with the action. Select Next to proceed. 4. On the Confirmation page, select Finish. A new .action file is created in the Actions folder. Right-click on the .action file and go to Open MDK Action Editor or Open Code Editor to view or edit the code.

 Note

Changes made in the action editor simultaneously appear in the code editor.

You can select the default editor from Preferences Default Editors .

4.6.1.6.1 Common Action Properties

Some metadata properties are common to all action types. For each action, there is a .action file that contains its metadata.

The following table describes metadata properties that are applicable to all action types:

Common Action Properties Property Type Required/Optional Description and Permitted Values

OnFailure String Optional Action or rule that is executed if action fails

OnInvalid String Optional Action or rule that is executed if validation fails

OnSuccess String Optional Action or rule that is executed if action is successful

OnSuccessLog Object Optional Message that is logged if action is successful

OnInvalidLog Object Optional Message that is logged if validation fails

OnFailureLog Object Optional Message that is logged if action fails

Message String Required Message that is logged

Using SAP Cloud Platform Mobile Service, mobile development kit 126 PUBLIC Business Process Expert Guide Property Type Required/Optional Description and Permitted Values

Level String Optional Severity of the log.

Permitted values are:

● Debug (very low severity, such as tracing information) ● Info (low severity, such as information of lapsed event) ● Warn (medium severity, such as potential issues or non- fatal errors) ● Error (high severity, such as information on fatal errors)

 Note If the SetLevel property in Action.Type.Logger.SetLevel holds a higher severity value, then Level priority is overridden and no message is logged.

ShowActivityInd Boolean Optional If True, a progress bar shows the status of the activity or ac­ icator tion(s), and is automatically dismissed on completion.

ActivityIndicat String Optional Text that appears on the progress bar. Default value is orText LOADING.

ValidationRule String Optional Rule that validates the current action

ActionResult Object Required Result of the action that is stored (contain­ It is used to look up a result via a target path or rule. ing a name String ActionResults are available only to subsequent actions chained to an action that stores the action result via OnSuccess or OnFailure actions.

_Name String Required Name of the stored result after the action is executed. You can use this name to search for the result through a target path or rule.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 127 Property Type Required/Optional Description and Permitted Values

_Type String Required Type of action that is performed.

Permitted values are:

● Action.Type.BannerMessage ● Action.Type.ChangeSet ● Action.Type.ChangeUserPasscode ● Action.Type.CheckRequiredFields ● Action.Type.ClosePage ● Action.Type.Logger.Upload ● Action.Type.Logger.SetState ● Action.Type.Logger.SetLevel ● Action.Type.Logger.LogMessage ● Action.Type.Logout ● Action.Type.Message ● Action.Type.Navigation ● Action.Type.ODataService.Create ● Action.Type.ODataService.Open ● Action.Type.ODataService.Read ● Action.Type.ODataService.UpdateEntity ● Action.Type.ODataService.CreateEntity ● Action.Type.ODataService.DeleteEntity ● Action.Type.ODataService.CreateMedia ● Action.Type.ODataService.DeleteMedia ● Action.Type.OfflineOData.Clear ● Action.Type.OfflineOData.Close ● Action.Type.OfflineOData.Initialize ● Action.Type.OfflineOData.Upload ● Action.Type.OfflineOData.Download ● Action.Type.OpenDocument ● Action.Type.PopoverMenu ● Action.Type.Filter ● Action.Type.ToastMessage

 Note

Failed actions are events that have executed, but with errors. Invalid actions do not run at all due to validation errors.

Using SAP Cloud Platform Mobile Service, mobile development kit 128 PUBLIC Business Process Expert Guide Common Action Code Code Schema Code Sample

{

"OnFailure" : (String: Optional), "OnInvalidAction" : (String: Optional), "OnSuccess" : (String: Optional), "OnSuccessLog": (Optional) { "Message": (String: Required), "Level": (String: Optional), }, "OnInvalidLog": (Optional) { "Message": (String: Required), "Level": (String: Optional), }, "OnFailureLog": (Optional) { "Message": (String: Required), "Level": (String: Optional), }, "ShowActivityIndicator" : (Boolean: Optional), "ActivityIndicatorText" : (String: Optional), "ValidationRule" : (String: Optional), "ActionResult": (Optional) { "_Name": (String: Required), }, "_Type" : (ActionTypeString: Required)

}

4.6.1.6.1.1 General Actions

Create actions that enable users to interact with your application, such as navigating through pages, opening documents, or logging out.

4.6.1.6.1.1.1 Navigation

Define how pages appear and enable a user to navigate through your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to navigation actions:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 129 Navigation Action Properties Property Type Required/Optional Description and Permitted Values

ModalPageFullsc Boolean Optional If True, the modal page appears in full screen. Default value is reen False.

 Note

By design, modal pages always appear in full screen on the Apple iPhone.

ModalPage Boolean Optional Indicates if a page is modal. Default value is False.

PageToOpen String Required Page to navigate to, references a .page file.

 Note

If a modal page is set to full screen, all pages opened from that modal page will also appear in full screen. When you close a full-screen modal page, all full-screen modal pages in the background are closed automatically and the parent page appears.

See the following table for the code schema and sample:

Navigation Action Code Code Schema Code Sample

{

"PageToOpen" : (String: Required), "ModalPage" : (Boolean: Optional), "ModalPageFullscreen" : (Boolean: Optional), "_Type" : "Action.Type.Navigation"

}

4.6.1.6.1.1.2 Close Page Action

You can close pages with the option to terminate ongoing events or wait until they are complete.

Change set actions are configured as an array of actions that are executed in succession. In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to change set actions:

Using SAP Cloud Platform Mobile Service, mobile development kit 130 PUBLIC Business Process Expert Guide Close Page Action Properties Property Type Required/Optional Description and Permitted Values

DismissModal String Optional Control how the page is closed. Value can be: ● Action.Type.ClosePage.Completed (closes the page after pending actions are executed) ● Action.Type.ClosePage.Cancel (terminates ex­ ecution of current and pending actions, and closes the page)

See the following table for the code schema and sample:

Close Page Action Code Code Schema Code Sample

{ // Close page

"$schema": "http:// { json-schema.org/ "_Type": "Action.Type.ClosePage"

schema#", } "description": "A change set action", // Close page with CANCEL specified "type": "object", "properties": { { "DismissModal": { "DismissModal": "Action.Type.ClosePage.Cancel", "_Type": "Action.Type.ClosePage" "type": "string", } "oneOf": [ { / Close page with COMPLETED specified

"Action.Type.ClosePag { e.Canceled" "DismissModal": "Action.Type.ClosePage.Completed", "_Type": "Action.Type.ClosePage" }, { }

"Action.Type.ClosePag e.Completed" } ] "_Type" : {

"description": "The type string used for Close Page action instances", "pattern": "Action.Type.ClosePag e", "type": "string" } }, "required": ["_Type"]

}

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 131 4.6.1.6.1.1.3 Barcode Scanner Action

Define actionn that allow users to open a barcode scanner on a mobile device and check the device for prerequisite conditions, such as, the availability and accesibiity of camera.

Barcode Scanner Action Properties Property Type Required/Optional Description and Permitted Values

_Type Action Required ● CheckBarcodeScannerPrerequisite: This ac­ tion will check the prerequisite condition of the barcode scanner, such as the camera's availability and accessibil­ ity on mobile devices. ● OpenBarcodeScanner: This action will open the bar­ code scanner and return result after scanning.

OnSuccess String Optional The action or rule to execute if this action succeeds

OnFailure String Optional The action or rule to execute if this action fails

See the following table for the code schema and sample:

Barcode Scanner Action Code Code Schema Code Sample

{ {

"_Type" : "_Type" : "Action.Type.CheckBarcodeScannerPre "Action.Type.CheckBarcodeScannerPrerequis requisite", ite", "OnSuccess" : (String: "OnSuccess" : "/MDKApp/Rules/ Optional), BarcodeScanner/ "OnFailure" : (String: CheckBarcodeScannerPrerequisiteResult.js" Optional) , "ActionResult": { "OnFailure" : "/MDKApp/Actions/

} BarcodeScanner/ CheckBarcodeScannerPrerequisiteFailure.ac tion", "ActionResult": { "_Name": "CheckCamera"

}

{ {

"_Type" : "_Type" : "Action.Type.OpenBarcodeScanner", "Action.Type.OpenBarcodeScanner", "OnSuccess" : (String: "OnSuccess" : "/MDKApp/Rules/ Optional), BarcodeScanner/ "OnFailure" : (String: ShowBarcodeScanningResult.js", Optional) "OnFailure" : "/MDKApp/Actions/ "ActionResult": { BarcodeScanner/

} OpenBarcodeScannerFailure.action", "ActionResult": { "_Name": "BarcodeScanner"

}

Using SAP Cloud Platform Mobile Service, mobile development kit 132 PUBLIC Business Process Expert Guide 4.6.1.6.1.1.4 Push Notification Action

Register a device with SAP Cloud Platform mobile service for development and operations to allow push notifications to be sent to the device.

Push Notification Action Properties Property Type Required/Optional Description and Permitted Values

_Type Action Required ● PushNotificationRegister: This action will regis­ ter the device with the mobile service for development and operations for push notification. ● PushNotificationUnregister: This action will unregister the device from the mobile service for development and operations for push notification.

OnSuccess String Optional The action or rule to execute if this action succeeds

OnFailure String Optional The action or rule to execute if this action fails

See the following table for the code schema and sample:

Push Notification Action Code Code Schema Code Sample

{ {

"_Type" : "_Type" : "Action.Type.PushNotificationRegist "Action.Type.PushNotificationRegister", er", "OnSuccess" : "/MDKDevApp/Actions/ "OnSuccess" : (String: PushNotification/ Optional), PushNotificationRegisterSuccessMessage.ac "OnFailure" : (String: tion", Optional) "OnFailure" : "/MDKDevApp/Actions/

} PushNotification/ PushNotificationRegisterFailureMessage.ac tion"

}

{ {

"_Type" : "_Type" : "Action.Type.PushNotificationUnregi "Action.Type.PushNotificationUnregister", ster", "OnSuccess" : "/MDKApp/Actions/ "OnSuccess" : (String: PushNotification/ Optional), PushNotificationUnregisterSuccessMessage. "OnFailure" : (String: action", Optional) "OnFailure" : "/MDKApp/Actions/

} PushNotification/ PushNotificationUnregisterFailureMessage. action"

}

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 133 4.6.1.6.1.1.5 Change User Passcode

Define an action that allows users to change their passcode or Touch ID.

The following code will trigger a change passcode event:

{

"_Type" : "Action.Type.ChangeUserPasscode"

}

4.6.1.6.1.1.6 Logout Action

Define an action that allows the user to log out of the application.

The following code will trigger a logout action:

{

"_Type" : "Action.Type.Logout"

}

 Note

Once the user is logged out, no other actions are possible in that session and the welcome screen appears on the application. All stored credentials such as passcode or Touch ID, authentication token, Offline Store, and so on are cleared from the device. Also, success or failure event handlers are not applicable to the this action.

4.6.1.6.1.1.7 Message Actions

You can show important information to your app user through messages.

The following message types can be defined in Mobile Development Kit:

● Message Action [page 134] ● Toast Message Action [page 135] ● Banner Message Action [page 136]

4.6.1.6.1.1.7.1 Message Action

A basic message prompt with a button that allows the user to acknowledge and dismiss the message. In Mobile Development Kit, you can create such messages and define their behavior.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to message actions:

Using SAP Cloud Platform Mobile Service, mobile development kit 134 PUBLIC Business Process Expert Guide Message Action Properties Property Type Required/Optional Description and Permitted Values

OKCaption String Optional Text on the button. Value can be literal, a bound object, global variable, or rule.

Message String Optional Text in the prompt that conveys the message. Value can be lit­ eral, a bound object, global variable, or rule.

Title String Optional Title of the message prompt. Value can be literal, a bound ob­ ject, global variable, or rule.

See the following table for the code schema and sample:

Message Action Code Code Schema Code Sample

{

"OKCaption" : (String: Optional), "Message" : (String: Optional), "Title" : (String: Optional), "_Type" : "Action.Type.Message",

}

4.6.1.6.1.1.7.2 Toast Message Action

Toast messages appear as pop-ups that are automatically dismissed after a defined duration. In Mobile Development Kit, you can create toast messages and define their behavior.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to toast message actions:

Toast Message Action Properties Required/ Property Type Optional Description and Permitted Values

Message String Required Text that conveys the message. Value can be literal, a bound object, global variable, or rule.

Icon Image ref­ Optional File path to the location of the image that appears as an icon in the mes­ erence sage. Value can be literal, a global variable, or rule. Default image is a check-mark.

IsIconHidde Boolean Optional If True, the icon is hidden. Value can be literal, a global variable, or rule. n Default value is False.

NumberOfLin Number Optional Number of lines of the message text that is shown. Value can be literal, a es global variable, or rule. Default value is 1.

Duration Number Optional Number of seconds that the message is shown. Value can be literal, a global variable, or rule. Default value is 2.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 135 Required/ Property Type Optional Description and Permitted Values

Animated Boolean Optional If True, the message has an animated effect. Value can be literal, a global variable, or rule. Default value is False.

 Note

Failure event handlers cannot be defined for toast messages. On the other hand, you must use success event handlers while binding other actions to a toast message. Once the toast message appears, subsequent actions are executed immediately.

See the following table for the code schema and sample:

Toast Message Action Code Code Schema Code Sample

{

"Message": (String: Required), "Icon": (ImageReference, Optional), "IsIconHidden": (Boolean: Optional), "NumberOfLines": (Number: Optional), "Duration": (Number: Optional), "Animated": (Boolean: Optional), "_Type": " Action.Type.ToastMessage"

}

4.6.1.6.1.1.7.3 Banner Message Action

Banner messages appear on the application's main navigation bar, and are automatically dismissed after a defined duration. They are generally used to notify the user of errors.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to banner message actions:

Banner Message Action Properties Required/ Property Type Optional Description and Permitted Values

Message String Required Text that conveys the message. Value can be literal, a bound object, global variable, or rule.

Duration Number Optional Number of seconds that the message is shown. Value can be literal, a global variable, or rule. Default value is 2.

Animated Boolean Optional If True, the banner has an animated effect. Value can be literal, a global variable, or rule. Default value is True.

Using SAP Cloud Platform Mobile Service, mobile development kit 136 PUBLIC Business Process Expert Guide  Note

Failure event handlers cannot be defined for banner messages. On the other hand, you must use success event handlers while binding other actions to a banner message. Once the banner message appears, subsequent actions are executed immediately.

Do not use banner messages for modal screens that do not have a navigation bar due to reduced size. In such cases, the background on the host page (where the main navigation bar normally appears) is dimmed.

See the following table for the code schema and sample:

Banner Message Action Code Code Schema Code Sample

{

"Message": (String: Required), "Duration": (Number: Optional), "Animated": (Boolean: Optional), "_Type": " Action.Type.BannerMessage"

}

4.6.1.6.1.1.8 Open Document Action

Enable the app user to open a file at a specified location with a selected third party application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the open document action:

Open Document Action Properties Required/ Property Type Optional Description and Permitted Values

Path String Required Path to the location of the file. Value can be: ● Prefixed with res:// (file is embedded in the main bundle) ● A full path (file is located in the application's sandbox system)

See the following table for the code schema and sample:

Open Document Action Code Code Schema Code Sample

{

"Path" : (String: Required), "_Type" : "Action.Type.OpenDocument"

}

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 137 4.6.1.6.1.1.9 Check Required Fields Action

You can run a check to make sure that the app user has provided inputs for all required fields. Specific UI controls or rules allow you to define a field as mandatory.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the check required fields action:

Check Required Fields Action Properties Required/ Property Type Optional Description and Permitted Values

RequiredFie String Required Names of required fields. Value can be an array of string constants or a lds rule.

See the following table for the code schema and sample:

Check Required Fields Action Code Code Schema Code Sample

{

"RequiredFields": (OneOf(Array{String}, Rule): Required), "_Type": "Action.Type.CheckRequiredFields",

}

4.6.1.6.1.1.10 Popover Menu Action

You can create a customized popover menu containing a list of items and corresponding events.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the popover menu action:

Popover Menu Action Properties Required/ Property Type Optional Description and Permitted Values

Title String Optional Title of the popover menu

Message String Optional Text that appears on the popover menu

PopoverItem Array Required Array of items that appears on the popover menu s

Using SAP Cloud Platform Mobile Service, mobile development kit 138 PUBLIC Business Process Expert Guide See the following table for the code schema and sample:

Popover Menu Action Code Code Schema Code Sample

{

"Title": (String: Optional), "Message": (String: Optional), "PopoverItems": (Array{PopoverItems}:Required), "_Type": "Action.Type.PopoverMenu"

}

4.6.1.6.1.1.10.1 Popover Items

You can create items that appear on the popover menu.

The following table describes metadata properties that are applicable to popover items:

Popover Item Properties Required/ Property Type Optional Description and Permitted Values

Title String Required Title of the popover menu

Icon Image ref­ Optional Text or icon that appears on the popover menu erence

OnPress Reference Required Action that is triggered when item is selected to action or rule

Visible Boolean Optional If False, item is hidden. Default value is True.

Enabled Boolean Optional If False, item is disabled. Default value is True.

See the following table for the code schema and sample:

Popover Item Code Code Schema Code Sample

{

"Title": (String: Required), "Icon": (ImageReference, Optional), "OnPressAction": (ActionOrRuleReference)

}

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 139 4.6.1.6.1.1.11 Log Actions

Logs help you trace events that occur while your application is running. You can create logging actions, set their priority levels and upload stored log entries.

The following log actions are supported:

● Log Message [page 140] ● Set Level [page 141] ● Set State [page 140] ● Upload [page 142]

4.6.1.6.1.1.11.1 Log Message

You can set log messages and categorize them based on the severity level.

The following table describes metadata properties that are applicable to the log message action:

Log Message Properties Required/ Property Type Optional Description and Permitted Values

Message String Required Message that is logged

Level String Optional Severity level of the log message. Value can be one of the following: ● Debug (very low severity, such as tracing information) ● Info (low severity, such as information of lapsed event) ● Warn (medium severity, such as potential issues or non-fatal er­ rors) ● Error (high severity, such as information on fatal errors)

See the following table for the code schema and sample:

Log Message Code Code Schema Code Sample

{

"Message": (String: Required), "Level": (String: Optional), "_Type": " Action.Type.Logger.LogMessage"

}

4.6.1.6.1.1.11.2 Set State

You can enable, disable or set the logger to automatically toggle itself during execution.

The following table describes metadata properties that are applicable to the set state action:

Using SAP Cloud Platform Mobile Service, mobile development kit 140 PUBLIC Business Process Expert Guide Set State Properties Required/ Property Type Optional Description and Permitted Values

LogFileName String Optional Name of the log file. Default name is ClientLog.txt.

MaxFileSize Number Optional Maximum size of the log file in megabytes (MB). Default size is 5MB. If value is 0, the file size is not limited.

LoggerState String Required State of the logger. Value can be: ● On ● Off ● Toggle

See the following table for the code schema and sample:

Set State Code Code Schema Code Sample

{

"LogFileName": (String: Optional), "MaxFileSize": (Number: Optional), "LoggerState": (String: Required), "_Type": "Action.Type.Logger.SetState" }

4.6.1.6.1.1.11.3 Set Level

You can set the category of the log based on severity.

The following table describes metadata properties that are applicable to the set level action:

Set Level Properties Required/ Property Type Optional Description and Permitted Values

LogLevel String Required Severity level of the log. Value can be one of the following: ● Debug (very low severity, such as tracing information) ● Info (low severity, such as information of lapsed event) ● Warn (medium severity, such as potential issues or non-fatal er­ rors) ● Error (high severity, such as information on fatal errors)

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 141 See the following table for the code schema and sample:

Set Level Code Code Schema Code Sample

{

"LogLevel": (String: Required), "_Type": "Action.Type.Logger.SetLevel"

}

4.6.1.6.1.1.11.4 Upload

You can upload stored logs from the user's mobile device to SAP Cloud Platform mobile service for development and operations.

See the following table for the code schema and sample:

Upload Code Code Schema Code Sample

{

"_Type": " Action.Type.Logger.Upload" }

4.6.1.6.1.1.12 Change Set Action

You can define a set of actions or rules that are executed serially.

Change set actions are configured as an array of actions that are executed in succession. In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to change set actions:

Change Set Action Properties Property Type Required/Optional Description and Permitted Values

Actions Array Required Array of defined actions or rules that are executed one after another

Using SAP Cloud Platform Mobile Service, mobile development kit 142 PUBLIC Business Process Expert Guide Property Type Required/Optional Description and Permitted Values

Target OData 1. Required The properties of OData EntitySet to be used as binding for EntityS 2. Optional populating each cell in the collection et 3. Required 1. EntitySet: The name of the entity set to use for this Binding operation

It is a com­ 2. QueryOptions: A string which can be used to custom­ ize the query bination 3. : The Service definition to use for this target of: Service

1. Enti tySe t 2. Quer yOpt ions 3. Serv ice

 Note

If any action in the change set fails, the entire change set fails to execute.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 143 See the following table for the code schema and sample:

Change Set Action Code Code Schema Code Sample

{ // MULTI-PAGE SAMPLE WITH EVENT HANDLER

"$schema": "http:// { json-schema.org/ "Actions": [ schema#", "/AssetWorkManager/Actions/ChangeSet/ "description": "A NavigateToPageOne.action", change set action", "/AssetWorkManager/Actions/ChangeSet/ "type": "object", NavigateToPageTwo.action" "properties": { ], "Actions": { "OnFailure": "/AssetWorkManager/Actions/ChangeSet/ "items": { ChangeSet1Failed.action", "OnSuccess": "/AssetWorkManager/Actions/ChangeSet/ "description": "Full ChangeSet1Success.action", paths to Action "Target": { references", "Service": "/AssetWorkManager/Services/Amw.service" "$ref": "#/ }, definitions/ "_Type": "Action.Type.ChangeSet"

actionReference" } }, "minLength": 1, "type": "array" } "_Type" : {

"description": "The type string used for Change Set Action instances", "pattern": "Action.Type.OData.Ch angeSet", "type": "string" } }, "definitions": {

"actionReference": { "description": "", "pattern": "/^[^\/]+\/Actions\/? (?:[^\/]+\/?)*$/gm", "type": "string" } }, "required": ["_Type"]

}

Using SAP Cloud Platform Mobile Service, mobile development kit 144 PUBLIC Business Process Expert Guide 4.6.1.6.1.1.12.1 Link New Entities From a Change Set

Entities that are created as part of a change set are not stored until it has executed. Therefore, querying for these entities will return empty results. A ReadLink helps overcome this limitation.

When entities are created in a change set, they are assigned a temporary, ordinal ReadLink until the change set completes execution. In subsequent actions of the change set, you can use the ReadLink to refer to these entities. ReadLink contains the prefix "pending_", followed by an ordinal, such as "pending_1", "pending_2" and so on.

The following table describes metadata properties that are used to link entities within a change set:

Create Links Properties Property Type Required/Optional Description and Permitted Values

Property String Required Property of a collection in the OData service

EntitySet String Required OData service over which the actions or rules from the change set are executed

ReadLink String Required ReadLink name of the entity

See the following table for the code schema and sample:

Create Links Code Code Schema Code Sample

"CreateLinks": [

{ "Property": "WOHeader", "Target": { "EntitySet": "MyWorkOrderHeaders", "ReadLink": "pending_1" } }

]

4.6.1.6.1.2 OData Actions

You can bind and modify OData services and associated entities in your application.

4.6.1.6.1.2.1 Create Service Action

You can bind an OData service to your application, to access its data.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData create service action:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 145 Create Service Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required Reference to the OData service to bind to the application

See the following table for the code schema and sample:

Create Service Action Code Code Schema Code Sample

{ {

"Service": (String: Required), "Service": "/TestProject/Services/ "_Type": TestService.service", "Action.Type.ODataService.Create" "_Type":

} "Action.Type.ODateService.Create"

}

4.6.1.6.1.2.2 Open Service Action

You can view the data from a bound OData service in your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData open service action:

Open Service Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required Reference to the bound OData service that is to be created

Password String Required Password as part of credentials that are authorized to access this service

Username String Required Username as part of credentials that are authorized to access this serv­ ice

See the following table for the code schema and sample:

Open Service Action Code Code Schema Code Sample

{ {

"Password": (String: Required), "Password": "1234", "Service": (String: Required), "Service": "/TestProject/Services/ "Username": (String: Required), TestService.service", "_Type": "Username": "el_jefe", "Action.Type.ODataService.Open", "_Type":

} "Action.Type.ODataService.Open",

}

Using SAP Cloud Platform Mobile Service, mobile development kit 146 PUBLIC Business Process Expert Guide 4.6.1.6.1.2.3 Read Service Action

You can access data from an OData service that is bound to your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData read service action:

Read Service Action Properties Required/ Property Type Optional Description and Permitted Values

Properties Array Optional List of properties in the OData service

Target Object Required Contains target properties

EntitySet String Required Name of the entity in the OData service

QueryOption String Optional Additional query options such as Filter or OrderBy s

Service String Required Name of the OData service to access

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 147 See the following table for the code schema and sample:

Read Service Action Code Code Schema Code Sample

{ {

"Properties": "Properties": [], (Array{String}:Optional), "Target": { "Target": { "EntitySet": "EntitySet": (String, "MyWorkOrderHeaderCollection", Required), "QueryOptions": "$filter=OrderType "QueryOptions": (String: eq 'PM01'", Optional), "Service": "/AssetWorkManager/ "Service": (String, Services/Amw.service" Required), }, }, "OnFailure": "/AssetWorkManager/ "_Type": Actions/OData/ "Action.Type.ODataService.Read", ODataReadFailureMessage.action",

} "OnSuccess": "/AssetWorkManager/ Actions/OData/ ODataReadSuccessMessage.action", "_Type": "Action.Type.ODataService.Read" } { "Target": { "EntitySet": "WOHeaders", "Service": "/AssetWorkManager/ Services/Amw.service" }, "Properties": [ "OrderDesc", "OrderID"], "OnFailure": "/AssetWorkManager/ Actions/OData/ ODataReadFailureMessage.action", "OnSuccess": "/AssetWorkManager/ Actions/OData/ ODataReadSuccessMessage.action", "_Type": "Action.Type.ODataService.Read"

}

4.6.1.6.1.2.4 Call Function Service Action

You can call for a Odata service function import on the backend.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData call function service action:

Call Function Service Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

Function Object Required Contains function properties

Using SAP Cloud Platform Mobile Service, mobile development kit 148 PUBLIC Business Process Expert Guide Required/ Property Type Optional Description and Permitted Values

Service String Required The service used for the CallFunction operation

Name String Required Name of the FunctionImport in the OData service

Parameters Map{Liter­ Optional Parameters used for the pass values for CallFunction operation. alString, Example: {"OrderID":1001, "Comment":"This is a gift"} (Global/ Target­ Path/ Literal­ String/ RuleRefer­ ence)}

See the following table for the code schema and sample:

Call Function Service Action Code Code Schema Code Sample

{ {

"Target": { "Target": { "EntitySet": (String, "Function": { Required), "Name": "AddComment", "QueryOptions": (String: "Parameters": { Optional), "OrderID": "{OrderID}", "Service": (String, "Comment": "CommentText" Required), } }, }, "Function": { "Service": "/MDKOnlineMedia/Services/ "Name": (String, Required), Online.service" "Parameters": }, (Map{LiteralString, (Global or "_Type": TargetPath or LiteralString or "Action.Type.ODataService.CallFunction" RuleReference)}: Optional) }

}, } "Service": (String:Required), "_Type": "Action.Type.ODataService.CallFunct ion"

}

4.6.1.6.1.2.5 Create Entity Action

Create entities in a bound OData service from your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData create entity action:

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 149 Create Entity Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

EntitySet String Required Name of the new entity set to create

Service String Required Name of the OData service where new entity

Properties String Required Properties of the new entity. Value can be TargetPath, LiteralString or RuleReference.

Headers String Optional Header values for the OData service that are resolved from context. Header must be in the following format: ● Map{String, Map{String, String} or String} or ● Map{String, String}

See the following table for the code schema and sample:

Create Entity Action Code Code Schema Code Sample

{ {

"_Type": "_Type": "Action.Type.ODataService.CreateEnt "Action.Type.ODataService.CreateEntity", ity" "Target": { "Target": { "EntitySet": "EntitySet": (String, "MyWorkOrderOperationCollection", Required), "Service": "/AssetWorkManager/ "Service": (String, Services/Amw.service", Required), }, }, "Properties" : { "Properties": (Map{String, "OrderId": "#Control:OrderId/ String}, Required), #Value", "Headers": (Map{String, "OperationNo": Map{String, String}}, Optional) "#Control:OperationNo/#Value"

} }, "Headers" : { "Nonmergable": "true", "slug" : { "ClassName": "#CurrentPage/ #Control:ClassName/#Value", "ClassType": "#CurrentPage/ #Control:ClassType/#Value", "ObjectKey": "#CurrentPage/ #Control:ObjectKey/#Value", "FileName": "#CurrentPage/ #Control:FileName/#Value" } }, "OnSuccess" : "/AssetWorkManager/ Actions/ ODataCreateEntitySuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ ODataCreateEntityFailureMessage.action" }

Using SAP Cloud Platform Mobile Service, mobile development kit 150 PUBLIC Business Process Expert Guide 4.6.1.6.1.2.5.1 Link Entities Using Dynamic Query String

Use dynamic string query to link entities in a bound OData service through your application.

The following table describes metadata properties that are applicable to linking entities:

Link Entities (by Dynamic Query String) Metadata Properties Required/ Property Type Optional Description and Permitted Values

Property String Required Navigation property name of the source entity. Value can be literal, a global variable, or a rule.

Target Object Required Properties of the target entity

EntitySet String Required Name of the entity that is read

QueryOption String Optional Specifies additional query options such as Filter or OrderBy s

ReadLink String Optional Refers to entities created as part of a change set action. See Link New Entities From a Change Set [page 145].

Either ReadLink or QueryOptions must be used. QueryOptions has precedence if both are present.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 151 See the following table for the code schema and sample:

Link Entities (by Dynamic Query String) Code Code Schema Code Sample

{ {

"_Type": "_Type": "Action.Type.ODataService.CreateEnt "Action.Type.ODataService.CreateEntity", ity", "Target": { "Target": { "EntitySet": "EntitySet": (String, "MyWorkOrderOperationCollection", Required), "Service": "/AssetWorkManager/ "Service": (String, Services/Amw.service", Required), }, }, "Properties" : { "Properties": (Map{String, "OrderId": "#Control:OrderId/ String}, Required), #Value", "Headers": (Map{String, "OperationNo": Map{String, String}}, Optional), "#Control:OperationNo/#Value" "CreateLinks": [ { }, "Property": (String: "Headers" : { [Global, Literal or Rule], "Nonmergable": "true", Required), "slug" : { "Target": { "ClassName": "#CurrentPage/ "EntitySet": (String, #Control:ClassName/#Value", Required), "ClassType": "#CurrentPage/ "QueryOptions": (String, #Control:ClassType/#Value", Optional) // must use this or "ObjectKey": "#CurrentPage/ ReadLink #Control:ObjectKey/#Value", "ReadLink": (String: "FileName": "#CurrentPage/ Optional) // must use this or #Control:FileName/#Value" QueryOptions } } }, } "CreateLinks": [ { ] "Property": "OperationEquipment", } "Target": {

"EntitySet": "Equipmentcollection",, "QueryOptions": "$filter=EquipmentId eq '{{#Page:- Previous/#Property:EquipmentId}}'" } } ], "OnSuccess" : "/AssetWorkManager/ Actions/ ODataCreateEntitySuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ ODataCreateEntityFailureMessage.action"

}

4.6.1.6.1.2.5.2 Link Entities Using Rule

Use a rule to link entities in a bound OData service through your application.

You can use rules instead of dynamic query strings to create links between entities.

Using SAP Cloud Platform Mobile Service, mobile development kit 152 PUBLIC Business Process Expert Guide See the following table for the code schema and sample:

Link Entities (by Rule) Code Code Schema Code Sample

{ {

"_Type": "_Type": "Action.Type.ODataService.CreateEnt "Action.Type.ODataService.CreateEntity", ity", "Target": { "Target": { "EntitySet": "EntitySet": (String, "MyWorkOrderOperationCollection", Required), "Service": "/AssetWorkManager/ "Service": (String, Services/Amw.service", Required), }, }, "Properties" : { "Properties": (Map{String, "OrderId": "#Control:OrderId/ String}, Required), #Value", "Headers": (Map{String, "OperationNo": Map{String, String}}, Optional), "#Control:OperationNo/#Value" "CreateLinks": (String, }, Required) //Rule name "CreateLinks": "LinkRule.js", } "OnSuccess" : "/AssetWorkManager/

Actions/ ODataCreateEntitySuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ ODataCreateEntityFailureMessage.action"

}

4.6.1.6.1.2.6 Update Entity Actions

Modify existing entities in a bound OData service from your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData update entity action:

Update Entity Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

EntitySet String Required Name of the new entity to be created

Service String Required Name of the OData service of the new entity

Properties String Required Properties of the new entity. Value can be TargetPath, LiteralString or RuleReference.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 153 Required/ Property Type Optional Description and Permitted Values

Headers Object Required Header values for the OData service. It must be in the following format: ● Map{String, Map{String, String} or String} or ● Map{String, String}

For example:

{

'Header1': { 'Parameter1': String, 'Parameter2': String, }, 'Header2': { 'Parameter1': String, 'Parameter2': String, }, 'Header3': String

}

See the following table for the code schema and sample:

Update Entity Action Code Code Schema Code Sample

// Update entities without links // Update entities without links

{ { "Target": { "Properties": { "EntitySet": (String, "OrderDesc": Required), "#Page:UpdateOrder/#Control:Description", "Service": (String, "OrderComment": "Order created Required), with SnowBlind", "ReadLink": (String: "OrderQty": "/TestProject/Rules/ Required) OrderQtyRule.js" }, }, "Properties": (Map{String, "Headers" : { String}, Optional), "Nonmergable": "true", "Headers": (Map{String, "slug" : { Map{String, String}}, Optional), "ClassName": "#CurrentPage/ "_Type": #Control:ClassName/#Value", "Action.Type.ODataService.UpdateEnt "ClassType": "#CurrentPage/ ity" #Control:ClassType/#Value",

} "ObjectKey": "#CurrentPage/ #Control:ObjectKey/#Value", "FileName": "#CurrentPage/ #Control:FileName/#Value" } }, "Target": { "EntitySet": "Workorder", "Service": "/TestProject/Services/ TestService.service", "ReadLink": "{@odata.readLink}" }, "ValidationRule": "/TestProject/ Rules/ValidateWorkorder.js", "_Type": "Action.Type.ODataService.UpdateEntity"

}

Using SAP Cloud Platform Mobile Service, mobile development kit 154 PUBLIC Business Process Expert Guide Code Schema Code Sample

// Update entities with links // Update entities with links

{ { "_Type": "Headers" : { "Action.Type.ODataService.UpdateEnt "Nonmergable": "true", ity", "slug" : { "Target": { "ClassName": "#CurrentPage/ "EntitySet": (String, #Control:ClassName/#Value", Required), "ClassType": "#CurrentPage/ "Service": (String, #Control:ClassType/#Value", Required), "ObjectKey": "#CurrentPage/ "ReadLink": (String: #Control:ObjectKey/#Value", Required) "FileName": "#CurrentPage/ }, #Control:FileName/#Value" "Properties": (Map{String, } String}, Optional), }, "Headers": (Map{String, "Target" : { Map{String, String}}, Optional), "EntitySet" : "UpdateLinks": [ { "MyWorkOrderOperationCollection", "Property": (String: "Service" : "/AssetWorkManager/ [Global, Literal or Rule], Services/Amw.service", Required), "ReadLink": "{@odata.readLink}" "Target": { }, "EntitySet": (String, "UpdateLinks": [{ Required), "Property": "EquipmentOperation", "QueryOptions": (String, "Target": { Optional) // must use this OR "EntitySet": "MyEquipments", ReadLink "QueryOptions": "ReadLink": (String: "$filter=EquipId eq Optional) // must use this OR '{{#Control:OperationEquipment2/ QueryOptions #Value}}'" } } } } ] // or Rule ],

} "_Type": "Action.Type.ODataService.UpdateEntity", "OnSuccess" : "/AssetWorkManager/ Actions/ ODataUpdateSuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ODataUpdateFailureMessage.action"

}

// Update entities with links using a rule

{ "Headers" : { "Nonmergable": "true", "slug" : { "ClassName": "#CurrentPage/ #Control:ClassName/#Value", "ClassType": "#CurrentPage/ #Control:ClassType/#Value", "ObjectKey": "#CurrentPage/ #Control:ObjectKey/#Value", "FileName": "#CurrentPage/ #Control:FileName/#Value" } }, "Target" : { "EntitySet" : "MyWorkOrderOperationCollection",

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 155 Code Schema Code Sample

"Service" : "/AssetWorkManager/ Services/Amw.service", "ReadLink": "{@odata.readLink}" }, "UpdateLinks": "LinkRule.js", "_Type": "Action.Type.ODataService.UpdateEntity", "OnSuccess" : "/AssetWorkManager/ Actions/ ODataUpdateSuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ODataUpdateFailureMessage.action"

}

4.6.1.6.1.2.7 Delete Entity Action

Delete entities, or their links in a bound OData service, from your application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the OData delete entity action:

Delete Entity Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

EntitySet String Required Name of the entity to delete

Service String Required Name of the OData service of the entity to be deleted

ReadLink String Required Entity ID that identifies the entity in the offline store

Headers Object Required Header values for the OData service. It must be in the following format: ● Map{String, Map{String, String} or String} or ● Map{String, String}

For example:

{

'Header1': { 'Parameter1': String, 'Parameter2': String, }, 'Header2': { 'Parameter1': String, 'Parameter2': String, }, 'Header3': String

}

Using SAP Cloud Platform Mobile Service, mobile development kit 156 PUBLIC Business Process Expert Guide See the following table for the code schema and sample:

Delete Entity Action Code Code Schema Code Sample

// Delete Entity // without links to Delete

{ { "Target": { "Target": { "EntitySet": (String, "EntitySet": "Workorder", Required), "Service": "/TestProject/Services/ "Service": (String, TestService.service", Required), "ReadLink": "{@odata.readLink}" "ReadLink": (String: }, Required) "Headers" : { }, "Nonmergable": "true", "Properties": (Map{String, "slug" : { String}, Optional), "ClassName": "#CurrentPage/ "Headers": (Map{String, #Control:ClassName/#Value", Map{String, String}}, Optional), "ClassType": "#CurrentPage/ "_Type": #Control:ClassType/#Value", "Action.Type.ODataService.DeleteEnt "ObjectKey": "#CurrentPage/ ity" #Control:ObjectKey/#Value",

} "FileName": "#CurrentPage/ #Control:FileName/#Value" } }, "ValidationRule": "/TestProject/ Rules/ValidateWorkorder.js", "_Type": "Action.Type.ODataService.DeleteEntity"

}

// Delete Links

{ "_Type": "Action.Type.ODataService.UpdateEnt ity", "Target": { "EntitySet": (String, Required), "Service": (String, Required), "ReadLink": (String: Required) }, "Properties": (Map{String, String}, Required), "Headers": (Map{String, Map{String, String}}, Optional), "DeleteLinks": [ { "Target": { "EntitySet": (String, Required), "QueryOptions": (String, Optional) // must use this OR ReadLink "ReadLink": (String: Optional) // must use this OR QueryOptions } } ] // or Rule

}

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 157 4.6.1.6.1.2.8 Offline OData Actions

You can transfer back-end data between your mobile device and the offline OData provider. You can also modify the back-end data through your application.

4.6.1.6.1.2.8.1 Initialize Offline OData Action

Create an offline OData store on your user's mobile device where back-end OData information from a service can be populated.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the initialize offline OData action:

Initialize Offline OData Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required Service for which the offline store is created

DefiningReq Object Required Read request that targets the OData back end associated with the OData uests provider, and retrieves a subset of the back-end data. If AutomaticallyRetrievesStreams is set to true, all stream files in the query are stored for offline use.

See the following table for the code schema and sample:

Initialize Offline OData Action Code Code Schema Code Sample

{ {

"Service": (String, Required), "Service" : "/AssetWorkManager/ "DefiningRequests": ([{ Services/Amw.service", "Name": (String: Required), "DefiningRequests": [{ "Query": (String: "Name": "WOHeaders", Required), "Query": "MyWorkOrderHeaderCollection", "AutomaticallyRetrievesStreams": "AutomaticallyRetrievesStreams": (Boolean: Optional) false }], Optional), }], "_Type": "_Type": "Action.Type.OfflineOData.Initializ "Action.Type.OfflineOData.Initialize"

e" }

}

4.6.1.6.1.2.8.2 Download Offline OData Action

You can download back-end data from your OData service provider to an offline OData store on the mobile device.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the download offline OData action:

Using SAP Cloud Platform Mobile Service, mobile development kit 158 PUBLIC Business Process Expert Guide Download Offline OData Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required OData service from which back-end data is downloaded to the offline store

DefiningReq Object Required Read request that targets the OData back end associated with the offline uests OData provider, and retrieves a subset of the back-end data. If AutomaticallyRetrievesStreams is set to true, all stream files in the query are stored for offline use.

See the following table for the code schema and sample:

Download Offline OData Action Code Code Schema Code Sample

{ {

"Service": (String, Required), "Service" : "/AssetWorkManager/ "DefiningRequests": ([{ Services/Amw.service", "Name": (String: Required), "DefiningRequests": [{ "Query": (String: "Name": "WOHeaders", Required), "Query": "MyWorkOrderHeaderCollection", "AutomaticallyRetrievesStreams": "AutomaticallyRetrievesStreams": (Boolean: Optional) true }], Optional), }], "_Type": "_Type": "Action.Type.OfflineOData.Download" "Action.Type.OfflineOData.Download"

} }

4.6.1.6.1.2.8.3 Upload Offline OData Action

You can upload data from the offline OData store on the mobile device to the OData service provider.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the upload offline OData action:

Upload Offline OData Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required OData service to which back-end data is uploaded from the offline OData store on the mobile device

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 159 See the following table for the code schema and sample:

Upload Offline OData Action Code Code Schema Code Sample

{ {

"Service": (String, Required), "Service" : "/AssetWorkManager/ "_Type": Services/Amw.service", "Action.Type.OfflineOData.Upload" "_Type":

} "Action.Type.OfflineOData.Upload"

}

4.6.1.6.1.2.8.4 Close Offline OData Action

You can close the offline OData store on the mobile device, and free resources that are being utilized. You can also forcefully abort any ongoing or pending offline OData uploads or downloads, before closing the offline store.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the close offline OData action:

Close Offline OData Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required OData service associated with the data transfer

Force Object Optional If true, the current state of the offline OData store is ignored, and all on­ going or pending upload or download actions are aborted.

See the following table for the code schema and sample:

Close Offline OData Action Code Code Schema Code Sample

{ {

"Service": (String, Required), "Service" : "/AssetWorkManager/ "Force": (Boolean: Optional), Services/Amw.service", "_Type": "Force" : true, "Action.Type.OfflineOData.Close" "_Type":

} "Action.Type.OfflineOData.Close"

}

4.6.1.6.1.2.8.5 Clear Offline OData Action

You can close and delete the offline OData store from the mobile device. You can also forcefully abort any ongoing or pending offline OData uploads or downloads, before removing the offline store.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the clear offline OData action:

Using SAP Cloud Platform Mobile Service, mobile development kit 160 PUBLIC Business Process Expert Guide Clear Offline OData Action Properties Required/ Property Type Optional Description and Permitted Values

Service String Required OData service associated with the offline store

Force Object Optional If true, the current state of the offline OData store is ignored, and all on­ going or pending upload or download actions are aborted.

See the following table for the code schema and sample:

Clear Offline OData Action Code Code Schema Code Sample

{ {

"Service": (String, Required), "Service" : "/AssetWorkManager/ "Force": (Boolean: Optional), Services/Amw.service", "_Type": "Force" : true, "Action.Type.OfflineOData.Clear" "_Type":

"Action.Type.OfflineOData.Clear"

}

4.6.1.6.1.2.9 Media OData Actions

You can create, download or delete media files in your application.

4.6.1.6.1.2.9.1 Create Media Action

Create media files in your application using OData.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the create media action:

Create Media Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

EntitySet String Required Name of the media entity to be created

Service String Required Name of the OData service of the entity to be created

Properties Object Optional Properties of the OData entity

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 161 Required/ Property Type Optional Description and Permitted Values

Headers Object Required Header values for the OData service. It must be in the following format: ● Map{String, Map{String, String} or String} or ● Map{String, String}

For example:

{

'Header1': { 'Parameter1': String, 'Parameter2': String, }, 'Header2': { 'Parameter1': String, 'Parameter2': String, }

}

IsOnlineReq Boolean Optional If true, checks if the mobile device has access to the internet. Default uest value is false app

Media String Required Actual value of the media

Using SAP Cloud Platform Mobile Service, mobile development kit 162 PUBLIC Business Process Expert Guide See the following table for the code schema and sample:

Create Media Action Code Code Schema Code Sample

// Create Media {

{ "_Type": "_Type": "Action.Type.ODataService.CreateMedia", "Action.Type.ODataService.CreateMed "Target" : { ia", "EntitySet" : "BDSDocuments", "Target": { "Service" : "/AssetWorkManager/ "EntitySet": (String, Services/Amw.service" Required), }, "Service": (String, "Properties" : { Required), "ClassName": "#CurrentPage/ }, #Control:ClassName/#Value", "Properties": (Map{String, "ClassType": "#CurrentPage/ String}, Optional), #Control:ClassType/#Value", "Headers": (Map{String, "ObjectKey": "#CurrentPage/ Map{String, String}}, Optional), #Control:ObjectKey/#Value", "IsOnlineRequest": (Boolean, "FileName": "#CurrentPage/ Optional), #Control:FileName/#Value" "Media": (String, Required) },

} "Headers" : { "slug" : { "ClassName": "#CurrentPage/ #Control:ClassName/#Value", "ClassType": "#CurrentPage/ #Control:ClassType/#Value", "ObjectKey": "#CurrentPage/ #Control:ObjectKey/#Value", "FileName": "#CurrentPage/ #Control:FileName/#Value" } }, "IsOnlineRequest": true, "Media":"#CurrentPage/ #Control:Attachment/#Value", "OnSuccess" : "/AssetWorkManager/ Actions/ ODataCreateEntitySuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ ODataCreateEntityFailureMessage.action"

}

4.6.1.6.1.2.9.2 Download Media Action

Download media files to your mobile device through the application.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the download media action:

Download Media Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 163 Required/ Property Type Optional Description and Permitted Values

EntitySet String Required Name of the media entity to be downloaded

Service String Required Name of the OData service of the entity to be downloaded

ReadLink String Required Readlink value of the OData entity

See the following table for the code schema and sample:

Download Media Action Code Code Schema Code Sample

// Download Media {

{ "_Type": "_Type": "Action.Type.ODataService.DownloadMedia", "Action.Type.ODataService.DownloadM "Target" : { edia", "EntitySet" : "Documents", "Target": { "ReadLink": "EntitySet": (String, "Documents(DocumentType='DRW',DocumentNum Required), ber='0000000000000010000000001',DocumentV "ReadLink": (String, ersion='00',DocumentPart='000',ObjectLink required) ='EQUI',CounterKey='0000',ObjectKey='0000 "Service": (String, 00000010000011')", Required), "Service" : "/AssetWorkManager/ }, Services/Amw.service"

} }, "OnSuccess" : "/AssetWorkManager/ Actions/ ODataDownloadMediaSuccessMessage.action", "OnFailure": "/AssetWorkManager/ Actions/ ODataDownloadMediaFailureMessage.action"

}

4.6.1.6.1.2.9.3 Delete Media Action

Delete an existing media file from your device.

In addition to Common Action Properties [page 126], the following table describes metadata properties that are applicable to the delete media action:

Delete Media Action Properties Required/ Property Type Optional Description and Permitted Values

Target Object Required Contains target properties

EntitySet String Required Name of the media entity to be deleted

Service String Required Name of the OData service of the entity to be deleted

ReadLink String Required Readlink value of the OData entity

Using SAP Cloud Platform Mobile Service, mobile development kit 164 PUBLIC Business Process Expert Guide See the following table for the code schema and sample:

Delete Media Action Code Code Schema Code Sample

// Delete Media {

{ "_Type": "_Type": "Action.Type.ODataService.DeleteMedia", "Action.Type.ODataService.DeleteMed "Target" : { ia", "EntitySet" : "BDSDocuments", "Target": { "Service" : "/AssetWorkManager/ "EntitySet": (String, Services/Amw.service", Required), "ReadLink" : "{@odata.readLink}" "Service": (String, }, Required), "OnSuccess" : "/AssetWorkManager/ "ReadLink": (String, Actions/OData/BDSDocument/ Required) ODataDeleteMediaSuccessMessage.action", }, "OnFailure": "/AssetWorkManager/ "KeyProperties": (Array: Actions/OData/BDSDocument/ Optional), ODataDeleteMediaFailureMessage.action"

"Properties": (Map{String, } String}, Optional)

}

4.6.1.7 Working with UI Annotation based Components

As a designer, you can specify a backend service that supports OData annotations, specify a data schema (annotation), and generate pages and controls based on the annotations for your Mobile Development Kit apps.

Context

OData supports annotations in the metadata that can provide UI guidance for rendering or editing the data on the Mobile Development Kit client.

This metadata is different from the Mobile Development Kit metadata defined in the editor. Your apps use this metadata provided from offline OData services to the Mobile Development Kit client.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 165 Creating a new service

After an annotation is configured in the mobile service cockpit (see https://help.sap.com/viewer/ 38dbd9fbb49240f3b4d954e92335e670/Cloud/en-US/152582ccad2a49b5aed4d65fff29d5e2.html), create a service with the URL in the Mobile Development Kit editor.

Procedure

In the editor workspace, open the Service Creation Page, and fill in the name, service URL, app ID and other details.

If a service has already been created, refresh it for the latest sync, by clicking the Refresh button in the service editor.

Creating Component from Annotation

After you have created a service, create a component from the OData annotation in the Mobile Development Kit editor.

Procedure

1. In the editor workspace, right click the project context menu, and select New MDK Annotation Component. 2. In the Annotation Selection screen, select the relevant service and entities, and click Next. 3. In the Template Customization screen, modify the properties to customize your files, folders, query options, etc. and click Next. 4. Click Finish.

The Mobile Development Kit metadata for the component is created.

You can customize the metadata anytime by opening the desired file in the editor. You can also change the settings in the Application.app file.

4.6.2 Metadata Validation

The metadata validation feature in Mobile Development Kit identifies and highlights errors in the code.

When you edit code in a metadata file in the editor, the code is validated on the go and a live hint notifies you of any deviation from the schema definition.

Also, when a Mobile Development Kit project file (.ZIP) is imported into the editor, metadata validation over the entire project is triggered, and the SAP Web IDE Full-Stack Problems view appears if any errors are found.

Using SAP Cloud Platform Mobile Service, mobile development kit 166 PUBLIC Business Process Expert Guide Additionally, you can right-click on the application folder, or any of the sub-folders (Actions, Globals, Services or Pages) and select Metadata Validate to manually run metadata validation over the specific folder.

 Note

For this feature to work, the following prerequisites must be met:

● Mobile Development Kit is enabled under Project Type in Project Settings ● Application.app file is present in the application folder

The following table describes validation errors that may appear in the SAP Web IDE Full-Stack Problems view:

Metadata Validation Errors

Error Type Reason

Syntax Error Invalid JSON string in the code

Schema Error Incorrect metadata definition

File Reference Error Incorrect file name or invalid file path

OData Reference Error Incorrect OData value or invalid OData service

Target Reference Error Incorrect Control, Page or OData target

4.6.3 Migrating App Metadata

You can view changes, and selectively update your app metadata to the latest version available on the cloud.

Context

Since Mobile Development Kit features a cloud-based editor, users who consume the latest metadata that is imported from the cloud may face issues on their devices. A metadata migration report allows users to view changes in the metadata, before they choose to update their application. Thus, users can proactively inform the editor or client teams if issues are found.

The following files types are applicable for metadata migration:

● Actions ● Globals ● Services ● Pages ● Application

 Note

It is recommended to perform metadata validation before migration to avoid failures due to errors in the code.

Using SAP Cloud Platform Mobile Service, mobile development kit Business Process Expert Guide PUBLIC 167 Procedure

1. Right-click on your MDK application folder under Workspace and select Metadata Migrate. This option is available for Actions, Globals, Services and Pages sub-folders as well. A migration report appears that lists all files that are updated in the cloud and can be migrated. You can choose a file category (All by default) or provide a specific string to filter the list. 2. Select any file from the list to open two editor views that compare the current version of the file's metadata with the cloud version. Here, you can verify the metadata changes. Only object property or value changes are highlighted as differences and formatting changes are ignored. 3. Enable the check box next to the file and select Confirm to migrate the file. The file is updated to the cloud version, and it is no longer available in the list of files pending for migration.

Using SAP Cloud Platform Mobile Service, mobile development kit 168 PUBLIC Business Process Expert Guide 5 Developer Guide

The following tasks are typically completed by a developer.

Customizing Advanced Rules [page 169] Rules are JavaScript modules that can be used to add application functionality to the Mobile Development Kit client API.

Creating Extension Controls with Nativescript [page 173] To extend the functionality of your app, you can create extension controls other than the already existing MDK built-in controls.

Creating Custom Extension Controls in Swift [page 174] You can use Swift to easily create customized extension controls other than the already existing MDK built-in controls to extend the functonality of your app.

5.1 Customizing Advanced Rules

Rules are JavaScript modules that can be used to add application functionality to the Mobile Development Kit client API.

You have the ability to customize the rules you use in your app so that you can change the behaviour of the app itself.

Client API objects

is the base interface used by developers to pass objects to rule functions. The exported rule function will be given a object as an argument to provide access to a context. Through this object, the rule function can query application state and data. The object implements the interface or one of its sub-interface types depending on the context of the rule. An example where the rule is used in the context of a page will receive an instance as its object.

 Note

is an interface that will be passed as an argument to a rule when that rule is bound to a page. is an interface that will be passed as an argument to a rule when that rule is bound to a control.

The table below identifies the objects used in rule functions in the MDK client API.

Using SAP Cloud Platform Mobile Service, mobile development kit Developer Guide PUBLIC 169 Term Description

The base interface for all objects passed to rule functions

The interface of the object passed to a rule function when the rule is run in the context of a control

The interface of the object passed to a rule function when the rule is run in the context of a control container

The interface of the object passed to a rule function when the rule is run in the context of a form cell

It also provides access to the interface.

The interface of the object returned to a rule function when the rule executes the IFormCellProxy::getTargetSpecifier() method

The interface for support object cell used in a form cell list- picker

The interface of the object passed to a rule function when the rule is run in the context of a page

The interface of the object passed to a rule function when the rule is run in the context of a sectioned table

The interface of the object passed to a rule function when the rule is run in the context of a section

The interface of the object returned to a rule function when the rule executes the IClientAPI::createLinkSpecifierProxy() method

The interface of the object returned to a rule function when the rule executes the IClientAPI::getLogger() method

The interface of the object passed to a rule function when the rule is run in the context of a toolbar

The interface of the object passed to a rule function when the rule is run in the context of an action

Rule examples

The following are examples of the objects being used in a rule:

● Using the IControlProxy.getValue() interface in a Control.Type.FormCell.SegmentedControl control

// Control definition

{ "Caption": "Priorities", "OnValueChange": "/AssetWorkManager/Rules/SegmentControlChange.js", "Segments": [ "Low", "Medium", "High"

Using SAP Cloud Platform Mobile Service, mobile development kit 170 PUBLIC Developer Guide ], "Value": "Low", "_Name": "SegmentedFormCell", "_Type": "Control.Type.FormCell.SegmentedControl" } // Whenever a new selection is made // "/AssetWorkManager/Rules/FormCell/SegmentControlChange.js" is called: // SegmentControlChange.js export default function FormCellSegmentedChangeHandler(controlClientAPI) { let selections = ""; // getValue returns an array of Objects in the form: // [{SelectedIndex:value, ReturnValue:value}, ...] controlProxy.getValue().forEach((selectedItem) => { selections += selectedItem.ReturnValue + '\n'; }) console.log(selections); // Log all selections to the control alert(controlClientAPI.getValue()[0].ReturnValue); // Alert with the first selection

}

● Changing programmatically using the IFormCellProxy.setTargetSpecifier() interface

// Control definition

{ "Caption": "high via rule", "Segments": [ "Low", "Medium", "High" ], "Value": "Low", "OnValueChange": "/AssetWorkManager/Rules/FormCell/ UpdateListPickerItems.js", "_Name": "SegmentedFormCell", "_Type": "Control.Type.FormCell.SegmentedControl" } // Whenever the a new segmented button is selected // "/AssetWorkManager/Rules/FormCell/UpdateListPickerItems.js" is called export default function UpdateListPickerItems(controlProxy) { // selection is the selected SegmentedControl value let selection = controlProxy.getValue()[0].ReturnValue; let containerProxy = controlProxy.getPageProxy().getControl('FormCellContainer'); if (containerProxy.isContainer()) { // get a proxy to the Control.Type.FormCell.ListPicker instance let listPickerProxy = containerProxy.getControl('ListPickerFormCellSingle'); let specifier = listPickerProxy.getTargetSpecifier(); specifier.setDisplayValue("{OrderDescription}"); specifier.setEntitySet("MyWorkOrderHeaders"); specifier.setReturnValue("{OrderId}"); specifier.setService("/AssetWorkManager/Services/Amw.service"); // set the query options for the list picker based on SegmentedControl Value switch (selection) { case 'Low': specifier.setQueryOptions("$top=5"); break; case 'Medium': specifier.setQueryOptions("$top=10"); break; case 'High': specifier.setQueryOptions("$top=15"); break; } }

Using SAP Cloud Platform Mobile Service, mobile development kit Developer Guide PUBLIC 171 listPickerProxy.setTargetSpecifier(specifier);

}

● Using logging interfaces in a rule

// Initialize logger by rule

// Ideally used when the application starts export default function InitializeLoggerRule(clientAPI) { const logFileName = 'LogFile.txt'; const maxFileSizeInMegaBytes = 8; // If the logger has already been initialized, it has no effect. // FileName and fileSize are optional values, if not specified, default values will be used. clientAPI.initializeLogger(logFileName, maxFileSizeInMegaBytes); // You can even initialize logger state and level let logger = clientAPI.getLogger(); logger.on(); logger.setLevel('Info'); } // Or you can even use this // Initialize logger by rule which calls an action export default function InitializeLoggerWithCallingAnAction(clientAPI) { return clientAPI.executeAction('/AssetWorkManager/Actions/Logger/ SetState.action'); } // Use the logger by rule (it should have been already initialized) // Available functionality: // Log a message, Edit log level, Edit state (turn on/off), Get current logger state, // Get current root log level, Upload log file export default function UseLoggerRule(clientAPI) {

// Get logger instance let logger = clientAPI.getLogger(); // Returns a boolean according to current logger state (on=true, off=false) logger.isTurnedOn(); // Turns off the logger logger.off(); // Turns on the logger logger.on(); // Toggles the logger state (on/off) logger.toggle(); // Returns the current logger root level. Possible values: Debug, Info, Warn, Error, Off logger.getLevel(); // Sets the logger root log level. Possible values: Debug, Info, Warn, Error, Off logger.setLevel('Info'); // Logs a message with the specified log level. // If log level is not specified, the root log level will be used. const optionalLogMessageLogLevel = 'Debug'; logger.log('This is a test message', optionalLogMessageLogLevel); //Log uploading works only after successful authentication // Upload the log file according to client settings clientAPI.executeAction('/AssetWorkManager/Actions/Logger/Upload.action'); // Upload log file according to own settings logger.uploadLogFile(backendURL, applicationID);

}

● Setting links in a rule using the ClientAPI.createLinkSpecifierProxy() interface

// Definition

{ "_Type": "Action.Type.ODataService.UpdateEntity", "Target": { "EntitySet": "MyWorkOrderHeaders", "Service": "/AssetWorkManager/Services/Amw.service",

Using SAP Cloud Platform Mobile Service, mobile development kit 172 PUBLIC Developer Guide "ReadLink": "{@odata.readLink}" }, "Properties": { "OrderDescription": "#Control:OrderDescription/#Value", }, "UpdateLinks": "/AssetWorkManager/Rules/OData/UpdateLinkRule.js" } export default function UpdateLinkRule(ClientAPI) { let containerProxy = ClientAPI.getControl('PageOneFormCell'); let listPickerProxy = containerProxy.getControl('EquipmentList'); let queryOption = ''; // odata action expects link array let links = []; if (listPickerProxy.getValue().length > 0) { let selectedValue = listPickerProxy.getValue()[0].ReturnValue; queryOption = `$filter=EquipId eq '${selectedValue}'` let link = ClientAPI.createLinkSpecifierProxy('EquipmentHeader', 'MyEquipments', queryOption, ''); links.push(link.getSpecifier()); } return links; }

5.2 Creating Extension Controls with Nativescript

To extend the functionality of your app, you can create extension controls other than the already existing MDK built-in controls.

Context

Create an extension control that does not exist in the editor using JSON, in order to extend the functionality of the app.

Procedure

1. Define the extension control in the metadata.

A JavaScript name and class name are required that conform to iControl so that iControl can render your extension control successfully. It should look like this:

{

"Controls": [{ "Module": "MyModules/testExample/CustomUIModule", "Class": "CustomUIClass", "_Name": "Extension", "_Type": "Control.Type.Extension" }],

}

2. Place the file in app/extensions/MyModules/testExample/CustomUIModule.ts.

Using SAP Cloud Platform Mobile Service, mobile development kit Developer Guide PUBLIC 173 3. Rebuild the Mobile Development Kit client using the following command to include the entension control:

tns run ios

5.3 Creating Custom Extension Controls in Swift

You can use Swift to easily create customized extension controls other than the already existing MDK built-in controls to extend the functonality of your app.

Prerequisites

● You must have built your MDK client SDK. For details see, Building your MDK Client SDK [page 14]. ● You must have built an extension sample app by running the create-extension-sample.command script contained in the ExtensionSample/ folder in the SDK directory.

Context

Create a custom extension control by implementing the MDKExtension protocol in Swift, which allows you to make calls to an app.

Procedure

1. In Swift, define a UIViewController that implements an MDKExtension protocol.

It should look like this:

public protocol MDKExtension {

var delegate: SwiftExtensionDelegate? { get set } func update(with params: NSDictionary) func controlValueChanged(with binding: NSDictionary)

}

○ The delegate property allows the control to make calls to the app and is set automatically. ○ The update function can be used in the ExtensionProperties dictionary, which is defined in the control's metadata, or can be called via a rule, allowing custom data to be passed to the control at any time. ○ The controlValueChanged function is called when the binding associated with the control is initialized, updated or changed. 2. Implement a SwiftExtensionDelegate function, which is used by the MDKExtension protocol to make calls to the metadata app.

Using SAP Cloud Platform Mobile Service, mobile development kit 174 PUBLIC Developer Guide It should look like this:

public protocol SwiftExtensionDelegate: NSObjectProtocol {

func setControlValue(value: NSString) func executeActionOrRule(definitionPath: NSString, callback: @escaping (String) -> Void) func resolveValue(value: NSString, callback: @escaping (String) -> Void)

}

○ The setControlValue function allows the control's value to be set. This makes the value accessible through the metadata, for example using a target path such as #Control:ExtensionControlName/ #Value. ○ The executeActionOrRule function invokes an action or a rule from the app. The definitionPath parameter should use the same format as in the editor. For example, if you pass a value of /AppName/Actions/ShowMessage.action, the callback is invoked with the result when the action or rule is completed. ○ The resolveValue function can be used to resolve values such as target paths or globals.

Next Steps

After creating a custom control, define its properties using the MDK editor.

For Formcell extension control properties, see Extension [page 54].

For Section page extension control properties, see Extension Section [page 79].

Using SAP Cloud Platform Mobile Service, mobile development kit Developer Guide PUBLIC 175 6 MDK Extension for Visual Studio Code

Mobile Development Kit extension for Microsoft Visual Studio Code (VS Code) helps you to quickly and efficiently develop or modify MDK apps throughout their life cycles. It is supported on Mac systems.

The extension is based on the VS Code extension framework and consumes many core services that are supported by VS Code, such as workspace, language protocol, task, and so on. It also introduces a new language, and a new debugging process.

The extension lets you import an existing app repository from SAP Web IDE Full-Stack, and develop, edit, and debug the app, before synchronizing your changes back to the MDK editor.

Edit MDK Metadata JSON

Based on a comprehensive MDK schema definition, this feature detects an application node within the workspace, and supports operations like auto-completion, validation, and navigation.

Code MDK Rule JavaScript

Based on a predefined IClientAPI typing definition; this feature lets you use JSDoc snippets to describe rule arguments. It also supports operations like auto-completion, validation, and navigation for the IClientAPI.

Bundle MDK Application

This feature integrates MDK metadata bundling process into the VS Code build task, from which you can generate VS Code specific bundle.js with the source map information.

Debug MDK rule JavaScript

Redirect the codeline from the bundle.js to the corresponding rule.js with source map, and set breakpoints directly in the rule.js files.

Create an MDK metadata object

Create an MDK metadata object by using the command palette, or by using the context menu.

Using SAP Cloud Platform Mobile Service, mobile development kit 176 PUBLIC MDK Extension for Visual Studio Code 6.1 Installing MDK Extension for Visual Studio Code

Install the MDK extension for Visual Studio Code (VS Code) to load VSCode with the MDK metadata, and to start developing or modifying your apps quickly and efficiently.

Prerequisites

To develop or modify an app, you must have the following:

● Mac environment ● VS Code version higher than 1.24.0

To debug an app, you must have the following:

● XCode, which finds the corresponding iOS simulator ● , which finds the corresponding Android emulator ● NativeScript CLI, installed using the npm install -g nativescript command This is required to trigger the tns command to launch an MDK app. ● The tns project for the MDK-branded client, which hosts the MDK app and supports the tns launch

Procedure

1. Install the MDK extension directly from the Microsoft VS Code marketplace. You can also download and install the latest version of vsix package folder (vsc-extension-mdk) from the SAP Marketplace .

This folder contains all the files necessary for your extension. 2. Launch VS Code.

3. If you have downloaded the package from the SAP Marketplace, select Extensions Install from VSIX .

The installation might take as long as to two minutes. 4. Reload VS Code to enable the extension. A new language mode called MDK is attached to any open MDK metadata file.

6.2 Editing Metadata with MDK Language for VS Code

The MDK language introduced for VS Code lets you edit and validate MDK metadata using features like auto- completion, validation, navigation, and so on.

Files with the following extension are supported: .action, .app, .global, .page, .js, .service, .properties, .cim, .css and .nss.

Using SAP Cloud Platform Mobile Service, mobile development kit MDK Extension for Visual Studio Code PUBLIC 177 The MDK language for VS Code offers the following features:

Auto-completion

● Shows property suggestions while you are typing, if you move the cursor to a blank place inside an object and insert the trigger character ". ● Automatically shows the list of available values when you choose the property _Type from the property suggestion list. You can also insert and " after the property _Type to trigger the listing of the available values. ● Shows different property suggestions based on the value of the property _Type. ● Shows all the localization keys specified by the property Localization in the Application.app file when you place the cursor inside a string value of a property in a metadata file and insert $. Also shows the signatures of the eight types of i18n indicators in the completion list. ● Displays a list of available values for a file reference if you insert the character ' in .js files and the character ", ' or / in a file reference, for example," /{ApplicationName}/{TypeFolder}". When you select a file name, the complete path name is shown beside it. ● Provides a list of ClientAPI methods in rule JavaScript files. ● Shows a list of platforms where a value is used when you choose a value (which is platform-aware) from the completion list.

Validation

● If a required property for an object is missing, the PROBLEMS view shows warning messages. These messages also appear in the editor when you hover over the green tilde under the starting brace of the object. ● If the value of the property _Type for an MDK object is incorrect, the PROBLEMS view shows warning messages. These messages also appear in the editor when you hover over the green tilde under the incorrect value. ● If a property type is incorrect, for example, if a number value has been assigned to a property of the string type, the PROBLEMS view shows warning messages. These messages also appear in the editor when you hover over the green tilde under the incorrect value. ● If there is an error in the JSON format, for example, a missing double quote, colon or brace, the PROBLEMS view shows warning messages. These messages also appear in the editor when you hover over the red tilde after the missing character. ● The MDK language validates the schema of a file specified by a file reference If the schema validation fails, an error message appears in the PROBLEMS view. If the schema validation is successful, the MDK extension checks whether the specified file exists. If it does not, an error message appears in the PROBLEMS view. ● If a value is platform-aware, e.g. the value FixedSpace of SystemItem for an ActionBar, the PROBLEMS view shows warning messages. These messages also appears as tooltips in the editor when you hover over the green tilde present right after the platform-aware value.

Using SAP Cloud Platform Mobile Service, mobile development kit 178 PUBLIC MDK Extension for Visual Studio Code Navigation

The MDK extension provides a convenient method for file navigation.

Place the cursor within the value of a file reference and select Go to Definition from the context menu, to open the file specified by the file reference.

Select Peek Definition from the context menu to see the content of the file specified by the file reference in the editor.

File Creation

The MDK extension lets you create new files easily, even after you have created file references.

If a file specified by a file reference does not exist, you see a light-bulb icon at the beginning of the line when you place the cursor within the value of the file reference. Click the icon and follow the instructions to create a file (for example, .action, .global, .page, .js, .service, .properties, .cim, .css, or .nss).

There are various code actions that you can perform on the rule, global, or localization file.

Extracting the selected string value to a rule file

1. When you place the cursor within a string value in a json file, a light bulb icon appears at the beginning of the line. 2. Click the icon to display a context menu containing the menu item MDK: Extract to Rule. 3. Click the menu item and follow the instructions to create a rule file and open it. ○ If the value is text only, the return value of the generated rule file is the same as the value of the string in which you placed your cursor before the extraction. ○ If the value is in i18n expression format, such as $(L, xxx), the return value is the corresponding i18n related clientAPI method, such as localizeText('xxx'). 4. When you return to the previous json file, the string value is replaced with a file reference pointing to the generated rule file.

This action is valid if the following conditons are met:

● If the selected string is of a pure text value (text that does not begin with '/', '$', '#', '{' and 'res://') or if the text is in i18n expression format ● If the files are .json files with the following extensions: action, global, page, service, app, etc. ● If there is no diagnostic error for the selected string value ● If the selected string value is a file reference of a rule according to its schema definition

Extracting the selected string value to a global file

This action is similar to that for the rule file except that it does not support extracting the text in the i18n expression format.

Extracting the selected string value to the default i18n file

This action is applicable only to text values and extracts the selected value to a new property value (not a new file) in the default i18n file, which is specified in the Localization property of the Application.app file.

Using SAP Cloud Platform Mobile Service, mobile development kit MDK Extension for Visual Studio Code PUBLIC 179  Note

When you specify the Debug App Root in the user settings, the corresponding client app version is fetched, and used to map to the corresponding MDK schema version for the language features.

For example, if you are using MDK version 2.1 or 3.0, and have not specified the user settings, the 3.0 client app version is fetched by default. If you are still using MDK SDK 2.1.xxx, you must specify this user setting to get the 2.1 metadata accordingly.

6.3 Bundling MDK App with VS Code Build Task

After you have created, edited, or validated your MDK app, you must bundle the app metadata and JavaScript files for the metadata to be interpreted correctly by the MDK client app at runtime.

Prerequisites

Use the MDK extension for VS Code to modify and validate your app after importing it from the MDK editor on SAP Web IDE Full-Stack.

Procedure

1. Launch VS Code and open an MDK application folder or a Git repository folder containing multiple MDK applications. 2. Based on the validation status of your app metadata, perform one of the following:

○ If your MDK metadata files (JSON metadata or JavaScript rule) do not contain any validation errors, trigger the auto-bundle process by selecting File Save . The MDK app hosting the edited file is bundled automatically. You can see the progress of the bundling task in the TERMINAL view. If your file contains errors, the auto-bundle task is not triggered, even if you save the file.

 Note

By default, auto-bundling is enabled when you save an error-free file. You can turn it off by selecting Code Preferences Settings and marking "mdk.autoBundle": false in the User Settings window.

○ You can manually trigger the bundling process at any time on any MDK file. 1. Select Terminal Run Build Task... or Run Task... The bundle tasks for all the apps available in the workspace are listed. The tasks related to MDK are shown in the format MDK: bundle build. 2. To begin the bundling process, select the task name that matches your application name and path.

Using SAP Cloud Platform Mobile Service, mobile development kit 180 PUBLIC MDK Extension for Visual Studio Code Triggering the bundle process enables validation of the MDK app by default. If there are errors during the validation, you can see them in the TERMINAL or PROBLEMS view.

You can turn this default metadata validation behavior off by selecting Code Preferences Settings and marking "mdk.validateBeforeBundle": false in the User Settings window.

By default, the bundling process does not stop even if there are errors found during the metadata validation.

You can change this behavior by selecting Code Preferences Settings and marking "mdk.stopBundleOnValidationError": true in the User Settings window.

Results

The bundled files include bundle.js and bundle.js.map, and are generated in the MDKBundleTarget subfolder under the system temporary folder. The debugger later uses these files to map between the root file and the bundle.js file.

Your app is now ready to be debugged.

Additonally, these two files are also generated in the appRoot folder, which causes the running debugged client app in the watch mode to be relaunched automatically once the bundling is completed. In the watch mode, the debug can be run via the following options:

● Start Without Debug ● Launch on iOS/Android

However, if you select the Debug Attach on iOS/Android option, which is not run in the watch mode, the app is not relaunched automatically.

Related Information

Debugging MDK App with VS Code Debugger [page 182]

Using SAP Cloud Platform Mobile Service, mobile development kit MDK Extension for Visual Studio Code PUBLIC 181 6.4 Debugging MDK App with VS Code Debugger

You can use the debugging feature provided with the MDK extension for VS Code to debug your modified MDK app after you have bundled it. You can set breakpoints, inspect scope variables, watch expressions, or execute code for JavaScript in the MDK rule files directly.

Prerequisites

Complete the following for your MDK app using the MDK extension for VS Code:

● Bundle your MDK app developed with the MDK editor or the MDK extension for Visual Studio Code. ● Add your own debug configuration or alter the existing one by modifying the launch.json file. To generate the default launch configuration file (launch.json), click the gear icon in the Debug view, and choose the MDK debug configuration. ● Specify the attribute appRoot in the user setting file. This is the default appRoot applied for all the MDK launch configurations. If you want to override the default user setting value for any debug launch configuration, specify the attribute appRoot in the launch configuration. This overrides the value specified in the user setting file.

Procedure

1. To debug your app, select Debug Start Debugging .

Choose MDK if no MDK launch configuration is available yet.

View the progress of the debugging process in the DEBUG CONSOLE view.

You can run your program without debugging it by selecting Start Without Debugging.

If only a single MDK app is present, and has been successfully bundled, the debugger triggers a NativeScript CLI command (tns), which builds, deploys, and runs your app in an iOS or Android simulator and attaches the VS Code debugger to it.

If multiple MDK apps are present, the debugger displays a list of all the bundled apps. Choose the one you desire to run or debug. 2. In the watch mode, the running debugged client app is relaunched automatically once the bundling is completed.

You can turn this behavior off by selecting Code Preferences Settings and marking "mdk.bundleToAppRoot": false in the User Settings window. 3. To set a breakpoint, click n the left margin of the editor.

You can enable, disable, or reapply a breakpoint from the BREAKPOINTS section of the DEBUG view. 4. To stop the debugger execution, click the Disconnect or Stop button in the floating bar.

Using SAP Cloud Platform Mobile Service, mobile development kit 182 PUBLIC MDK Extension for Visual Studio Code Related Information

Bundling MDK App with VS Code Build Task [page 180] Restrictions and Troubleshooting [page 184]

6.5 Creating MDK metadata object with VS Code editor

The MDK extension for VS Code allows you to create new MDK metadata objects (page, action, service, rule, new global variable, style, or i18n) by using the command palette or the context menu on the VS Code editor.

Creating a new MDK metadata object using the Command Palette

Procedure

1. In the VS Code editor workspace, open an MDK application folder.

2. To open the command palette, click View Command Palette . 3. Type MDK in the command palette dialog box to display all the MDK metadata objects in the format MDK: New . 4. Select the metadata object type you desire to create.

If multiple MDK apps are present in the selected folder, you will be prompted to choose the app in which you want to create the new metadata object file.

If multiple sub-folders are present under the selected folder, you will be prompted to choose the sub-folder in which you desire to place the new file. 5. Click Enter. You can cancel the operation at any step by clicking Cancel.

Results

The newly created file is automatically opened in the editor.

Using SAP Cloud Platform Mobile Service, mobile development kit MDK Extension for Visual Studio Code PUBLIC 183 Creating a new MDK metadata object using the context menu

Procedure

1. In the VS Code editor workspace, right-click the desired file or folder to open the context menu. 2. From the context menu, click MDK: New

Results

The newly created file is automatically placed in the selected folder.

Creating a CIM file using the context menu

Procedure

1. In the VS Code editor workspace, right-click the Application.app file to open the context menu. 2. From the context menu, click MDK: New CIM 3. Choose another MDK application within the existing workspace to do the component integration. 4. To edit the CIM file, you must have one or more integration point entries. In the integration point properties Source and Target, replace the target file reference content with source file reference content in bundle time.

6.6 Restrictions and Troubleshooting

Know about the restrictions of working with the MDK extension for VS Code and how to troubleshoot common issues.

Restrictions

● You cannot create MDK projects with this extension. You must import an already existing app from your git repository or from the MDK editor on SAP Web IDE Full-Stack. ● You can debug your app only in the live mode, and not in the demo mode. If you are already in the demo mode, exit it and enter the live mode again. ● While debugging, avoid updating the local bundle file of your app with the remote bundle file from SAP Cloud Platform mobile services, to prevent the local bundle file from being disabled.

Using SAP Cloud Platform Mobile Service, mobile development kit 184 PUBLIC MDK Extension for Visual Studio Code If you have already updated this file, reset or reinstall your app on the iOS or Android simulator and follow the onboarding process again. ● If you are using VS Code version 1.0, avoid launching more than one VS Code instance while debugging. ● When you open and activate a rule JavaScript file, the two following files are automatically generated in the root folder: ○ { MDK application root }/jsconfig.json ○ { MDK application root }/.typings/IClientAPI.d.ts Since these files are generated to support the ClientAPI auto-completion method, you do not need to merge them into the git repository.

Troubleshooting Known Issues in VS Code

● If your MDK client app is running the NativeScript CLI version 3.4.4, you cannot use the MDK extension for VS Code to debug your rule files. The debugger fails to use the launch configuration, and you cannot set breakpoints. Workaround 1. Launch your MDK app without debugging: Click Debug Start Without Debugging . Choose MDK if no MDK launch configuration is available yet. 2. In the Debug view, click Attach on iOS. 3. Modify the value of appRoot to the NativeScript project path that corresponds to your branded MDK client app. 4. Start the debugger with the newly attached configuration. As an altereneative workaround, upgrade the tns command line to a version higher tha 4.1.0, (example 4.2.2).

Using SAP Cloud Platform Mobile Service, mobile development kit MDK Extension for Visual Studio Code PUBLIC 185 7 Mobile Backend Generator

The Mobile Backend Generator is a set of tools included with SAP Web IDE Full-Stack that interacts with a service in the SAP Cloud Platform Mobile Services.

Together, they enable a developer to model an OData service, and generate a EE web application that implements the necessary database tables and an implementation of an OData service. You can then deploy the generated Java application to the SAP Cloud Platform which will acts as a host for the OData service.

Introduction

A developer defines the model by providing an OData CSDL(Common Schema Definition Language) XML file (for Version 2.0 or 4.0 of the OData specification). A CSDL graphical modeling tool is also available within the SAP Web IDE Full-Stack as a preview feature to help create a model or modify an existing one.

To store OData entity sets, the generated OData service uses a database. Use an in-memory database (suitable for testing only) or a SQL database that's available in SAP Cloud Platform (PostgreSQL, SAP HANA, or SAP ASE).

Except for the in-memory database, installing, creating, and configuring SQL databases and schemas is outside the scope of these instructions. See the SAP Cloud Platform Cockpit documentation set.

The generated OData service from the Mobile Backend Generator autogenerates the tables and other SQL artifacts within your selected target database or schema.

SAP Web IDE Full-Stack Configuration

In the SAP Web IDE Full-Stack Preferences, go to the Features section and make sure the Mobile Development Kit Editor version Master is enabled.

Specify your Cloud Foundry account in the Cloud Foundry section.

7.1 Generating an OData Service

Create a OData service using the Mobile Backend Generator.

1. In SAP Web IDE Full-Stack, select New Project from Template from the context menu of the Workspace folder. Choose Mobile OData Service Project. Select Next. 2. Specify a project name and select Next. 3. Enter the following fields:

Using SAP Cloud Platform Mobile Service, mobile development kit 186 PUBLIC Mobile Backend Generator Field Name Field Description

Service App Name The service to be deployed.

Service App Version A version to your service which must include .., for example 1.0.0.

Target Database An in-memory database (IMDB) is for demos and testing purposes. It embeds an in-memory database to the gener­ ated service and doesn't require a database instance in the target cloud platform.

SQL Database binding Create tables in a database from your targetSAP Cloud Platform. Please see the SAP Cloud Platform Cockpit doc­ umentation on how to create a database instance.

Type: For Neo deployment, the choices are SAP ASE and SAPA HANA. For Cloud Foundry, the choices are PostgreSQL and SAP HANA.

Name: The existing database instance name.

Deployment Target Specify whether you are deploying your service to Neo or Cloud Foundry.

Authentication Method Choose from BASIC for Neo, XSUAA for Cloud Foundry, or NONE. None means that your service will have anony­ mous access. See Authentication and Authorization [page 197].

Select Finish to close the wizard.

4. Add a model to your project. You create a new CSDL file for your project or import an existing one. To create a CSDL file, select New OData CSDL Document from the context menu of your project folder. Fill in the appropriate information and select Create. To import an existing model, select Import File or Project from the context menu of your project folder, and navigate to the saved file. Select OK to import the file. The file extension of the file you import must be csdl..

 Note

If you look at the top icon in the lower-right corner of this screen, you see the SAP Web IDE Full-Stack console. We suggest that you watch here for error or warning messages.

5. To generate the OData service, select Generate Mobile OData Service from the context menu of the csdl.xml. When the generation process finishes, you see new files and folders in the service (target) folder. To build the service, select Build from the context menu of the srv (short for service) folder. This build process generates a Java project that is returned to the target folder in SAP Web IDE Full-Stack. The project is an OData service that implements the model that's defined by the csdl.xml file and all the CRUD (create/read/update/delete) operations. It doesn't include any business logic. The Java code includes extension points where you can add or change default behavior. Please see Customizing the Generated Service [page 188] for more details. 6. To generate the WAR file (a standard java server deployment archive format), select Build from the context menu of the srv folder. This process compiles the Java code and packages the compiled classes from the previous step into a WAR file which is in the target folder of your service.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 187 The generated service automatically creates SQL database tables (except when the in-memory database option is selected) on the first execution of the service, the application version is used to create a table name suffix as follows:

● If the major version number is zero, the default name suffix is "_MAJOR_MINOR_PATCH", for example "_0_1_2". ● If the major version number is greater than zero, the default name suffix is "_MAJOR_MINOR", for example "_1_2".

The net effect of these default values is that if the OData CSDL schema has changed in any way that requires new or changed SQL table definitions, you must change the major or minor version number. The exception is pre-1.0.0 versions, in which case any version change results in new tables. Any existing database tables from previous application versions remain in the SQL database, and you must use external SQL tools to delete old tables or to migrate existing data from the old tables to the new tables.

The generated OData service can be enabled for tracking changes. This means upon an initial request of data by a client, a client can request for incremental changes to the data since the last request of data. Basically always getting a delta from the last request. The graphic editor has a switch to toggle this for the entire service. For more details, see Enabling OData Change Tracking in the Appendix [page 205].

 Caution

The initial generated WAR file isn't security enabled. See Securing the Generated Service [page 197] for information about enabling security before initial deployment.

7.1.1 Customizing the Generated Service

You can customize the generated service to include business logic.

Depending on the options you selected in the SAP Web IDE Full-Stack wizard, generated files may include the following files which can be customized. Regeneration will result in necessary changes being automatically merged into these files.

● pom.xml (Maven Project Object Model) – you may need to edit this file if your customized Java code uses third-party libraries that are listed as Maven dependencies . ● manifest.yml (Cloud Foundry deployment manifest). ● mta.yaml (multi-target application descriptor). ● resources.xml (Tom EE JDBC resource configuration).

Generated Java source files include the following classes that can be customized. Regeneration will result in no changes to these files.

● Log settings class ● Metric settings class ● Provider settings class ● Listener classes (in the listener subfolder) for customization of OData CRUD operations . ● Handler classes (in the handler subfolder) for implementation of OData CRUD operations and actions and functions .

Generated Java source files include the following classes that you should not be customize.

Using SAP Cloud Platform Mobile Service, mobile development kit 188 PUBLIC Mobile Backend Generator ● ● Metric servlet class (an embedded OData service that provides administrators with usage metrics for the main service).Main servlet class (main server entry point for dispatching client's OData requests). ● OData proxy classes (in the proxy subfolder). These classes may be used by customization logic that needs to access the database.

After you've made any customization changes, rebuild the WAR file by selecting Build from the context menu of the srv folder.

Loading Initial Data

Provisioning initial data for entity sets is optional.

Main servlet class (main server entry point for dispatching client's ODataWhen you create a database table, initial data is automatically loaded from the web application archive (WAR file) and inserted into the database.

In the generated Maven project (in source code), the resource subfolder for initial data is src/main/ resources/initial-data. For a compiled Java servlet-based application, the resource subfolder for initial data is WEB-INF/classes/initial-data.

Each initial data file uses the name "EntitySetName.json". For example, create the initial data for a OrderSet entity in the subfolder of src/main/resources/initial-data and call the file OrderSet.json. Once the project is compiled and is packaged into a Java EE WAR file using Maven, that file is located in WEB-INF/ classes/initial-data/OrderSet.json within the WAR file.

[

{ "OperationID" : 1, "ServiceOrderID" : 1, "critical" : true, "description" : "Clean exterior filter" }, { "OperationID" : 2, "ServiceOrderID" : 1, "critical" : true, "description" : "Check freon pressure" }, { "OperationID" : 3, "ServiceOrderID" : 2, "critical" : false, "description" : "Tighten fan belt" }, { "OperationID" : 4, "ServiceOrderID" : 3, "critical" : false, "description" : "Use blower to clean ducts" }, { "OperationID" : 5, "ServiceOrderID" : 3, "critical" : false, "description" : "Clean exterior grills" } ]

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 189 Loading Test Data

Provisioning test data for entity sets is optional.

When you create a database table, test data is automatically loaded from the web application archive (WAR file) and inserted into the database, as long as the TEST_MODE constant in the generated TestSettings.java file is true. By default, the value of the TEST_MODE constant is false, so you'll need to change it to true to enable the test data to load automatically. You'll want to do this only for development, test packaging, or deployment, and you should set the constant back to false before production packaging and deployment (as compared to initial data, which is, which will be automatically loaded even in production deployments).

In the generated Maven project (in source code), the resource subfolder for test data is src/main/ resources/test-data. For a compiled Java servlet-based application, the resource subfolder for test data is WEB-INF/classes/test-data.

Each test data file uses the name "EntitySetName.json". For example, create the test data for a ServiceOrderSet entity in the subfolder of src/main/resources/test-data and call the file ServiceOrderSet.json. Once the project is compiled and is packaged into a Java EE WAR file using Maven, that file is located as WEB-INF/classes/test-data/ServiceOrderSet.json within the WAR file.

[

{ "ServiceOrderID" : 1, "description" : "Heat pump malfunction error code 415", "priority" : "High", "workcenter" : "6575" }, { "ServiceOrderID" : 2, "description" : "Furnace noisy", "priority" : "Medium", "workcenter" : "6767" }, { "ServiceOrderID" : 3, "description" : "Clean the ducts", "priority" : "Medium", "workcenter" : "6767" } ]

Nesting Child Entities

Both initial and test data files contain one entity set per file. We recommend that you use nested child entity sets that display the relationship between the data.

[

{ "ServiceOrderID" : 1, "description" : "Heat pump malfunction error code 415", "priority" : "High", "workcenter" : "6575", "operations" : [ {

Using SAP Cloud Platform Mobile Service, mobile development kit 190 PUBLIC Mobile Backend Generator "OperationID" : 1, "ServiceOrderID" : 1, "critical" : true, "description" : "Clean exterior filter" }, { "OperationID" : 2, "ServiceOrderID" : 1, "critical" : true, "description" : "Check freon pressure" } ] }

]

7.1.2 Server OData API

Customize your code by using the listener and handler classes.

Customization code frequently uses classes for the Server OData API.

To access incoming request, the generated listener and handler classes provide access to the servlet object; see DataServlet Class.

To access the backend database, the generated listener and handler classes provide access to the service object; see DataService Class.

To create or alter database queries, see DataQuery Class.

You can use the generated OData proxy classes can be used for typesafe access to OData entity types. Note that the service object also provides convenient typesafe access to query results, by the generation of a strongly typed query method for each OData entity set.

Listener Classes

Customizing generated listener classes lets you add code blocks that are executed before or after OData CRUD operations . Listener classes are similar to database triggers.

The additional code blocks can use the service object to send additional queries or updates to the database, or simply perform data cleansing or data validation .

The following is an example of data cleansing:

@Override void beforeSave(EntityValue entityValue)

{ // Remove leading and trailing spaces from customer name before saving changes to database. Customer entity = (Customer)entityValue; String name = entity.getName(); entity.setName(name.trim());

}

The following is an example of data validation:

@Override void beforeSave(EntityValue entityValue)

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 191

{ // Check that order item quantity is positive. OrderItem entity = (OrderItem)entityValue; int quantity = entity.getQuantity(); if (quantity <= 0) { throw DataServiceException.validationError("Order item quantity must be a positive number."); }

}

You can also use listener classes to implement of auditing and fine-grained security; see Row-Level Authorization and Column-Level Authorization in Securing the Generated Service [page 197].

Handler Classes

You can customize generated handler classes to override the default implementation of OData CRUD operations as well as to implement OData actions and functions .

You'll probably not need to override the implementation of OData CRUD operations: sections in listener classes is sufficient. A special case is, for example, overriding of executeQuery so that the query result from the database is post-processed, to remove rows and columns containing sensitive data before it's returned to the client. This might be appropriate if you were unable to achieve the post-processing by modifying the query filter before execution using a beforeQuery listener.

OData actions and functions must be implemented (either by default or via your customizations), as it's usually impossible for the code generator to know what an action or function should do. The implementation of an action or function can be delegated to a database stored procedure, by making an explicit call to the appropriate action or function method on the service object, assuming that such a stored procedure exists. No such assumption is made by default. If you don't explicitly an action or function by customizing the respective method handler class, the client receives an HTTP 501 (Not Implemented) error.

7.2 Deploying the Generated Service

The procedure for deploying the generated WAR file to the target web application server.

The procedure for deployment of the generated WAR file depends on the target web application server.

In some cases, the default context path of a deployed WAR file depends on the WAR file name, for example, a file test.war may result in context path "/test". In this case, you may want to rename the generated WAR file before deployment. In other cases, the context path can be specified using a server-specific mechanism.

Before you can deploy a service, you must create one. See Generating an OData Service [page 186].

 Note

For additional information about deploying to your environment, see Develop Applications.

For Cloud Foundry deployment, see Deploying to Cloud Foundry [page 194].

Using SAP Cloud Platform Mobile Service, mobile development kit 192 PUBLIC Mobile Backend Generator For Neo deployment, see Deploying to Neo [page 193].

7.2.1 Deploying to SAP Cloud Platform – Neo

Follow these steps to deploy your generated OData service to the Neo environment.

Deployment to SAP Cloud Platform – Neo Environment

Using SAP Cloud Platform for Neo

This procedure refers to the SAP Cloud Platform Cockpit, and is subject to change if the cockpit UI changes. If you are in doubt, please consult theSAP Cloud Platform documentation.

If you don't yet have a SAP Cloud Platform account for Cloud Foundry, start by signing up .

1. Select Export from the context menu of the generated WAR file in the target folder of your service. This saves the file locally. Since deployment to Neo is not integrated in SAP Web IDE Full-Stack, continue the steps using the SAP Cloud Platform Cockpit in your Neo landscape. 2. Once you are in the cockpit, go to Applications Java Applications , and select Deploy Application. 3. Select the war file by browsing your local computer for the war file you exported from SAP Web IDE Full- Stack in step 1. Specify an application name: the name you enter here is how the app is referred to in the Neo environment. Select the runtime Java EE 7 Web Profile TomEE 7 and select Deploy. When completed, select Done. Don't start the service yet; however, you can select the name to see its details. 4. If you aren't using the in-memory database, you must bind your app to the correct database instance. Go to Configuration Data Source Bindings . Select New Binding. Leave the data source as . Select the database ID and the database user/password for your database. Select Save. 5. If you selected an authentication method other than NONE, you must assign the correct roles to your administrator users so they can access the service and view its metrics. Go to Security Roles of your Java app. For each role ServiceUser and ViewMetrics, highlight the role. Select Assign, specify your user ID and select Assign. Depending on your Cloud Platform configuration, you may require an administrator to perform the role assignment. 6. Return to the Overview page and select Start. Once the service starts, you see its URL in the list of Application URLs. Select the link to access your OData service and make sure it works from a browser.

Using the Neo command-line tool

For detailed instructions, see Development Applications in the Neo Environment Java: Development Deploying and Updating Applications Deploy on the Cloud with the Console Client on the SAP Cloud Platform documentation.

If not already done, install the neo command-line tool.

Example deploy command: neo deploy --host hanatrial.ondemand.com --account *myuser*trial --application myapp --source c:\projects\myapp\target\odata-service-1.0.0.war --user myuser -- runtime neo-javaee7-wp

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 193 Available bind commands: neo help bind-db neo help bind-hana-dbms neo help bind-schema

Example start command: neo start --host hanatrial.ondemand.com --account *myuser*trial --application myapp --user *myuser*

7.2.2 Deploying to SAP Cloud Platform – Cloud Foundry

Follow these steps to deploy your generated OData service to the Cloud Foundry environment.

Select Cloud Foundry as the Deployment Target. If you are not using the in-memory database, select SQL Database binding.

Deployment to SAP Cloud Platform – Cloud Foundry Environment

Using SAP Cloud Platform for Cloud Foundry

This procedure refers to the SAP Cloud Platform Cockpit, and is subject to change if the cockpit UI changes. If you are in doubt, please consult theSAP Cloud Platform documentation.

If you don't yet have a SAP Cloud Platform account for Cloud Foundry, start by signing up .

1. Once the build of your service folder is completed, you must to generate a mtar package for deployment to Cloud Foundry. To generate the mtar, you need to select Build from the context menu of the project folder (not the service folder which we did in Generating an OData Service [page 186]). 2. Once it's built, the mtar file appears in another project called mta_archives. You may need to refresh for the UI to display it. 3. Deploy the generated service. ○ To a test environment – select Run Run as Java Application from the target folder context menu. The logs of your server appear in the console, so you can use SAP Web IDE Full-Stack to do java debugging. This option gives you the URL for your OData endpoint to access your service. ○ To your production environment – select Deploy Deploy to Cloud Foundry from the context menu of the mtar file. Specify your Cloud Foundry landscape and select Deploy. 4. When the deployment finishes, you see a link in the console to the OData service. Select it to make sure it works from a browser.

Using the cf command-line tool

If not already done, install the Cloud Foundry CLI.

● Use the cf api command to select your target Cloud Foundry environment. ● Use the cf login command to authenticate yourself with Cloud Foundry.

Using SAP Cloud Platform Mobile Service, mobile development kit 194 PUBLIC Mobile Backend Generator ● Use the cf push command to deploy your application to Cloud Foundry. ● Use the cf routes command to find the URL for accessing your service.

Example push command: cf push -f c:\projects\myapp\manifest.yml

7.3 Monitoring the Generated Service

Use logging and metrics to monitor your generated OData service.

Logging

The generated main servlet class declares an SLF4J application logger.

● The application's logger name is "odata.service". ● Configure the logger with the DEBUG log level to get basic request and response information (URL and status). ● Configure the logger with the TRACE log level to get detailed request and response content (headers and payload).

 Caution

Using the TRACE log level, and to a lesser extent the DEBUG log level, may result in personal or sensitive information being included in the application server-side log files. Once your application is tested and ready for production, you may need to use a reduced log level (such as INFO, WARN, or ERROR) to ensure compliance with the EU General Data Protection Regulation or other applicable regulations. If you temporarily enable logging for diagnostic purposes in a system that stores sensitive or personal information, regulations may dictate that you can retain the log files only for the minimum period required for the purposes of such diagnostic activities. Transmitting log files outside the administrative boundaries of the regulations (for example for technical support purposes) might be prohibited.

See Monitoring the Generated Service - Neo [page 196] for more details.

See Monitoring the Genereated Service - Cloud Foundry [page 196] for more details.

Metrics

The generated OData service includes an embedded metrics OData service for use by administrators.

Metrics are collected and aggregated according to the SAVE_METRICS_EVERY_PERIOD parameter in the generated metric settings class, which defaults to one hour. The accepted values for this parameter are limited to: 1 day (for example P1D), N hours where 24 mod N = 0 (for example PT1H), or N minutes where 60 mod N = 0 (for example PT5M). Metrics are automatically retained in accordance with the

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 195 RETAIN_METRICS_FOR_PERIOD parameter, which is, by default, seven days. Newly collected metrics are available only at the end of each aggregation period, for example, at the end of each hour.

To access metrics append "/admin/metrics" to the main service root URL, followed by one of these read-only entity sets: history, recent, last. For example, if you deployed a "test" application (in either a Cloud Foundry or Neo environment), and wanted to collect metrics for it, you'd use the following URLs:

● https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/history – all available metrics that have not yet been deleted according to the retainMetricsFor parameter. ● https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/recent – metrics for the last five completed aggregation periods. ● https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/last – metrics for the last completed aggregation period.

Use regular OData URL conventions to filter or select metrics.

You can look at metrics in HTML format using a browser client, or by appending ?$format=html to the URL. This allows you to access to the metrics in spreadsheet format, for example using Microsoft Excel Data From Web .

 Note

Metrics are primarily provided for SQL database operations; when you are using the in-memory database, there may be no metrics available.

7.3.1 Monitoring the Generated Service – Neo

Follow these steps to set up monitoring for your generated OData service.

SAP Cloud Platform Logging – Neo Environment

● In the cockpit, after selecting your account, select Applications Java Applications , then select your application name. ● Select Logging Configure Loggers . ● Enter sap.xs as the Filter, and change the log level to DEBUG or TRACE as required. ● Enter odata.service as the Filter, and change the log level to DEBUG or TRACE as required.

Test your application, then use the SAP Cloud Platform Cockpit to download trace files as required.

7.3.2 Monitoring the Generated Service – Cloud Foundry

Follow these steps to set up monitoring for your generated OData service.

SAP Cloud Platform Logging – Cloud Foundry Environment This section assumes that you have the Cloud Foundry command-line tools installed. You can also view the logs from the SAP Cloud Platform Cockpit.

Using SAP Cloud Platform Mobile Service, mobile development kit 196 PUBLIC Mobile Backend Generator By default, the generated manifest.yml or mta.yaml enables the INFO log level. Change the log level to DEBUG or TRACE as required, then rebuild (for example, mvn clean package) and redeploy (for example, cf push ...) the application.

Test your application, then use the cf logs command to download logs as required.

Download recent logs for your application using the following command: cf logs --recent myapp

Stream logs as they are produced using the following command: cf logs myapp

 Note

The generated manifest.yml or mta.yaml contains the following line:

SAP_XS_LOGGER=slf4j

To improve readability of log output, change slf4j to console before redeploying the application. Please note however that regular SLF4J log output formatting is disabled by this setting.

7.4 Securing the Generated Service

Consider adding security measures to your generated OData service to control access.

You can secure the generated OData services the following ways:

1. Authenticating each users' identity. 2. Authorizing each users' data access. 3. Ensuring the confidentiality of data that's passed over the network.

 Caution

If you selected NONE in the Mobile OData Service Parameters of the SAP Web IDE Full-Stack wizard, the generated OData service doesn't check a user's identity or restrict a user's data access. Nor does it guarantee that data passed over the network is encrypted (via HTTPS). Apart from exceptional circumstances such as public-access read-only services, you should configure a production application for authentication, authorization, and confidentiality. This helps to ensure compliance with the EU General Data Protection Regulation or other applicable regulations.

Authentication

Use BASIC authentication for Neo or XSUAA for Cloud Foundry (or another option other than "NONE" for both Neo and Cloud Foundry) to ensure that only authenticated users can access the service.

Use of a login-config element within the generated web.xml to achieve authentication.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 197 Authorization

To set up authorization on the Mobile OData Service Parameters screen, within the SAP Web IDE Full-Stack wizard, you must have selected any option other than "NONE" if you are deploying to the Neo environment, or XSUAA if you are deploying to the Cloud Foundry environment.

Specify the Security.Roles annotation for security roles that might not be referenced in other security annotations, but might be referenced in runtime checks using custom code, for example, when you are implementing row-level authorization. (see section below).

Specify the Security.ServiceUserRoles annotation (or rely on the default ServiceUser role) to ensure that only authorized users can access the main OData service. For SAP Cloud Platform (Neo environment), you can use the Everyone role name to designate all authenticated users.

Specify the Security.ViewMetricsRoles annotation (or rely on the default ViewMetrics role) to ensure that only authorized administrators can access the embedded metrics service.

The following example shows OData Version 4.0 CSDL XML using "security" vocabulary to override default service/metrics roles (some sections abbreviated with ". . ."):

... Manager Employee Administrator

Use the security-constraint elements within the generated web.xml to achieve authorization.

Fine-Grained Authentication

All authorized users have permission to create, read, update, and delete any data. This section describes how to achieve more fine-grained authorization.

Using SAP Cloud Platform Mobile Service, mobile development kit 198 PUBLIC Mobile Backend Generator Method-Level Authorization

Reference the "security" annotation vocabulary in the CSDL XML file to restrict access to data methods (action imports, function imports, stored procedures, and apply the Security.InvokeRoles annotation term from that vocabulary to the data methods.

This example demonstrates OData Version 4.0 CSDL XML using "security" vocabulary (some sections abbreviated with ". . ."):

... ... ... Manager

A user needs only one of the permitted roles to be allowed access. Specifying an empty roles collection in the roles annotation means nobody can access the service.

Table-Level Authorization

Referencing the "security" annotation vocabulary in the CSDL XML file to restrict access to entity sets (database tables) and apply the annotation terms from that vocabulary to the entity sets.

This example demonstrates OData Version 4.0 CSDL XML using "security" vocabulary (some sections abbreviated with ". . ."):

... ...

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 199 ... ViewCustomer EditCustomer ...

Available annotation terms for entity set security include the following:

● Security.ReadWriteRoles – a collection of roles permitted for read or write access, if not overridden by the more specific Security.ReadRoles, Security.WriteRoles, Security.CreateRoles, Security.UpdateRoles or Security.DeleteRoles. ● Security.ReadRoles – a collection of security roles permitted for read access. ● Security.WriteRoles – a collection of security roles permitted for write access, if not overridden by the more specific Security.CreateRoles, Security.UpdateRoles, or Security.DeleteRoles.

In each case, a user needs only one of the permitted roles to be allowed access. Specifying an empty roles collection in the roles annotation means nobody can access the service. Additionally specifying the Security.ReadRoles but not the Security.WriteRoles, causes nobody to have write access except as permitted by Security.CreateRoles, Security.UpdateRoles, or Security.DeleteRoles.

Row-Level Authorization

You may want to customize generated listener classes to implement row-level authorization. The simplest way to achieve this is to add code into a beforeQuery listener method to add extra filter conditions to the client- specified queries. Adding such query filters also prevents write access to the respective records.

For example, suppose there is an Employee entity type with a business rule that managers can access any employee's record, but regular employees can access only their own employee record. This might be coded in the EmployeeListener class as:

@Override void beforeQuery(DataQuery query)

{ if (!servlet.isUserInRole("Manager")) { // Add or extend query filter to employee's own record only. query.filter(Employee.email.equal(servlet.currentUser())); }

}

If it isn't feasible to add extra filter conditions to achieve the required level of row-level authorization, then you may need to customize the executeQuery method in the generated entity handler for the entity type to post- process the query results.

Using SAP Cloud Platform Mobile Service, mobile development kit 200 PUBLIC Mobile Backend Generator  Note

Any security role name used in a servlet.isUserInRole check reference at least one security roles annotation so that the role name is known at deployment time. Use the Security.Roles annotation, as shown in the authorization examples, if there are no other roles-related annotations that reference the required role name.

Column-Level Authorization Customize generated listener classes to implement column-level authorization.

For example, suppose that only managers can update an employee's salary, but employees can update other details in their own employee records. In addition to the beforeQuery customization, this might be coded in the EmployeeListener class as:

@Override void beforeSave(EntityValue entityValue)

{ Employee entity = (Employee)entityValue; if (entity.isNewOrChanged(Employee.salary) && !servlet.isUserInRole("Manager")) { throw AccessDeniedException.cannotWrite(Employee.salary.getQualifiedName()); }

}

 Note

Any security role name used in a servlet.isUserInRole check must reference at least one security roles annotation so that the role name is known at deployment time. Use the Security.Roles annotation, as shown in the authorization examples, if there are no other roles-related annotations referencing the required role name.

Confidentiality

Using any option other than "NONE" for your authentication method ensures the confidentiality of data passed over the network.

Use transport-guarantee element of CONFIDENTIAL within the generated web.xml to achieve confidentiality.

7.4.1 SAP Cloud Platform Security

Use the security provided by the SAP Cloud Platform to secure your generated OData service.

 Note

The Develop Applications in the SAP Cloud Platform documentation is a good starting point for additional information about security in the SAP Cloud Platform.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 201 SeeSAP Cloud Platform Securty - Neo [page 204] for more details.

SeeSAP Cloud Platform Security - Cloud Foundry with Mobile Services [page 202] and SAP Cloud Platform Security - Cloud Foundry [page 203] for more details.

7.4.1.1 SAP Cloud Platform Security – Cloud Foundry with Mobile Services

Use these security measure to keep your application secure.

Context

SAP Cloud Platform for Cloud Foundry usually requires a xsuaa service instance and application router creation in order to secure a deployed Java application. This is described in details below. If these services are to be consumed by mobile applications and the SAP Cloud Platform Mobile Services for Cloud Foundry is available, the process can be simplified to these steps.

Procedure

1. Using the SAP Cloud Platform Mobile Services Cockpit, select Mobile Applications Native/Hybrid New . 2. For ID and Name, enter the ID and name of your already deployed OData application with router appended (the application router cannot have the same name as the OData service). Then select Save. The Mobile Services Cockpit creates an application router and xsuaa service instance. 3. On the Info tab for your mobile application, select + sign to the right of Assigned Features, choose Mobile Connectivity and select OK. 4. On the Mobile Connectivity Configuration tab, select the create icon to create a destination. 5. Enter your OData service root URL, then select No Rewriting as the rewrite mode. 6. Skip the Custom Headers and Annotations dialog pages. 7. Select Forward Authentication as the SSO mechanism, then select Finish. 8. On the APIs tab for your mobile application, note the Back End URL, which is the URL that clients should use to access your OData service via the application router. 9. On the Security tab for your mobile application, select the edit (pencil) icon to the right of Application Settings and choose the security onfiguration (Basic, SAML, or OAuth) that meets your organisation's security requirements. You may be able to use Basic for testing purposes depending on your identity provider service. SAML works well with desktop browser clients. Using OAuth may require more client-side configuration. 10. Enable CSRF Protection to prevent Cross-Site Request Forgery . 11. On the Security tab for your mobile application, select the edit (pencil) icon to the right of Role Settings. Select Browse to open the xs-security.json file in your project folder.

Using SAP Cloud Platform Mobile Service, mobile development kit 202 PUBLIC Mobile Backend Generator 12. Select OK to save the role settings.

13. Navigate back to your Cloud Foundry subaccount, then use Security Role Collections to define one or more role collections. If your application uses the default ServiceUser and ViewMetrics roles, define a role collection for each one and add the corresponding role to it. Otherwise define role collections in accordance with the roles you selected using OData annotations for authorization. For each role ServiceUser and ViewMetrics, highlight the role. Select Assign and in the pop-up specify your user id and select Assign. The ServiceUser role is for regular users of the service (that is, a regular user of the service must have this role in order to be permitted to use the service). The ViewMetrics role is for administrators who want to view the service’s performance metrics. Regular users should not be permitted to view the metrics.

14. Navigate back to your Cloud Foundry subaccount, then select Security Trust Configuration and select your identity provider to show the Role Collection Assignment page, where you can assign role collections to individual users.

15. Consult theSAP Cloud Platform documentation Security Authorization and Trust Management → Developing Security Artifacts → Set Up Security Artifacts → Bind the xsuaa Service Instance to the Application. Bind the xsuaa service instance to your OData service (it was already bound to your application router by the Mobile Services Cockpit) 16. Restart your OData service so it recognizes the assigned xsuaa service instance. 17. Your OData service should now be ready for secure access by regular users and administrators, using the service root (backend) URL shown on the APIs tab for your mobile application.

7.4.1.2 SAP Cloud Platform Security – Cloud Foundry

Use these security measure to keep your application secure.

Context

The following instructions refer to the SAP Cloud Platform Cockpit, and are subject to change if the cockpit UI changes. If in doubt, consult the SAP Cloud Platform documentation.

Procedure

1. Consult the SAP Cloud Platform documentation Security Authorization and Trust Management → Authorization and Trust Management in the Cloud Foundry Environment. 2. Ensure that the Authentication Method xsuaa option was used during application generation. 3. Using the SAP Cloud Platform Cockpit, navigate to your Cloud Foundry space, then use the Service Marketplace menu option to locate the xsuaa service. 4. Select the xsuaa service, then select Instances, and select New Instance.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 203 5. In the Specify Parameters page of the wizard, select Browse and select the xs-security.json file that was generated in your project folder. This file defines the scopes and roles that are needed by the application. 6. On the Assign Application page of the wizard, choose your deployed application. 7. On the Confirm page of the wizard, choose an instance name (for example: "myapp-xsuaa") and select Finish. 8. Restart your OData service so it can recognise the assigned xsuaa service instance.

9. Consult the SAP Cloud Platform documentation Development Applications in the Cloud Foundry Environment → Configure Application Router.

10. Consult the SAP Cloud Platform documentation Security Authorization and Trust Management → Developing Security Artifacts → Set Up Security Artifacts → Bind the xsuaa Service Instance to the Application. Bind the xsuaa service instance to your application router (it was already bound to your OData service by the prior Assign Application step). Restart your application router 11. Configure Role Collections and Trust Configuration as documented in the previous section.

7.4.1.3 Cloud Platform Security – Neo

Use these security measure to keep your application secure.

Context

Set up the security and roles within the Cockpit.

Procedure

1. Consult the SAP Cloud Platform documentation Security Authorization and Trust Management → Authorization and Trust Management in the Neo Environment. 2. Ensure that the BASIC option was used during application generation (or another supported login option for Neo).

3. Using the SAP Cloud Platform Cockpit, select the Applications Java Applications , select on your application name. 4. Using the Security menu option, select the Roles menu option. 5. Assign predefined roles to users as appropriate for your enterprise. 6. Your OData service is now ready for secure access by regular users and administrators. 7. Consider using SAP Cloud Platform Mobile Services in front of your OData service so that you can enable CSRF Protection to prevent Cross-Site Request Forgery

Using SAP Cloud Platform Mobile Service, mobile development kit 204 PUBLIC Mobile Backend Generator 7.5 Appendix

This appendix contains additional information that you might find helpful for the Mobile Backend Generator.

Conventions for OData Metadata

The following conventions are provided to facilitate the generation and deployment of OData services that are compatible with the Server OData API (the Java class library which supports the implementation of the generated OData services), as well as to ensure the smooth interoperability of the generated services with a variety of OData client frameworks and SDKs. Currently, OData Version 2.0 and Version 4.0 for the SAP Web IDE Full-Stack are supported.

● Use the file extension .csdl.xml for OData CSDL XML files. ● Use Upper Camel Case for naming types and properties, for example, TravelAgency. ● Use singular names for complex entity types, for example Address, Customer. ● Use plural names for entity sets, for example Customers, or use the Set suffix, for example CustomerSet. ● Avoid using property/type names that differ only in case (for example customer and Customer) or that differ only in the absence/presence of underscores (for example Customer and _Customer). ● For key property names, use the ID suffix appended to the entity type name, for example CustomerID for entity type Customer. ● To support automatic server-side key generation for primary keys, we recommend that you use non- composite numeric keys of type Edm.Int64. If you are sure that a 32-bit integer keys are sufficient; then you can use Edm.Int32; however, if you aren't sure, use 64-bit integer keys. You can also use type Edm.Decimal for key properties, but it is likely to use more space in the database than Edm.Int64. ● Key types of Edm.Guid and Edm.String can also be used, but are not recommended as they take up more space within the database. If using type Edm.String, then specify MaxLength="36" to ensure that the key column is large enough to contain a generated GUID. String-typed properties containing database- generated sequence numbers are not supported ● Properties of type Edm.Binary and Edm.String should include the MaxLength facet unless they are intentionally of unbounded length. This ensures an optimal selection of database column type (for example, varbinary versus blob, varchar versus clob). ● Properties of type Edm.Decimal should specify Scale and Precision facets. This ensures an optimal selection of database column type. Note that an unspecified scale defaults to zero (only integer values can be stored in the database column if the Scale is unspecified). ● Use an explicit Nullable facet for properties. Since the default for OData CSDL XML is Nullable="true", it is easy to accidentally have nullable properties. Accidental nullability of properties may be a burden to client application developers, especially when using languages such as Kotlin and Swift that have strong support for nullable types. It may result in client developers having to defensively program against the possibility of properties having null values when it was not intended. ● Primary keys embedded within complex-typed properties are not currently supported. ● Use foreign keys embedded within complex-typed properties are not currently supported. ● Stream properties embedded within complex-typed properties are not currently supported. ● Navigation properties embedded within complex-typed properties are not currently supported. ● Bidirectional relationships (with navigation properties in both directions) are preferred.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 205 ● Foreign keys (specified with ReferentialConstraint) should be used wherever applicable. This permits the automatic implementation of OData features such as $expand queries, deep insert, bind operations, and link operations. ● Use OnDelete Action="Cascade" for navigation properties where the deletion of a parent entity should cascade to automatic deletion of the related child entities. ● Use OnDelete Action="None" for navigation properties where the deletion of a parent entity should be restricted (disallowed) when there are still existing related child entities. ● Use the Core.Immutable annotation for any properties that cannot be changed after an entity is created. See Customer and DateOfBirth in the example below. ● Use Validation annotations to express simple declarative validation rules. See Order and Quantity in the example below. Currently, such validation annotations may be utilized by clients, but the server runtime does not enforce them. Use entity listeners for server-side enforcement of validation rules.

The following is an example OData Version 4.0 CSDL XML:

Using SAP Cloud Platform Mobile Service, mobile development kit 206 PUBLIC Mobile Backend Generator

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 207 Enabling OData Change Tracking

You can enable OData change tracking either for all entity sets in an entity container, or for individual entity sets. Use the SQL.TrackChanges annotation within the appropriate element.

Example of an OData Version 4.0 CSDL XML with change tracking enabled:

Defining Indexes for Performance

You can define SQL database indexes for entity sets, to enable better performance for OData queries using $filter. This is achieved by use of the SQL.Indexes annotation within the appropriate element.

Example OData Version 4.0 CSDL XML with database indexes defined:

Using SAP Cloud Platform Mobile Service, mobile development kit 208 PUBLIC Mobile Backend Generator DateOfBirth HomeAddress/City

XSUAA security in Cloud Foundry

Here is additional information that may help setting up xsuaa

1. When you create your service xsuaa instance make sure to specify application as the plan. 2. The generated xs-security-json defaults to "dedicated" as the tenant mode. Some Cloud Foundry landscape IDPs configure for "shared" tenant-mode. In that case, change it to "shared" before creating the xsuaa service instance. 3. In Cloud Foundry cockpit, the and TrustConfiguration Role Collections require security administrator privileges otherwise you can't see them.

Using SAP Cloud Platform Mobile Service, mobile development kit Mobile Backend Generator PUBLIC 209 8 User Guide

The following tasks are completed on a device by the user.

Onboarding to the MDK Client App [page 210] To use your MDK client app, onboard to the MDK client from your device. You can onboard in several ways.

Installing the App on a User's Device [page 211] You will either receive a request to download the app from your administrator, or you will need to download the application from your Enterprise App Store.

Updating an App on a User's Device [page 212] The application is currently updated automatically on a user's device by Mobile Development Kit.

8.1 Onboarding to the MDK Client App

To use your MDK client app, onboard to the MDK client from your device. You can onboard in several ways.

Onboarding via URL

The URL to onboard to the MDK client is sent to you by a system generated email from the admin. This URL contains all the connection settings required for the app to be launched.

● To initiate the onboarding process, click on the URL or paste it in your preferred browser on your device. If your app is not running when a URL request arrives, it is launched and moved to the foreground so that it can open the URL. ● Follow the process for installation mentioned in Installing the App on a User's Device [page 211].

Onboarding via local overrides

After installing the client app, you can override some of the settings that the admin has set in the MDKClient_SDK/branding/BrandedSettings.json file included in the SDK bundle. To do this, your admin must have the granted you the permission to enable overrides in the connection setings and demo settings.

● From the Documents folder in your app, open the Overrides.json file. This file has a structure similar to the BrandedSettings.json file, excluding some of the fields which you cannot override. ● Make the desired changes to the settings present in the Overrides.json file. To override the demo bundle, modify the Demo.BundlePath setting. To override the demo database, modify the Demo.DBPath setting.

Using SAP Cloud Platform Mobile Service, mobile development kit 210 PUBLIC User Guide Onboarding via Branded settings

The connection settings set by your admin in the MDKClient_SDK/branding/BrandedSettings.json file allows you to onboard to the MDK client app.

Follow the process for installation mentioned in Installing the App on a User's Device [page 211].

8.2 Installing the App on a User's Device

You will either receive a request to download the app from your administrator, or you will need to download the application from your Enterprise App Store.

Context

Download the application to your iOS device. If you receive a request to do so from your administrator, accept it and start at Step 2 below.

Procedure

1. In the App Store Search box, search for your app.

The application description opens. 2. Tap Install.

The client application is downloaded from the store. After the download, an application icon appears on the mobile device. 3. Tap the icon to open the application. 4. Click Activate/Start.

This button does not appear if one or more connection settings are missing in the MDKClient_SDK/ branding/BrandedSettings.json file included in the SDK bundle. In this case, you have the option to explore the app via a demo mode. To launch your app in the demo mode, click Try the Demo.

To know more about app connection settings, see the Application connection information section in Branding Your Customized App [page 16].

If you do not see the Activate/Start button, you can also launch the client app directly from the URL that you received from your admin. To know more about URL onboarding, see the Onboarding via URL section in Onboarding to the MDK Client App [page 210]. 5. Enter your SAP Cloud Platform user name and password to log in. 6. Click Authorize.

This authorization screen does not appear if you have set the OAuth security settings to be bypassed in your SAP Cloud Platform account.

Using SAP Cloud Platform Mobile Service, mobile development kit User Guide PUBLIC 211 7. Read and Agree to the End User License Agreement. 8. Based on your device type, perform one of the following:

○ Enable Touch ID and Face ID if these options are supported on your device. ○ If Touch ID and Face ID are not supported on your device, set a passcode and confirm it.

The application opens and is ready to use.

8.3 Updating an App on a User's Device

The application is currently updated automatically on a user's device by Mobile Development Kit.

The Mobile Development Kit client checks for new application definitions in the App Update kit on the SAP Cloud Platform mobile service for development and operations cockpit at an automatically-defined interval. When a new version of the application is available, it is automatically downloaded in the background. If the download is successful, the upgrade happens automatically.

A notification message can be set through the app to appear before or after the upgrade takes place and local user data can be uploaded to the server before the upgrade is completed.

Using SAP Cloud Platform Mobile Service, mobile development kit 212 PUBLIC User Guide Important Disclaimers and Legal Information

Hyperlinks

Some links are classified by an icon and/or a mouseover text. These links provide additional information. About the icons:

● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your agreements with SAP) to this:

● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information. ● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this information.

Beta and Other Experimental Features

Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use the experimental features in a live operating environment or with data that has not been sufficiently backed up. The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example Code

Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Gender-Related Language

We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.

Using SAP Cloud Platform Mobile Service, mobile development kit Important Disclaimers and Legal Information PUBLIC 213 www.sap.com/contactsap

© 2018 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. The information contained herein may be changed without prior notice.

Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies.

Please see https://www.sap.com/about/legal/trademark.html for additional trademark information and notices.

THE BEST RUN