Showing results for 
Search instead for 
Did you mean: 

How to load sap.m library dynamically?

0 Kudos

Hi Experts,

I am facing one issue. I've developed one app using by SAP.M library.

After configuring into LPD_CUST. When I use the app, the button events are not working. because the sap.m library was not loaded when bootstrap initialized.

If I run the app separately as BSP file from server, it is working fine.

For Example, Find the attached image file. In that when I click on Sentiment Engagement tab, My App will be opened within the standard container.     

This is the bootstrap details of Home page container.

<script src="resources/sap-ui-cachebuster/sap-ui-core.js"



      data-sap-ui-libs="sap.viz, sap.ui.commons, sap.ui.ux3, sap.ui.table"





Does anyone know how to activate the sap.m library w/o placing it explicitly in data-sap-ui-libs attribute?

Thanks in advance.



Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello Sampath,

You can use sap.ui.getCore().loadLibary() function to load library at runtime.


Vishal Solanki

0 Kudos


I tried that too. but it didn't work. For your understanding,

the scenario is different what i'm facing now. Just you have a look on hybris marketing trail account.

In which they are loading the fiori launchpad within the container using iframe to load the fiori applications. so the same thing I want to do.

The shell container initially loaded with only sap.ui.commons library. When User navigate to fiori application link, the sap.m libarary should be loaded. I'm able to see the UI Design, but only the issue is, button events are not working.



Former Member
0 Kudos

Hello Sampath,

The Problem there is that the Buttons in the sap.m Library are only listening to touch events. When you don´t load the sap.m library at bootstrap time the emulation of touch events is not initialized and therefore the button gets no touch events.

You can use a workaround and add the tag data-sap-ui-xx-test-mobile="true" to your bootstrap to force the touch emulation without loading the sap.m library on bootstrap.



0 Kudos

Hi Florian,

The application has configured in LPD_CUST. So The app is loading from the component.js file. It doesn't consider the index file. kindly suggest me how to add that code to bootstrap from component.js file. is there any way?

Thanks & Regards,


Active Contributor
0 Kudos

Hi Sampath,

You can make use of function

For more info, check this: SAPUI5 SDK - Demo Kit


Sai Vellanki.

0 Kudos


Thanks for your time.

I tried already. is loading the js file like sap.m.MessageToast.

I can't load entire library even if I use, it is not reflecting.

Still the buttons events are not working.