Skip to content

Latest commit

 

History

History
258 lines (137 loc) · 13.3 KB

File metadata and controls

258 lines (137 loc) · 13.3 KB

Getting Started

This guide will help you setup all necessary components to explore OData, generate a minimal app with the Assistant, and run the reference app in this repository.

This page is broken into the following sections:

  1. Clone this Repository
  2. Install Sample Expense Data
  3. Generate a Minimal Entity Viewer App for Expense Data
  4. Configure Pre-built Travel Expense App

Clone this Repository

In order to complete the steps outlined below, you’ll want to have a copy of this repository dowloaded to your Mac. To clone this repository, open Xcode and choose clone… from the Source Code menu. Paste in the URL for this repository and click Clone. After you’ve cloned this repository, you can close the Xcode project and continue with the following steps.

Clone-repository

Install Sample Expense Data

To provide a database for our app, we’re using a predefined Java Application backend you can host in your Neo Trial Cloud landscape.

Open a browser window to https://account.hanatrial.ondemand.com/cockpit#/home/trialhome

Click on Neo Trial to enter the Neo Trial landscape on the SAP Cloud Platform.

Backend-setup-cloud

Next, click on Applications and then Java Applications.

Backend-setup-cloud

To deploy a new Java application, click on Deploy Application. A new pop-up, should appear.

Backend-setup-cloud

From here click on Browse and navigate to your local version of the cloned repository. Select the SAPTravelExpense.war file and click Choose.

Backend-setup-cloud

Next you’ll select a Runtime where your backend should run. For this sample Java Backend we're using the Java Web Tomcat 8 runtime. Under the Runtime Name dropdown menu, select the Java Web Tomcat 8 runtime and leave the rest as it is.

Backend-setup-cloud

Click the Deploy button at the bottom of the window to start the deployment of the .war file.

After the deployment finishes you have to start your application by clicking the Start button at the bottom of the window.

Backend-setup-cloud

Now the SAP Cloud Platform starts the Java Application so you can use it as a backend.

Backend-setup-cloud

Once the application transitions from Starting to Started your backend is up and running.

Backend-setup-cloud

To verify the services data click on the name saptravelexpense and click on the link under Applications URLs to open the Service Document of the OData Service.

Backend-setup-cloud

Here you can review the structure of the backend data model and alter the service URL in the browser to explore the data.

Backend-setup-cloud

Finally, copy the browser URL for use as the Backend URL in the following steps.

Generate a Minimal Entity Viewer App for Expense Data

After deploying and starting the saptravelexpense backend we could configure the reference application in this repository and the Mobile Services, std configuration now; However, as we want to develop our own T&E app later on, we will use the SAP Cloud Platform SDK for iOS Assistant to create the Mobile Services, std configuration and a minimal expense app titled MyTravelExpense app. You can extend this generated app to build your own full-featured Travel Expense app.

Enable Mobile Services

First you have to activate the Mobile Services, std in your Neo Trial Cloud landscape. For that open a browser window to https://account.hanatrial.ondemand.com/cockpit#/home/trialhome and select Neo Trial.

Entity-Viewer

Next click on Services in the left navigation panel.

Entity-Viewer

Use the search field to search for Mobile on this page.

Entity-Viewer

Click on Mobile Services, std and if not enabled yet, click on Enable.

Note: This may take a while so no worries!

Entity-Viewer

After enabling the service or if already enabled, click on Go to Service to open SAP Cloud Platform Mobile Services window.

Entity-Viewer

Configure the SAP Cloud Platform SDK for iOS Assistant

To configure the SAP Cloud Platform SDK for iOS Assistant go to Important Links and click on the Importing URLs directly link.

Entity-Viewer

The SAP Cloud Platform SDK for iOS Assistant will launch and prompt you to complete the entry of your account information.

Entity-Viewer

Entity-Viewer Enter the following information:

Field Information
Name Mobile Services on Neo Trial
Authentication SAML

Click Back to return to the main page of the assistant.

Entity-Viewer

Create your first Xcode Project

Click the Create new button.

Entity-Viewer

To create a new application, click Create New Application.

Entity-Viewer

Select Mobile Services on Neo Trial for the Account and click Next.

Entity-Viewer

The next configuration step will create a SAP Cloud Platform Mobile Services application for you.

Enter the following information:

Field Information
Name MyMobileCloudServiceApplication
Identifier com.example.MyMobileCloudServiceApplication

Select No Authentication from the Authentication dropdown menu and click Next. The identifier is important to get the Travel Expense app in this repository working later.

Entity-Viewer

In the next step you need to define a Destination to your backend. As we just started our backend in the previous section we have to create a new destination to the backend here.

Click Add new

Entity-Viewer

Enter the following information in the corresponding fields:

Field Information
Name ExpenseDestination
Backend URL Paste in the URL from the previous section

Choose No Authentication from the Authentication Type dropdown and click Save.

Entity-Viewer

To continue with the project creation click Next.

Entity-Viewer

For this step select Enable Offline Data, keep all the defaults, and click Next.

Entity-Viewer

This step populate the information in your Xcode Project later on, so please enter the following information:

Field Information
Product Name MyTravelExpense
Organization Name Your Company
Organization Identifier Your Company

Select a path where you want to create your Xcode project and click Finish.

Entity-Viewer

Run your generated application

Xcode should automatically open your just created project.

To run your application in the iOS simulator, choose the iPhone X scheme and click the Run button.

Entity-Viewer

To log-on enter your SAP Cloud Platfrom account username and password.

Entity-Viewer

The on-boarding screens will be presented, enter a pass code, then you’ll land on the main app screen where you can explore the data on your deployed backend.

Entity-Viewer

Because this minimal iOS app has all the sample code required to query, create, and modify expense entities, you can use it as the base for implementing your own views leveraging Fiori for iOS controls.

To bypass requests for your passcode with every launch, turn on biometric authentication by selecting Face ID > Enrolled from the Hardware menu in the Simulator app.

Configure Pre-built Travel Expense App

You can leverage the backend data and cloud application created in the previous steps to configure the Travel Expense sample in this repository.

In the Finder, navigate to the local directory where you placed the cloned version of the Travel Expense repository.

Open the Xcode project file titled TravelExpenses.xcodeproj.

Replace the placeholder values

Click on the AppDelegate.swift file in the Xcode project navigator.

Scroll to the configuration value placeholders.

Reference-App

Set the value of the TRIALACCOUNT string to your account name.

This value is displayed after navigating to https://account.hanatrial.ondemand.com/cockpit#/home/trialhome and clicking on Neo Trial. The name should look something like p1942140767trial

Reference-App

Set the value of the APPLICATIONID string to "com.example.MyMobileCloudServiceApplication".

Set the value of the DESTINATION string to "ExpenseDestination".

Note: If you have chosen your own names in the previous sections you have to make sure to set the correct values here.

Reference-App

Export Frameworks to the Xcode Project

Open the SAP Cloud Platform SDK for iOS Assistant.

Reference-App

From the SAP Cloud Platform SDK for iOS Assistant menu, select the Export Frameworks... menu item.

Reference-App

Select the frameworks directory inside the Travel Expense folder and click Export.

Reference-App

Click the Run button in Xcode to run your copy of the TravelExpense app.

Reference-App

After the Simulator has started the TravelExpense app will launch. Click Start to begin.

Reference-App

You’re done! Tap through the on-boarding screens, enter a passcode, and review the TravelExpense sample app. Like the minimal app we created in the previous section, this app demonstrates query and expense creation and modification techniques however this sample includes additional code examples demonstrating how to implement Fiori controls and connect them to the back end expense data.

Reference-App