0

It is more or less clear how to implement a SAPUI5 control library and deploy it to SAP ABAP repository, however I am completely lost at attempting to reuse it in Web-IDE. Web-IDE just does not see the library deployed to SAP ABAP repository. Certainly I can always clone the library files into all the projects, but it is not a right methodology. Tried different variants of dependency path to no avail.

Does anyone have a clue?

Thank you.

slkorolev
  • 5,883
  • 1
  • 29
  • 32

2 Answers2

1

Finally, the problem's been solved. And this is how:

  1. First, in Web IDE I created a separate project for the library

  2. Under the root folder of the project I created another folder named "library" (name can be arbitrary). Under the "library" folder I created folder hierarchy according to the id (or namespace) of the library: suppose you are developing library with the name space "com.your_proud_company_name.controls", in that case you have to create a nested folder hierarchy corresponding to the path "com/your_proud_company_name/controls".

  3. I placed all my library files together with the properly written library.js file into the deepest folder ("controls" in the example)
  4. And now it's time to deploy the new project to the SAP HCP (in the local menu for the project select Deploy -> Deploy to SAP HANA Cloud Platform). When deploying you will be asked for the name of the application. Give an arbitrary name and note it somewhere. We will use it later. Also make note of the version of the deployed application (SAP will provide default number automatically - like 1.0.1)

  5. Now go to your app project where you plan to use this library and open the file neo-app.json

  6. Add the following entry to the "routes" list:

    {

       "path": "/webapp/resources",
       "target": {
           "type": "application",
           "name": "your_deployed_library_application_name", 
           "version": "version_of_your_deployed_library_application",
           "entryPath": "/library"
       },
       "description": "Custom control library"
    

    },

  7. In this "roots" entry "webapp" is the default name of the root folder of the app, if you are using some other name change the "path" value accordingly

  8. "type" value ("application" in our case) is one of the predefined types fo routes and is used for shareable applications.

  9. "name" value is the name of the deployed application (not the name of the project in Web IDE).

  10. "entryPath" value is the root folder in the library project (and application) where the HCP starts searching for library files.

  11. Now you can add the library as a dependency to the manifest.json file of your app project. The entry under "dependencies" should look like this (put your specific value into "minVersion"):

        "com.your_proud_company_name.controls": {
            "minVersion": "1.0.5"
        }
    
slkorolev
  • 5,883
  • 1
  • 29
  • 32
  • 1
    Hi, sorry to piggyback off your answer like this, but I have found a lot of answers like these and always hit the same issue. When I declare my library like this in the manifest.json, the network tab shows me that my library could not be found. The app looks for my library under https://openui5.hana.ondemand.com/1.52.5/resources/ instead of where I deployed the application. Have you had this happen to you? – Alex Eggers Dec 05 '18 at 14:53
0

Have you tried to setup the dependency in the manifest.json file ? Never tried your setup, but just a hint.

"dependencies": {
            "minUI5Version": "1.38.0",
            "libs": {
                "sap.ui.core": {},
                "sap.m": {},
                "sap.ui.layout": {},
                "YOUR_LIB": {}
            }
Francesco Iannazzo
  • 596
  • 2
  • 11
  • 31
  • Hi Francesco, yes, I did try that. Got an error "file library.js not found". – slkorolev Nov 22 '16 at 12:58
  • Ok, have you a library.js in your library ? Try to specify library also as required component in the manifest.json. From https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/0187ea5e2eff4166b0453b9dcc8fc64f.html libs: Path to the libraries that should be loaded by SAPUI5 core to be used in your component components: Full path to the components that should be loaded by SAPUI5 core to be used in your component – Francesco Iannazzo Nov 22 '16 at 16:00
  • Yes, I have library.js, and placed it into SAP ABAP MIME repository into a predefined path (similar to SAPUI5 path). And when I run the app from Web IDE it does not see it. – slkorolev Nov 22 '16 at 16:13