sapui5 ajax,Getting started with Neptune and SAPUI5 Mobile

This guide will teach you how to create mobile apps with Neptune and the new SAPUI5 support that is being introduced in the 2.1 version of the Neptune Application Designer.

Here you can find the BETA transports for the SAPUI5 support of the Neptune Application Designer. You are free to install this on your system but be advised that this is still a BETA release and should not be used for productive solutions. Any issues you encounter should be addressed to:

EDIT: Here is a link to our employee lookup template ported to SAPUI5  Mobile Preview

We will use the flight database as it is part of all SAP ABAP installations. There are some major differences between developing SAPUI5 and jQuery Mobile apps. The first thing you will see is that with SAPUI5 all communication between the server and the client is based on json data that is connected to the SAPUI5 data models. Also the navigation differs between the two frameworks.

We do not deliver the SAPUI5 framework itself as this would for obvious reasons be an issue regarding IP and licensing. So by default we connect the library to the Cloud version but we provide you with the option to declare the path under which you have installed it under Application -> Settings:

96b29f3588e06943798bdbed881cf077.png

a6243a3062d0cc07c620ebdb7b75be9f.png

If you have Neptune with SAPUI5 installed you will also have the NEPTUNE_FLIGHT_UI5_M application in your system. You should look at this app as it is the basis of this tutorial.

In the application tab you can notice that we do not have the Stateful box checked. In SAPUI5 we have less need of the stateful server functionality.

ace1b6b9a10c888256731b3b608ce5e3.png

In the Library tab we have chosen the SAPUI5 framework and the sap.m library which is the mobile version of SAPUI5

996da07c4460d1029d030f319ae8a4ff.png

The last thing we need in the application tab is to select a Theme. We have chosen BlueCrystal as that has the popular Fiori look and feel

d7cf1a302beb3a53dde30dc3f81863e5.png

Now go to the designer tab and have a look at the sap.m library and the completed application.

It consists of an App element and five pages

203f767d0e7e6f79c075ba769762c5f9.png

Use the “preview in wrapper” button to see how the application works. The landing page is a Home page with two tiles that are used for navigation. Use the settings functionality on the left side of the preview page to play around with different devices and rotation.

8609f5060feb6745898e16b500ec341c.png

The home page consists of two tiles with basic navigation functionality. Also make note of the help menu for the SAPUI5 icons. Navigation to another page is done by simply using the App.to() function on the press event: App.to(“PageBook1”);

09bdffef89f61fbde0b8e1fa98b9ceb2.png

Next, look at the PageBook1 page. You will see that it has the model source GLOBAL which is a structure we have defined in the application class. Also it contains the Ajax ID UI5_INIT_BOOKING so that we know how to fetch the data from the server. This is a good example of how client server communication works with the new SAPUI5 framework.

251e81cd5151b2bf71a1d5584de04a56.png

In the HANDLE_ON_AJAX method of the application class you can see how the global structure (and the page model is filled)

97cea2b7f1514222203411cff0a9a618.png

Now look at the list and the inputListItems where you have a select for the Airline and the Ajax ID for loading the different Airlines in the system.

d9cf5d01ff881f9314f1bdeeeabddaf4.png

The search page looks like this (The smoker option shows how old this database is 🙂 )

02ebd488adbc0d90bae6c69b659997f5.png

Now to be able to send our selections to the server we need to bind the input fields to the GLOBAL structure. Select the attribute tab of the selAirline element. Use the binding button to the right. You will see that the selectedKey attribute is bound to the CARRID of the GLOBAL structure

bb411d4d90bab09b0861e7e1afc26d34.png

All models can be fetched with a “reload” prefix to the model name. If you look at the search button in the footer (under the Right bar content). You will see that the press event is calling reloadListBooking. ListBooking is the result list under PageBook2.

54c9600bdac85e477a9eb50423cf77f8.png

The ListBooking General tab has connected the Model Source IT_SBOOK and has an AJAX_ID UI5_GET_BOOKING. Notice that we have checked the prevent reload at initialization so that the result list is only fetched when the user press the search button. To pass our selected input values to the server we also sendthe model PageBook1 (This will pass the GLOBAL structure to the server which now includes our selected inputs)

b68d2df915fd425a87c128e0e2a1b406.png

We wish to navigate to this page AFTER the ajax call is successfully completed. So we add the navigation script to the ajaxSucess method in the attribute tab

b004cf5255c0614b5489b41eb88f366b.png

On the server side you can see that the Handle_On_Ajax method with the UI5_GET_BOOKING calls the SEARCH_BOOK method and uses the GLOBAL inputs to do a simple select and filling the IT_SBOOK internal table.

1e5c173fec605a37dfa2ad640b994822.png

The attributes of the StandardListItem is bound to data we wish to show

c66e416c57f08b8934cd300f9b210b64.png

And your result should look like this

b81d30d56927449a3d2854cecfe16a6f.png

We have now gone through the fundamentals of how the SAPUI5 navigation and models work with the Neptune framework. Remember to send any issues tosupport@neptune-software.com. Happy SAPUI5 coding!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值