Top 50 Sap Ui5 Interview Questions You Must Prepare 26.May.2022

  • onInit – an event that is called when the view and the controller are instantiated
  • onExit – an event that is called when the view and the controller are destroyed

The service metadata document describes the structure of all resources in the service. This structural metadata makes it easy to understand a service. We can explore service metadata at the address “$metadata” relative to the service root.

To display dialogs and popup controls over the application UI

To make parts of your view reusable

  • By creating multiple filters and concatenating them either with AND or OR
  • By creating a single sap.ui.model.Filter object and specifying a path, an operator, and up to two values

  • An array with the data in the JSONModel that you want to bind to the list
  • A template list item to be cloned
  • A bound list control

Following are some of the service metadata annotations which are common and a front end developer must know these in order to understand the service and integrate it:

  • edm:EntityContainer
  • edm:EntitySet
  • edm:EntityType
  • edm:Property
  • edm:NavigationProperty
  • edm:AssociationSet

  • Extend an existing control with your own features.
  • Create a composite control that reuses existing controls internally.
  • Extend the sap.ui.core.Control base class and build a new control.

An independent and reusable part that can be used to structure SAPUI5 applications

A standalone unit testing library for JavaScript that provides spies, stubs, and mocks

Call QUnit.test() in your test code with a speaking test description and a callback that contains at least one assertion.

They are representations of states such as success, warning, and error.

  • The dialog instance is returned when you invoke the fragment factory.
  • The dialog is instantiated but not displayed.

To generate an initial set of files that serve as the starting point for the development of a productive application

The PullToRefresh control: It is represented as a simple button on non-touch devices, but the user needs to pull the page content down on touch devices to refresh it.

SAPUI5 uses data binding to bind two data sources or information sources together to keep them in sync. This means: All changes in one source are also reflected in the other one.

Fragments are very light weight UI controls. Fragments are not completely like views but they act like a view. Fragments are defined similar like views and are names like “Fragment.fragment.xml“.

  • Run your app from SAP Web IDE and copy its URL into a new browser tab.
  • In your app's manifest.json file, go to “services”, copy the URI, and use it to replace the file path in the URL from Step @
  • Append “/$metadata” and press enter.

It is the first point of the application, it serves as an index, which encapsulates all the application details, like  view names, routing details, main view, applications type(Full Screen or SplitApp), application service configuration etc.

There are 2 types of compponents:

  1. Faceless components: Mainly without UIs, Used for business logic and helper methods e.g. Formatters.
  2. UI Component: typically component.js file which is made by extending sap.ui.core.UI Component class.

 

Set the “visible” property of the control to “true” or “false”.

  • Use subdirectories for related views and controllers.
  • Use fragments to define reused UI parts only once.
  • Put the functionality used in multiple controllers into a base controller and extend this controller in the other controllers in your app.

  • Hash-based navigation adjusts the current hash to your interactions with the app, so that the URL can always be bookmarked.
  • It allows you to build one-page apps where the contextual navigation is done by changing the hash, so the browser does not have to reload the page.

  • A test suite that calls all your unit and integration tests
  • Clear separation of test and production code
  • Unit test setup (QUnit) and basic test coverage

Sap uses two mechanisms, routing and EventBus. Routing Is specifically used for bookmarking the URL. We define routing in component.js within the metadata. It also defines the navigation path and hash changer which is used at the runtime to change the url of the particular screen.

  • To clearly separate concerns according to the MVC concept.
  • To make your code much easier to read and maintain
  • To enable your code to dynamically load resources as they are needed

The SAPUI5 version must be available in your target deployment system.

  • It hides less important columns.
  • It displays less important columns as a "pop-in"; it stacks them vertically inside the row making the table larger in height.

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.

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:

oControl = new sap.ui.commons.TextField({
value : {path : “/path”, formatter : function(oEvent){
return “Value:”+oEvent;
}}});

Fragments are created without controllers, they don’t have their own controllers they share controller of the view which is invoking it.

SAPUI5 has following predefined four data models available:

  1. JSON Model: Client-side model, supports two way binding.
  2. XML Model : Client-side model and intended for small data sets this is very rarely used model.
  3. Resource Model : This is also client side model used to maintain resource bundles, specially texts.
  4. ODATA Model : This is most important model of the four provided.

When you realize that you need to reuse this code in several other places and views in your app.

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.

  • By selecting the run configuration Run Unit Tests
  • By right-clicking the unitTests.qunit.html file and selecting an option from the Run menu

Call the getSource() method at the event object parameter.