cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use a common library in BAS development

0 Likes
3,030

Dear Experts,

I want to use common libraries (Controller, i18n etc ...) in BAS development. However, I'm in trouble because I don't know how to do it.

Regards,

rinn.

Accepted Solutions (1)

Accepted Solutions (1)

0 Likes

Hi,

If you already have the application and the reuse library you can have 2 options currently.

1. Where you only want to change the application code.

In this case if the reuse library has been deployed to the backend system to the UI5 Application Index it will be loaded automatically using startup of the application preview (assuming it includes the file `webapp/utils/locate-reuse-libs.js`). The library must also be referenced in the manifest.json of the application in the `libs` section.

2. Where you want to modify the reuse library code.

clone both the application and the reuse library to the workspace.

Link the reuse library to the application via the command palette command "Add Reference to SAP Fiori Reusable Libraries". Then follow the wizard steps. Then during application preview the resuse library will be served from the workspace.

0 Likes

Hi,

Thank you for the two options.

I'm grateful that option 2 was the one I wanted to do.

After trying it, I will report it again.

Best regards,

rinn.

0 Likes

Hi,

I tried option 2. However, the "Select Reusable Libraries" says "No reuse libraries or components found in the workspace".

Why wasn't it recognized as a "Reusable Library Source" ...

Reusable Library Source created and imported the library with WebIDE.

Best regards,

rinn.

0 Likes

This may occur in case the description in the manifest or i18n is missing. This will be fixed in the next release.

E.g. manifest['sap.app'].description

This wizard creates the entries Marian mentions in https://answers.sap.com/answers/13449154/view.html

Also, there is further documentation available for these options at https://www.npmjs.com/package/@sap/ux-ui5-tooling#3-serve-static

If you are stilling having problems with the wizard please create a customer support issue and send it to component CA-UX-IDE and attach a zip with the re-use library.

0 Likes

Sorry for the late reply.

The method is different, but the problem has been solved.

I'd like to be able to do it with the method you taught me, so I'll check this a little more.

Thank you very much.

Answers (2)

Answers (2)

Marian_Zeis
Active Contributor

We had the same problem.

We also transferred from WebIDE and the solution was relatively simple, to use the library from within your workspace:

Of course, the library must be referenced in the manifest.
Also, in your ui5.yaml an additional item under:

server:
  customMiddleware:
    - name: fiori-tools-servestatic
      afterMiddleware: compression
      configuration:
        paths:
          - path: /resources/namespaceoflibrary
            src: /home/user/projects/librarynfolderame/pointtolibraryjs


Sorry for the late reply.

It was helpful while searching for a way to achieve it. thank you.

I'm sorry I couldn't make it the best answer ...

But I really appreciate it!

Imran05
Product and Topic Expert
Product and Topic Expert
0 Likes
Worked like a charm for me. Thank you @Marian_Zeis for saving my day !!
yuval_morad
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi

In BAS there is no template.

What is your runtime environment? CF/ABAP?

0 Likes

Hi,

After all, there is no template ...

I'm using CF.

Best regards,

rinn.