SAP UI5 interview questions and answers

1.What is SAPUI5?

Ans: Just like any other HTML5 client-side rendering library SAPUI5 is also one. SAPUI5 strictly follows RIA (Rich Internet Application) standards. It is based on JavaScript which provides a lightweight programming model for desktop as well as mobile applications.

2.Explain the Navigation concept in SAPUI5?

Ans. SAPUI5 uses two mechanisms for navigation in applications that are EventBus and Routing where latter supersedes since SAPUI5 is the class used for the routing. We define routing in components metadata in the “routing” key.

3.What is the difference between HTML5 and SAPUI5?

Ans: HTML5 is a markup language, It doesn’t have programming capabilities but SAPUI5 is a framework that is based on the MVC approach to building web applications. HTML5 is mainly for the purpose of creating a simple webpage without formatting and logic but UI5 provides standard style and components to build rich UIs.

4.When and How to use formatter in SAPUI5?

Ans: We need to use formatter when we need to perform some changes on the back end property data on the front end.
we can use formatter while data  binding to a property like as follows:

5.What all types of data models available in SAPUI5?

Ans: As SAPUI5 follows MVC(Model-View-Controller) there model plays crucial role in the framwork. SAPUI5 has following predefined four data models available:

  • JSON Model – Client-side model, supports two way binding.
  • XML Model – Client-side model and intended for small data sets this is very rarely used model.
  • Resource Model – This is also client side model used to maintain resource bundles, specially texts.
  • ODATA Model – This is most important model of the four provided. This is server side model, supports two way binding ODATA model currently supports ODATA version 2.0.

6.What all types of views are available in SAPUI5?

Ans: There are following predefined three types of view available in SAPUI5:
1. JSON view
2. JavaScript View(JS View)
3. HTML View

7.What all design patterns are recommended/available in SAPUI5?

Ans: SAP recommends following application design patterns keeping in mind design consistency of the applications:

  • Master-Detail
  • Master-Master-Detail
  • Fullscreen
  • Fullscreen-Fullscreen-Master Detail (Multi Flow)

8.What are the Lifecycle methods of the SAPUI5 views controller?

Ans: There are four Lifecycle methods available in every SAPUI5 view controller.

These are

  • onInit()
  • onExit()
  • on after rendering()
  • on before rendering()
  • onInit is called when a view is instantiated and its controls (if available) have already been created;
  • onExit is called when the view is destroyed, used to free resources and finalize activities;
  • on after rendering when the view has been rendered and therefore its HTML is part of the document;
  • on before rendering is called before the controller view is re-rendered and not before the first rendering.

9.What are the SAPUI5 Fragments?

Ans: Fragments are very lightweight UI controls and part of another UI. Fragments are not completely like views but they act as a view. Fragments are defined similar to views and are names like “myFragment.fragment.xml“.

10.What is SAPUI5 Bootstrapping?

Ans: SAPUI5 Bootstrapping means loading and initializing SAPUI5 on any HTML page. The most important library or resource loaded in SAPUI5 bootstrap is “sap-UI-core.js”. Apart from this theme for the application, SAPUI5 libraries, etc are declared in the bootstrapping.

11.What is the difference between SAP Fiori and SAPUI5?

Ans: SAP FIORI is a collection of standard applications based on SAPUI5 library provided by SAP. SAP FIORI applications share some standard design guidelines and the way in which these applications are developed.

12.Why SAPUI5 instead of HTML5?

Ans.- As HTML5 world is the new age front technology across all aspect of internet applications SAP was kind of trailing in this age because SAP was using age old WebDynpro for building SAP Web Applications which lacks in rich and user-friendly UI. SAP identified this and came up with its own custom HTML5 library i.e. SAPUI5.

13.What is the main difference between HTML5 and SAP UI5?

Ans.- HTML5 is a markup language and it doesn’t have programming capabilities but SAP UI5 is a framework which is based on MVC approach to build web applications. HTML5 is mainly for the purpose of creating a simple webpage without formatting and logic but UI5 provides standard style and components to build rich UIs.

14.What is the syntax to define a control in UI5?

Ans: var obj_name = new sap.m.ControlName(“id of control”,{ properties, events, aggregations });

15.Which control libraries are used for UI5 application development?

Ans: sap.ui.commons, sap.ui.table and sap.suite.ui libraries for desktop application development and sap.m library along with sap.ui.layout for Fiori application development.

16.What is required to start UI5 development in eclipse?

Ans.- We need to import SAP UI5 toolkit from HANA service marketplace. Also, we need SAP UI5 ABAP Repository connector to deploy the project in ABAP System.

17.How to know the web browser of the client on which SAP Fiori application is running using SAP UI5?

Ans.- SAP UI5 library provides a special API “sap.ui.Device“ which can be used to for device and its feature detection. This API provides flags like “chrome”, “firefox”, “mozilla”, “edge” etc. in “sap.ui.Device.browser” API which returns boolean values.

18.How to know that device is Touch Screen or not?

Ans.- SAPUI5 library provides a special API “sap.ui.Device“ which can be used to for device and its feature detection. This API has a flag “sap.ui.Device.touch” which returns true if device is a touch screen otherwise false.

19.Can we add our own controls to UI5?

Ans.- Yes, we can add custom controls by creating definition of it from scratch. To define a custom control we use sap.ui.control.extend and to enhance a standard SAP UI5 control we use sap.ui.commons.controlname.extend.