What are SAPUI5 libraries, and how should developers use them?

If you want to get more serious about developing UI5 apps, you need to know how the libraries fit into the broader architecture, as well as their strengths and weaknesses.

The world of SAPUI5 libraries has begun to take off due to the joint attention of the software vendor's SAPUI5...

team and community. For customers and developers using SAPUI5, this opens up quite a few possibilities that either weren't possible or were only lightly documented previously.

SAPUI5 libraries make available a set of types, interfaces, controls and elements. You should already be developing your SAPUI5 apps as component-based apps, based on a component.js file described in your manifest.json descriptor file. This ensures your app is encapsulated and enables the app to be used in different contexts, including in a Fiori Launchpad.

But what if you want to enable reuse at a level lower than an application? Anyone who has developed multiple UI5 apps knows the scenario where several apps share a similar configuration of controls or business logic dictated by a business need, or where a custom control is needed. One often sees these controls or business logic duplicated between apps, violating DRY (don't repeat yourself) principles. Or, to avoid such duplication, apps are sometimes made to be extremely general, which results in a complex development effort.

An alternative to these scenarios is to encapsulate the duplicate parts of these applications into a library that all apps depend on. SAPUI5 libraries are the libraries SAP uses to structure the sets of reusable controls that it releases (sap.m is a library, for example), but customers can use SAPUI5 libraries to structure their own development as well.

You can get started by browsing libraries already published as part of the UI5Lab initiative. Members of the SAPUI5 community have also created detailed guides explaining how to create your own library. If you think your library might be useful to the larger community or may benefit from wider use and bug fixes, you can publish it as an open source project and register it with UI5Lab, or just use it for your own internal development.

Libraries are still a work in progress, so pay attention to the notes in the API documentation about how to structure your library so that it works well in the future. Libraries also don't necessarily work great for pure business logic, as they are more oriented toward controls. But if you are building a lot of UI5 apps and feel like you are becoming a more advanced UI5 development organization, it's time to start looking into SAPUI5 libraries and how they can become part of your development work.

Dig Deeper on SAP development and programming languages

Data Management
Business Analytics
Content Management