Create A Fiori App Using Eclipse
Create A Fiori App Using Eclipse
Products
Products Industries
Industries Support
Support Training
Training Community
Community Developer
Developer Partner
Partner
About
About
Home / Community / Blogs + Actions
SAP Fiori
share
0 share tweet share
Follow RSS
Overview
SAP introduced an HTML5-based development toolkit, SAPUI5, which
encourages one consistent user experience.
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 1/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
Apps built using SAPUI5 are responsive across browsers and devices –
they run on smartphones, tablets, and desktops.
UI5 is a client UI technology based on JavaScript, CSS and HTML5.
Servers come into play for deploying your applications, storing the
SAPUI5 libraries, and connecting to a database.
SAPUI5 supports the Model View Controller (MVC) concept.
Model: This is responsible for managing the application data in
the database/backend.
View: This is responsible for defining the user interface to users.
When a user sends a requests from his device, the view is
responsible for data view as per the request submitted.
Controller: is used to control the data and view events as per
user interaction by updating the view and model.
In this blog, we see, how we can create a UI5 application project and its
contents.
This blog is part of below parent blog:
SAP Fiori – Custom App Implementation
Pre-requisites
Eclipse having SAP UI5 Development Tool kit
For e.g. Eclipse Juno Service Release 2
1. Open Eclipse -> go to Menu ‘File’ -> select ‘New’ -> ‘other’
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 3/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
3. Enter Project name -> select Target device as ‘Mobile’ -> select ‘create
initial view’ its optional, it well create view on page -> click button ‘Next’
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 4/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 5/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 6/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
{
"listItems" : [
{
"title" : "Sales Reports",
"MATNR" : "000000000000202031",
"info" : "Overdue"
},
{
"title" : "Purchase Reports",
"MATNR" : "000000000000202033",
"info" : "Overdue",
"infoState" : "Error"
},
{
"title" : "Financial Reports",
"MATNR" : "000000000000202036",
"info" : "4 day ago"
}
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 7/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
]
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="I
<meta http-equiv='Content-Type' content='text
<script
id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 8/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
data-sap-ui-libs="sap.m, sap.ui.layout"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{
"ZTEST_APP": "./"
}' >
</script>
jQuery.sap.declare("ZTEST_APP.Component");
sap.ui.core.UIComponent.extend("ZTEST_APP.Component",
metadata : {
stereotype : "component",
"abstract" : true,
version : "1.0",
library : "ZTEST_APP", //requir
includes : [ "css/Styles.css" ], //CSS st
dependencies: { //external depen
libs : ["sap.m",
"sap.ui.commons",
"sap.ui.ux3",
"sap.ui.table",
"sap.ui.layout" ], //the lib
library : "sap.ui.core", //what librar
},
},
createContent : function() {
// create root view
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 9/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
// done
return oView;
}
});
10. Example:
In this UI5 App example, application will have a main page
which includes two buttons and one list control.
On click of 1st button, list get filled with
model/sapleData.json details
On click of 2nd button, navigation to 2nd page (Details) is
been done from 1st Main (Master) page
From 2nd page, back navigation to 1st page is also
handled.
Following are the details of each page
11. View ‘App’
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 10/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
sap.ui.jsview("ZTEST_APP.view.App", {
getControllerName: function () {
return "ZTEST_APP.view.App";
},
// create app
this.app = new sap.m.SplitApp();
return this.app;
}
});
Controller: ‘App.controller.js’
Here, two navigation functions are been defined,
to() function for Next page navigation
back() function is for back page navigation
sap.ui.controller("ZTEST_APP.view.App", {
/**
* Navigates to another page
* @param {string} pageId The id of the next page
* @param {sap.ui.model.Context} context The data
*/
to : function (pageId, context) {
/**
* Navigates back to a previous page
* @param {string} pageId The id of the next page
*/
back : function (pageId) {
this.getView().app.backToPage(pageId);
},
});
<core:View
xmlns="sap.m"
xmlns:core="sap.ui.core" >
<Page>
<footer>
<Bar>
</Bar>
</footer>
</Page>
</core:View>
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 12/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
Controller: ‘Master.controller.js’
here we can see three functions:
1. pressNextPage(): which will be invoked on press
event of button ‘NextPage’, to navigate to “Details”
view
2. pressGetMaterial(): which will be invoked on press
event of button ‘GetMaterial’, to fill list control with
data
3. call_MoldeFile(): which will be invoked from
function pressGetMaterial(), to read
‘sampleData.json’ file and fill fill list control with data
jQuery.sap.require("sap.m.MessageBox");
sap.ui.controller("ZTEST_APP.view.Master", {
pressNextPage: function(evt) {
//Navigation to detail page
var context = evt.getSource().getBindingConte
this.nav.to("Details", context); //to() is
},
pressGetMaterial : function(evt) {
this.call_ModelFile();
},
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 13/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
call_ModelFile: function(){
Controller: ‘Details.controller.js’
This has on back navigation function event backPress(),
which will be invoked on press button of ‘back’ icon in
‘Details’ page
sap.ui.controller("ZTEST_APP.view.Details", {
});
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 14/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 15/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
‘
9. Thus we have created one UI5 application sample which is accessing
data from model json file enclosed within project itself.
Alert Moderator
11 Comments
You must be Logged on to comment or reply to a post.
Former Member
Dear Dilip
Your series blogs are instrumental for beginners, very useful and informative.
I habituated to develop UI using drag and drop in webdynpro Java and ABAP, in fact it
was developer friendly. I feel managing MVC using the core code is a bit tough job
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 16/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
now, are there any tools to develop UI5 apps using drag and drop features.
Regards
Murali
Dear Former Member,
Dilip Pandey
Naoto Amari
Hello! readind deeper i found your courses ! is any problem if i use eclipe oxygen ? it’s
ok if i create the folder utils in the same level as model ???
Dear Naoto,
Sorry for delayed response, I was too much busy in my current project….
1. I have not used eclipe oxygen for Fiori App till now. I can only ensure
you for eclipse-Juno/Mars/Neon which I’ve used while app development.
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 17/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
2. You can create utils folder in same level as model, and then while
referring in .js pages, please change respective paths too like as below:
jQuery.sap.require(“FioriAppName.utils.connectivity”);
instead of
jQuery.sap.require(“FioriAppName.view.utils.connectivity”)
3. For 2nd point, I recommend you to follow view/utils only
Dilip.
Former Member
Not Found
Thanks Tomas M.
Dear Tomas,
Sorry for delayed response, I was too much busy in my current project….
Please correct your Fiori App Project Structure, it should be like below:
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 18/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
Dilip…
Former Member
Hi Dilip, many thanks for your answer. I corrected my project structure and working
ne, but… I created, registered and activated OData service in SAP. I try tested with
TCODE /n/iwfnd/gw_client and I think that is OK. But from Eclipse I see problem:
Can you help me again? Problem with user and password? Thanks from Czech Rep.
TomasM
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 19/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
While accessing from Eclipse, give below pre x , that will resolve Cross
domain issue.
proxy/http/<host>:<port>/<ui5 path>
instead of current path
But do not forget to remove pre x while uploading app in Fiori server.
Dilip.
Former Member
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 20/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
Nelson Kharat
Hi Dilip,
I could not nd the le Component-preload.js in the project and it is stating 400 error
when debugged with F12.
Please let me the know the code to be added into the le.
Thanks,
Nelson
Hi Nelson,
As above was a basic test app example, so I haven’t used it but kept it
blank to avoid 404 (not found) error found during debug.
https://blogs.sap.com/2015/04/27/performance-improvement-with-
component-preloadjs/
Dilip
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 21/22
8/27/2018 Create a Fiori app using Eclipse | SAP Blogs
https://blogs.sap.com/2017/11/19/sap-fiori-ui5-application-creation/ 22/22