Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
geetharani31
Explorer

PrerequisiteSet up SAP Business Application Studio. 

Use: After completing this blog, you will be able to Load and initialize the SAPUI5 library to use SAPUI5 features.

Before we can do something with SAPUI5, we need to load and initialize it. This process of loading and initializing SAPUI5 is called bootstrapping.

Standard Bootstrap File

geetharani31_1-1708498876376.png

id :The id attribute of the <script> tag has to be exactly "sap-ui-bootstrap" to ensure proper booting of the  SAPUI5 runtime.
src : The src attribute of the <script> tag tells the browser where to find the SAPUI5 core library – it initializes the SAPUI5 runtime and loads additional resources.
data-sap-ui-theme: The SAPUI5 controls support different themes.

geetharani31_1-1708583451742.png

data-sap-ui-libs: We specify the required UI library sap.m, which contains the UI controls we need for this tutorial.
data-sap-ui-compatVersion: To make use of the most recent functionality of SAPUI5 we define the compatibility version as edge.

 

Load Options

SAPUI5 can either be loaded locally with a relative path from an SAP Web server like :"resources/sap-ui-core.js" or externally from a Content Delivery Network (CDN).You can point to a specific version in a CDN, which allows you to select a fixed version for bootstrapping. To do this, assign a versioned URL like the following to the src attribute in the bootstrap script: https://ui5.sap.com/1.96.16/resources/sap-ui-core.js

Make sure that the index.html page now looks like this:

geetharani31_1-1708587038566.png

 

Note: If you run your application standalone, the bootstrap script is added to your HTML page. In an SAP Fiori launchpad environment, the launchpad executes the bootstrap and no additional HTML page is needed to display the application.

Add a Text UI Element

  1. Delete the Hello World <div> tag you created in the previous Step
  2. Add the class="sapUiBody" and id="content" attributes to the <body> tag.                    geetharani31_1-1708586245169.png
  1. Now create a sap.m.Text UI element with the text Hello Word and place it in the <body> of the HTML page using the id of the <body>.
  2. For this purpose, create the following <script> tag as another child of the <head> tag directly behind the bootstrap script created above:

geetharani31_0-1708586192256.png

The head and body of the HTML page should now look like this:

geetharani31_0-1708586993751.png

 

Test run your application by starting it from the SAP Business Application Studio. Test run your application by starting it from the SAP Business Application Studio.

    1. Right-click on any subfolder in your project and select Preview Application from the context menu that appears.
    2. Select the npm script named start-noflp in the dialog that appears.

In the opened application, check if the Hello World text of the sap.m.Text UI element is displayed on the HTML page.

 

geetharani31_0-1709115492599.png

 

 

 

 

 

 

 

Labels in this area