cancel
Showing results for 
Search instead for 
Did you mean: 

Specifying path of sap-ui-core.js using component.js

OliverMerk
Explorer
0 Kudos

Hi,

when using index.html, i am able to specifiy the path to sap-ui.core.js using

        <script id="sap-ui-bootstrap"

                   src="resources/sap-ui-core.js" ...

But if I integrate my UI5-App in the Fiori Launchpad and calling it by using the component instead of index.html,

how can specify the path of the ui5-ressources? (in case I would like to use a specific OpenUI5-Version instead of SapUI5).

Kind regards,

Oliver

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Oliver,

You may point your fiori launchpad to index.html instead of Component file.

Then you have ability to control sap-ui-core.js version from index file bootstrap.

In my case, I built my SAPUI5 app with version 1.32 in my local eclipse.

But my frontend server has only version 1.26. So my app didn't work on frontend server after deploy.

Above workaround solve my problem.

Best Regards,

Nuttakorn

OliverMerk
Explorer
0 Kudos

Hi Nuttakorn,

Thanks for your reply!

That's actually the same workaround which I am using currently.

But I guess there is a way to solve this without using the index.html. 🙂

Best Regards,

Oliver

Former Member
0 Kudos

Then we looking forward for another expert.  : )

OliverMerk
Explorer
0 Kudos

I hope there is a solution for the problem because using index.html for startup leads to further problems, for example I do not have access to sap.ushell.

And that means I can't use functions like bookmarking...

junwu
Active Contributor
0 Kudos

I don't think you can do that, the ui5 lib is loaded by the launchpad.

Answers (3)

Answers (3)

daniel_ruiz2
Active Contributor
0 Kudos

hi Oliver,

I don't think you can do it, unless you do some modifications on your own to have the library name not clashing.

When UI5 load "modules" (what is also referred as libraries) it also create a cache of "what modules are currently loaded" - and this is done using the library name, for instance, "sap.m".

As soon you Fiori Launchpad loads module "sap.m" (from sapui5) it sort of registers that already, and it won't (or shouldn't) load it again any other sap.m modules, in your case perhaps a specific version of openui5.

Worth mentioning, the "minVersion" does absolutely nothing, as you can see here openui5/Manifest.js at 9cad2b2cf6af9af074a4010dee416636a54a25d2 · SAP/openui5 · GitHub - so, you have a "dependency loader" based on a string and nothing else, which later would resolve into a requireJS module.

Unless you "rename" the ui5 libraries and make them available using the module structure (you would need to double check how it is handled in ABAP, I believe it could be slightly different from opeui5 code) you cannot use the "dependencies", because they are all taken.

You can however use the "resources" (manifest.json. sap.ui5.resources) and load the library just like the framework does for all other libraries, which you can find here: https://github.com/SAP/openui5/blob/9cad2b2cf6af9af074a4010dee416636a54a25d2/src/sap.ui.core/src/sap...

But once again, I think you will have "trouble" trying to run "sapui5 sap.m version A" and "openui5 sap.m version B" at the same time because ui5 does not load JS on the shim-shadow - reason why a "Component" in ui5 is not really a Component as one would expect it to be.

Hope this helps you somehow,

Dan.

Abdul_Waheed
Contributor
0 Kudos

By the time launchpad is loaded all SAPUI5 libraries available. your UI5 app can access those libraries.

If you need to access specific library follow Descriptor for Applications, Components, and Libraries


Create a file called manifest.json with in Web Content folder.


In your component declare the existence of the application descriptor by specifying manifest: "json" in the component metadata. Setting this flag makes the component load the manifest.json

file and read the relevant entries for SAPUI5.

This metadata is used to define the dependencies that need to be loaded in order to start the component. Example:

 sap.ui.core.UIComponent.extend("sap.samples.Component", { metadata  : { manifest: "json" } }

.

RameshShrestha
Contributor
0 Kudos

Hi Oliver,

You can download the specific version of openUI5 library and simply point to that library path.

Also adding library in component.js is similar to as you do in index.html.

This link will be helpful. Also I suggest you to create some sample project from template in WEB IDE. You will be able to see the complete structure of the fiori application for your understanding.

SAPUI5 SDK - Demo Kit

OliverMerk
Explorer
0 Kudos

Hi Ramesh,

Could you provide a sample of how to point to the library path within component.js or manifest?

I still can't see how to do this.

Thanks,

Oliver

junwu
Active Contributor
0 Kudos
Descriptor for Applications, Components, and Libraries

"dependencies": { //external dependencies

            "minUI5Version": "1.30.0" , //minimum version of ui5 dist layer

            "libs": { //used ui5 libraries

                "sap.m": {

                    "minVersion": "1.30.0" //minimum version

                },

                "sap.ui.commons": {

                    "minVersion": "1.30.0" //minimum version

                }

            },: Unique ID of a site

                                            (mandatory)

            "components": {

                "sap.ui.app.other": {

                    "minVersion": "1.2.0" //minimum version

                }

            }

        },