Skip to Content
Technical Articles

How to build the iOS App that displays SAP S/4HANA data as AR 3D object (1/2)

I build the iOS app that displays SAP S/4HANA data as AR 3D object. I’d like to share detail steps I took.

ar.gif

Architecture

Procedure

1. Implement GetEntitySet method of OData on SAP S/4HANA
2. Generate an Xcode Project with SCP SDK for iOS Assistant
3. Implement the AR function to generated Xcode Project on step2

This post is introduce Step1-2, and Step3 in next post.


Preference

Back-End:

  • SAP S/4HANA 1709 (On-Premise)
    (Connecting SCP account by SAP HANA Cloud Connector)

Cloud:

  • SAP Cloud Platform (NEO)

Front-End:

  • iPhone7 Plus
  • iOS12.1

Implement OData on SAP S/4HANA

First I create an OData project from Tr-code SEGW.
This time, I will implement acquiring store inventory data of products in SAP S/4HANA.

Create a OData Project

Click the [CreateProject] button on the upper left of the screen.
Enter the Project name and Description and click the [Continue] button.
(Please enter an appropriate value for the package and user name according to the environment.)image.png

Create entity types.
Right-click to Data Model> Create> Entity Type.image.png

Enter the EntityType name (in this case “StockInfo”).
In order to create EntitySet at the same time, turn on [Create Related Entity Set] and click [Continue].image.png

Register Property of EntityType.
(In this case, it’s a simple structure consist of the material number and its store inventory quantity.)image.png

Name Key EdmCoreType Prec Scale Max Label ABAP Type
Matnr X Edm.String 0 0 40 Material Number MATNR
Quan Edm.Decimal 13 0 0 Amount QUAN
Unit Edm.String 0 0 3 Unit UNIT

Turn on “Addrable of EntitySet.
image.png

Click the [Activate] button to activate ODataProject.

Enter the Model Provider Class Name and Data Provider Class Name and click [Continue] to automatically generate each class.image.png

After defining the data model, I will implement the acquisition method.

From Service Implementation, right-click the GetEntitySet method of StockInfoSet and select [Go to ABAP workbench].image.png

Switch to change mode, place the cursor on the method to implement [STOCKINFOSET_GET_ENTITTYSET], and click the upper right [Redefine] button in the list.
image.png

Implement data acquisition process with ABAP.

In this case, for simplicity, the stock information is stored in the dummy add-on table (YTEST0001), and the process of only acquiring data from there is implemented.image.png

##Stock information Table (YTEST0001)
image.png

Activate OData Service

Next, register the implemented OData as a service.
Add the service from transaction code “/IWFND/MAINT_SERVICE”. Click “Add service”.
image.png

Select the OData implemented.image.png

Enter the service name etc. and click [Continue].
image.png

If successful, the following message will be displayed. Click [Continue].image.pngThe OData service is now registered.

Generate an Xcode Project

Next, generate an iOS application that displays the OData EntitySet data using the SCP SDK for iOS.

 

SCP account settings

First, set up the account of SCP in advance. Click [Manage Accounts].image.png

Click the [Add New ..] button and enter the SCP Mobile Service URL information.
For the value to be entered, open SCP Mobile Service from a browser and refer to the URL described in the menu [Important Link].
(If you click [Direct URL Import], it will be entered automatically.)
image.png
68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3332303432392f35636336646361632d386465322d366261342d313632642d3662643038316132633639622e706e67.png

Generate Xcode Project

Next, create an Xcode project. Click [Create New] button.image.png

Click “Create new Application”.image.png

Select the the SCP account information. (Please enter your SCP credentials as the login screen will pop up.)
image.png

Enter the application name & Identifier etc. (your favorite name). These will be the application information registered on the SCP Mobile Service.image.png

 

Next, create backend connection information. Click [Add New …].image.png

Enter the URL of the OData service created above in BackEndURL.

Enter the authentication information used for back-end connection in [AuthentificationType]. In this case, select “BasicAuthentification” and enter the S/4 HANA login user & pass. (It is necessary to set according to the Cloud Connecter authentication setting etc.)image.png

Select the connection information I created and click Next.image.png

Configure settings for the app. (In this case, default settings)image.png
Enter the project name, organization name, etc. (as you like). These will be the information of the Xcode project to be generated from now on.
image.png

Select the backend connection information I created earlier to create ProxyClass.image.png

Select the app’s UI type. In this case, select “Master/Detail View”.
The setting is now complete. Click the [Finish] button.image.png

If successful, Xcode is launched and the generated project is opened.
An iOS app connected to the back end via SCP was automatically created at once.image.png

Build Check

Let’s check of the generated Xcode project.

Since Team information is blank at the automatically generated stage, set your own team information and Click the upper left build button.
image.png

The simulator has started up.image.png

After authentication steps etc., a list screen is displayed.
I can confirm that the OData EntitySet name (StockInfoSet) is displayed.image.png

When StockInfoSet is selected, I can confirm that the table record (stock information in dummy table) on S/4HANA is displayedimage.png

 

Summary

I generated an iOS application that is connected to the back end S/4HANA system using SCP SDK for iOS. It’s great to be able to easily make a implementation.

In next post, I will implement the AR function by updating generated Xcode project.

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.