Top 50 Sap Ui5 Interview Questions You Must Prepare 23.Jul.2024

Q1. Name Some Standard Controller Hooks In Sapui5?

  • 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

Q2. What Is Metadata Annotations?

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.

Q3. What Is The Purpose Of The "static Area" In The Dom?

To display dialogs and popup controls over the application UI

Q4. What Are Fragments Primarily Used For?

To make parts of your view reusable

Q5. How Can You Compose Filters In Sapui5?

  • 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

Q6. What Do You Need If You Want To Bind A List To Data In Your Jsonmodel?

  • 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

Q7. What Are Common Metadata Annotations?

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

Q8. Which Of The Following Namespaces Can Be Used In The Manifest.json File?

  • sap.ui5
  • sap.app
  • sap.ui

Q9. Which Options Are Available In Sapui5 If You Want To Create A Custom Control?

  • 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.

Q10. What Is A Component Within Sapui5?

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

Q11. What Is Sinon.js?

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

Q12. How Do You Register A Unit Test In Qunit?

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

Q13. What Are Semantic Colors In Sapui5?

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

Q14. What Happens When You Instantiate A Dialog From A Single-rooted Fragment?

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

Q15. What Is The Correct Sequence Of Called Functions / Handled Callbacks Of The Odata Model In The Add Controller?

on metadataLoaded - createEntry - submit - on success

Q16. Which Property Of The Routing Configuration In The Manifest.json File Should You Use To Automatically Display A Target That Is Not Found?

Bypassed

Q17. What Information Can Be Stored Inside The Manifest.json File Of Your App?

  • Content densities
  • Root view
  • Models of your app

Q18. What Is The Role Of The Application Template In The Development Process?

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

Q19. Which Control Adapts Its Appearance On Touch Devices?

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.

Q20. What Is The Benefit Of Data Binding Within Sapui5?

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.

Q21. What Are Sapui5 Fragments?

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“.

Q22. Which Of The Following Sequences Of Steps Do You Use To Assemble The Url To Access Your Odata Service's Metadata?

  • 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.

Q23. What Is Component?

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.

 

Q24. What Is The Best Practice For Showing Or Hiding An Sapui5 Control At Runtime?

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

Q25. How Would You Add An Icon From The Sapui5 Icon Font To A Button In An Xml View?

<Button text="Save Draft" icon="sap-icon://save" />

Q26. Name Some Semantic States In Sapui5?

  • Positive
  • Negative
  • Critical

Q27. What Is The Correct Syntax For Defining Namespaces In Xml Views?

xmlns:m="sap.m"

Q28. What Can You Do To Structure Your Application Code Better?

  • 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.

Q29. Where Are Filters Applied In Sapui5?

To an aggregation binding

Q30. Which Benefits Does The Hash-based Navigation In Sapui5 Offer?

  • 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.

Q31. Which Of The Following Are Part Of The Control Metadata?

  • Aggregations
  • Properties
  • Events

Q32. Which Testing Features Are Provided By The Sap Fiori Worklist Application Template?

  • 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

Q33. How Navigation Works In Sapui5?

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.

Q34. Why Is Not All Javascript Code Put In A <script> Tag Directly On The Index.html Page?

  • 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

Q35. What Is The Recommended Place To Configure A "twoway" Binding For The Odata Model So That Data Changes In The View Are Written Back To The Model?

In the "models" section of the manifest.json file

Q36. What Do You Have To Consider When Choosing The Sapui5 Version For The Application Template?

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

Q37. What Do You Have To Do To Be Notified When The Hash Has Changed To A Certain Pattern?

Register to the patternMatched event of the route.

Q38. How Can Sap.m.table Behave On Smaller Devices Such As Phones And Tablets?

  • 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.

Q39. Why Sapui5 Instead Of Html5?

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.

Q40. What Is Formatter In Sapui5 And How To Use It?

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;
}}});

Q41. Does Fragment Have Its Own Controller?

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

Q42. How Many Types Of Data Model Are Available In Sapui5?

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.

Q43. Which Predefined Sizes For Margins That Stand For 8px (0.5rem), 16px (1rem), 32px (2rem), Or 48px (3rem) Are Available In Sapui5?

'Tiny', 'Small', 'Medium' or 'Large'

Q44. When Should You Put Code From Your View Into A Separate View Or Fragment And Nest It Into The Original View?

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

Q45. How Many Filters Can You Apply On A List Binding?

As many as needed

Q46. What Is The Main Difference Between Html5 And Sap Ui5?

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.

Q47. Which Filter Operation Can You Use To Filter Items With A Numeric Value Lower Than X?

sap.ui.model.FilterOperator.LT

Q48. How Are Unit Tests For Your App Started In Sap Web Ide?

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

Q49. How Can You Access The List Item Control In An Event Handler For The Press Event?

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

Q50. How Do You Enable The Debugging Option For Sap Netweaver Odata Services?

Use the URL parameter sap-ds-debug=true.