• No results found

Creating a Starter Application Project for iOS

8 Service Consumption

8.4 Toolkit for iOS (GWPA)

8.4.1 Creating a Starter Application Project for iOS

Explains how to create a starter application for iOS to consume the data published by an OData service in SAP NetWeaver Gateway.

You can create one of the following starter applications for iOS. All these applications support iPhone and iPad.

● Basic Starter Application

Generates a starter application for consuming the SAP NetWeaver Gateway service. The generated

application has a sample UI view, and contains a semantic proxy and a Request Handler that is responsible for the Gateway connectivity and parsing of the service data.

● Form Starter Application

Generates a starter application which displays a form for creating SAP data in the SAP business system.

● List/Details Starter Application

Generates a starter application for utilizing SAP data in list and details screens.

● Workflow Starter Application

Generates a starter application which displays the Workflow task information and allows the user to make a decision on the task.

The generated application is an Xcode project, which also contains a proxy for the service selected in the wizard.

To create your iOS starter application, proceed as follows:

1. From menu bar, select File New Other . The New wizard dialog is displayed.

2. Expand the OData Development node and select Starter Application Project.

3. Choose Next. The New Starter Application Project page is displayed.

4. In the Project name field, enter a new name for your project.

5. From the Create a new project for drop-down list, select iOS.

6. Choose Browse to navigate to the location where you want to create the Xcode project.

7. Choose Open. The selected location is displayed in the Folder path field.

8. Choose Next.

9. Select the desired template. The wizard provides different options depending on the template you select.

10. Choose Next. The Location of OData Service page is displayed.

11. Select the desired SAP NetWeaver Gateway service in one of the following ways:

○ In the Service URL field, enter the desired service’s URL and then choose Go to validate the servie metadata.

○ Choose Catalog and select the desired SAP service using the Service Catalog dialog.

○ Select the File system radio button and browse for the relevant service metadata and service document.

12. Configure the application based on the selected application type.

○ For the List/Details template, click Next to continue with the wizard as described in Defining the List/

Details Page Layout topic.

○ For the Form template, click Next to continue with the wizard as described in the Defining the Form Layout topic.

○ The Workflow and the Basic templates do not require further configuration.

13. Choose Finish. The created project’s folder is displayed in the location you previously specified.

14. Double click on the Xcode project file to open it.

You can now build and run the application.

Note

If your service URL is secured by SSL and you need a certificate to validate it, make sure the certificate is installed on the device before running the application.

Note

It is recommended to change the product name or bundle identifier unique name after the generation is complete as described in the Changing the Bundle Identifier and the Changing the Product Name sections for productizing the application.

Related Links

Defining the SAPUI5 List/Details Page Layout [page 140]

Explains how to define the application for List/Details.

Defining the Form Layout in the Toolkit for iOS (GWPA) [page 158]

Explains how to define the Form application for consuming the data published by your OData service in SAP NetWeaver Gateway.

Defining the List/Details Page Layout for the Toolkit for iOS (GWPA) [page 156]

The List/Details application is created by selecting a service and defining its views.

Defining the Form Layout in the Toolkit for iOS (GWPA) [page 158]

Explains how to define the Form application for consuming the data published by your OData service in SAP NetWeaver Gateway.

Changing the Bundle Identifier [page 160]

Explains how to change the bundle identifier in the generated application.

8.4.1.1 Defining the List/Details Page Layout for the Toolkit for iOS (GWPA)

The List/Details application is created by selecting a service and defining its views.

For each view, you must select one of the following types:

● List

The UI generated from this type of view is a table displaying information obtained from an entity set. For the chosen entity set, you are required to choose the fields you would like to display which will then become the table column headers. For example, the Customer entity set will have fields such as Customer Name, Country, Street, Telephone Number, and so on.

In addition, you can add to the generated list view the option of creating new items into the chosen entity set, or of deleting existing items.

● Details

The UI generated from this type of view is a 2-columned table displaying information obtained from an entity set item. For the chosen entity set, you are required to choose the fields you would like to display which will then become the table row values. The first column displays the entity set field name and the second column displays the field value.

In addition, you can add the generated details view the option of editing the data obtained from an entity set item.

