cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Loading of SAPUI5 libraries

Former Member
0 Kudos

Hello all,

The design time of our project involves creating a SAPUI5 project in eclipse; and then we share the project in the SAP ABAP repository to create a BSP application.

Now, instead of loading all the library files(like sap.ui.commons, sap.ui.ux3) in the index.html; i am trying to load the the files on demand in my application code using the loadLibrary method provided by the sap.ui.core.Core. But it throws an error message "Uncaught TypeError: undefined is not a function".

Also, if i debug and watch the value of sap.ui.getCore().loadLibary("sap.ui.table"), it returns a correct response.

Have you encountered such issue?

Alternatively, i have tried using the jQuery.sap.require("sap.ui.table"), when i observe the Network in the debugger mode in Chrome I observe that the library files gets loaded but it gives the same error.

Regards,

Jagannathan R

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

An alternative method to load the libraries dynamically(instead of using the sap.core' loadLibrary()) can be done the following way:

jQuery.sap.registerResourcePath("","resources/");

jQuery.sap.require("sap.ui.table.Table");

Regards,

Jagannathan R

shrinidhi_k
Explorer
0 Kudos

Hi Jagannathan,

I am facing issue while loading the resource in dynamic way, using following code

jQuery.sap.registerResourcePath("com.abc.abd","http://hostName:port/path");

jQuery.sap.require("com.abc.abd");


its registering the "path" discarding the host-Name and port,only in fiori launchpad  please kindly help me


Regards,

Shrinidhi K.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

i am not sure, but have you tried giving the reference of the same file in mime.xml of ABAP repository?

or is that same file got loaded properly?

where as in ABAP repository, where ever you are giving reference the path should be like this"

../../../../../sap-ui-core.js"

regards,

Prasad.

Former Member
0 Kudos

Hi Prasad,

The BSP runtime is taking care of loading the sap-ui-core.js(bootstrap file). When the request originates from the index.html file; it gets loaded properly; but the problem is only with the dynamic loading.

Regards,

Jagan