The relationship between the views is based on the association between the entity sets. After you’ve selected an entity set for the first view (for example, Customers), in the second view you can only select an entity set that is associated to it (for example, Banks) or you can choose to display the details of the entity set you selected for the first view (for example, Customers).

To configure the views in a List/Details application:

After defining the application details as described on the Creating a Starter Application Project (steps 1-12), the View Layout page is displayed.

1. In the View Title field, enter the title for the first view.

2. From the View Type drop-down list, the List view option is automatically selected.

3. From the Entity Set Navigation drop-down list, select the desired entity set.

4. Select additional operations you would like to support from the view.

For views of type List the following options are available:

○ Select the Add Create Option checkbox to add the option of creating new items.

○ Select the Add Delete Option checkbox to add the option of deleting items.

For views of type Details, the following option is available:

○ Select the Add Edit Option checkbox to add the option of editing the displayed item.

Note

You can choose the operations described above only if they are supported by the selected entity set.

5. Choose Add (+) to see the fields available for the selected entity set. The Add Fields page is displayed.

6. Select the checkboxes of the desired fields for the view.

For usability reasons, it is recommended not to include more than three or four fields in a list.

7. Click OK.

8. If needed, select a field and click Remove (-) to delete it.

9. Use the Up and Down arrows to change the positioning of the fields in the view. The field positioned first in the list will appear bold in the relevant generated application’s list view.

10. In the Views section, choose to Add (+) another view.

11. Repeat this procedure to configure the additional views.

Related Links

Creating a Starter Application Project for iOS [page 150]

Explains how to create a starter application for iOS to consume the data published by an OData service in SAP NetWeaver Gateway.

8.4.1.2 Defining the Form Layout in the Toolkit for iOS (GWPA)

Explains how to define the Form application for consuming the data published by your OData service in SAP NetWeaver Gateway.

To create the Form application, you select an OData service and define the entity set and properties to be used.

To configure the Form layout:

1. Define the application details as described on the Creating a Starter Application Project for iOS section.

At the end of this procedure, the Form Template Layout page is displayed.

2. In the Form Title field, enter a title for the form.

3. From the Entity Set drop-down list, select the desired entity set. The generated Form application will enable creating enties for this entity set.

Note

Only entity sets to which you can add new entries (as defined in the service metadata) are displayed.

Note

• Entity sets that are not directly accessible at runtime (as defined in the service metadata) can be selected but the generated application’s code must be edited to access those entity sets appropriately. For more information, see the Modifing the Generated Form Application to Create an Entity in a Non-Addressable Collection section.

The required fields for the selected entity set are displayed in the fields table and can be identified by the icon.

4. Choose Add (+) to see the fields available for the selected entity set. The Add Fields page is displayed.

Note

Only properties of supported types are displayed (currently, properties of type Edm.Binary are not supported in the generated form applications).

5. Select the checkboxes of the fields you want to add to the form view.

6. Click OK.

7. If needed, select a field (or multiple fields) and click Remove (-) to delete.

Note

Required fields cannot be removed.

8. Use the Up and Down arrows to change the positioning of the fields in the form view.

Related Links

Creating a Starter Application Project for iOS [page 150]

Explains how to create a starter application for iOS to consume the data published by an OData service in SAP NetWeaver Gateway.

Modifing the Generated Form Application to Create an Entity in a Non-Addressable Collection [page 231]

Some collections may be creatable, but they are not addressable, meaning they can only be accessed from a navigation property. For example, when a user has several communication methods (email, telephone, etc.), creating a new communication method to a specific user by using a navigation property from the user to his/her communication methods, is a valid scenario. However, adding a communication method to a list of all

communication methods is not possible.

8.4.1.3 Changing the Bundle Identifier

Explains how to change the bundle identifier in the generated application.

To change the bundle identifier:

1. In the Xcode Project Navigator, select Supporting Files [Your Project Name]-info.plist . 2. In the table displayed, search for the Bundle identifier field and edit it as needed.

Example

8.4.1.4 Changing the Product Name

Explains how to change to the product name in the generated application.

To change the product name:

1. In the Xcode Project Navigator, select your project.

2. Under Targets, select the target for which you want to change the product name.

3. Select the Build Settings tab.

4. Search for the Product Name property.

5. Edit the product name as needed.