Why choose your own SAPUI5 Custom Controls?

The more SAPUI5 applications you develop, the more you get to know the limitations and restrictions. These are either the SAP Fiori Guidelines or the controls themselves. We quickly receive the statement in a client project: “Can’t this be implemented somehow?” Here, the quick answer is often that this is too expensive or not possible.

However, this does not have to be the case! Anyone who has ever dealt with SAPUI5 Custom Controls can quickly assess which requirements can be realised in no time at all, despite in-house development.

Don't Just Get Started

The first and most important to-do in client projects should be to inform those responsible that this particular requirement cannot be solved with standard SAP tools. Since companies often have policies regarding custom development, this needs to be clarified before starting the development of the Custom Control.

It also makes sense to provide information about the risks and consequences. Depending on which functionality the Custom Control provides or which existing controls it enhances, the functionality must be ensured during a SAPUI5 version upgrade. In the worst case, adjustments must be made to the SAPUI5 Custom Control so that it looks or behaves identically with the new SAPUI5 version.

Once the formalities have been taken care of, it’s time for the actual work. Here, it is important to understand exactly what is required of in-house development. The basics of creating SAPUI5 Custom Controls are highlighted below. In our next blog post, we will present two examples from our customer projects.

How to Create SAPUI5 Custom Controls

A Custom Control is initially very similar to a controller. The upper part defines which other controls are required or which files are to be imported. Based on one of the transferred controls, an extension is built using the “extend” function.

SAPUI5 Custom Controls

If no suitable control can be found that can be extended, the sap.ui.core.Control is used. This control is the basis for all other controls. The name of the Custom Control is composed of the namespace of the app and a specific name. To avoid confusion, the js file should also have the same name.
Another object is passed to the “extend” function where, for example, new properties or events can be defined. The important thing with any custom control is that the “renderer” function is present. The “renderer” function of the control to be expanded is often useful here. Alternatively, this must be written yourself (both types will be taken up in the further blog post).

Use of a SAPUI5 Custom Control

If the Custom Control is to be used within the view, the path and an abbreviation must first be defined, as with an additional SAPUI5 library.

In this example, there is a folder in the root path called “controls”. Inside this folder is a MyCustomControl.js file that mirrors the custom control. Within the XML, all inherited as well as all new properties, events, aggregations and associations are available. It can therefore be used like a normal control of the SAPUI5 library.

Adding More Properties

If a Custom Control requires another property, this is defined within the properties object. In the following example, the property is called “secondText” and is of the type “string”. A defaultValue can also be defined, which is an empty string here.

The familiar SAPUI5 types are available for properties:
  • string
  • boolean
  • int
  • float
  • any
  • object
  • arrays, for example string[]
  • spe­cial SAPUI5 types like “sap.ui.core.CSSSize” or other Con­trols
The DefaultValue is not a mandatory field and can therefore be left blank. The SAPUI5 framework automatically generates setter and getter methods from the new property. These can be used both within the Custom Control and within a controller. In our example, the generated methods are called setSecondText and getSecondText.

Adding More Events

If a Custom Control requires another event, this is defined within the event object. In the following example, two events have been defined: hoverIn and hoverOut, which are to react to the mouse cursor.

However, new events do not trigger themselves. Rather, they must be actively triggered. Since a MouseHoverIn and Out is desired in our example, the Custom Control must listen to the mouse events.

The SAPUI5 framework also generates new methods for events, which belong to the triggering (fire) of the event. This way, the browser mouse events can be listened to within the Custom Control and the own new event can be triggered (fired).

Conclusion

In this article it was shown that the advantages of Custom Controls compared to a detached jQuery or JavaScript component are enormous. SAPUI5 takes care of the rendering and the existing functionalities without anyone having to deal with it themselves. If existing SAPUI5 controls can be extended by properties or events so that the requirements are met, this can be realised with just a few lines of code. Even completely new Controls can be realised with simple HTML and CSS knowledge. Find out how this is implemented in our next blog post!

Written by Martika Möller

Share Post

More Exciting Topics from our Newsroom

Shortcuts for SAP BW in Eclipse

This blog post explains five simple shortcuts to make working...

Read More

Bavarian Curling with the BIG.Cube

BIG.Cube employees went bavarian curling together after work. Find out...

Read More

Data Quality in SAP BW: Checking Data for Plausibility without Programming

Our standard software Q-THOR can easily improve data quality in...

Read More

Q-THOR – Certified by SAP

SAP officially certified our standard software for increasing and ensuring data quality, ‘Q-THOR’, for use with SAP HANA 2.0 through the SAP inte­gration scenario HANA-APP 2.0. With this certification, SAP ensures that external providers’ solutions can be integrated safely into SAP land­scapes. The software can now officially be found in the SAP Certified Solutions Directory. You can find out which steps Q-THOR went through during the certification process and what the certification means for us and for our clients in the following blog post.

Q-THOR went through the following certification process

The following processing steps, among others, were requested and examined by SAP during the Q-THOR certification process:

Benefits of certification for (future) users

All these steps were passed success­fully and Q-THOR was thus certified by SAP at the end of the process. It was there­fore ensured and attested by SAP that Q-THOR can be installed without any problems. Further­more SAP confirmed that the software can be inte­grated seamlessly into the system landscape and Q-THOR runs reliably on HANA.
We are proud of this quality seal. Along­side to the product beeing available in the SAP store and the endorsement by the Federal Ministry of Education and Research, it is another accolade that recognises the quality of our product. This is how we generate real added value for our customers, because by using Q-THOR, we enable them to successfully handle the issue of data quality, a challenge that companies will be facing for decades to come.

Because of Q-THORs generic architecture, it also runs on non-SAP landscapes

Q-THOR wins users over with its completely generic architecture and can be easily integrated into any system and data landscape without altering these. The land­scape can be both SAP-based and non-SAP-based. The loading and inte­gration of data for Q-THOR can take many forms, depending on your system landscape and your availability require­ments, for example.

You want to read more about Q-THOR?

Share post

More exciting topics from our newsroom

Shortcuts for SAP BW in Eclipse

This blog post explains five simple shortcuts to make working...

Read more

Data Quality in SAP BW: Checking Data for Plausibility without Programming

Our standard software Q-THOR can easily improve data quality in...

Read more

Success story: Data Quality Management at MEAG with the Standard Software Q-THOR

Learn how MEAG has been ensuring successful data quality management...

Read more

A look back at the 4th Master Data Manage­ment Annual Forum

The 4th Master Data Manage­ment Annual Forum held by imh in Vienna provided interesting insights into the current status of the data infrastructure and data processes of companies from various industries. From data governance, through data lake and data mesh up to story­telling in data analysis; a variety of exciting topics were discussed in a number of presen­tations.

Data quality as one of the key topics

Data quality was one of the biggest and most important issues linking all the topics mentioned. This was made particu­larly clear by the fact that almost all of the presen­tations and discussions illus­trated the importance of data quality. The speakers’ and participants’ opinions were divided on only one point: where should the starting point for improving data quality be located? While some recommended a top-down approach in which the push has to come from management, the others favoured a bottom-up approach with the momentum coming from the specialist division and the users. Our product Q-THOR fits perfectly into the presentation ‘Data Quality as a Success Factor in Times of Explosive Data Volumes’.

Data-driven as the new goal

Those two days in Vienna made something very clear: Companies are always guided by their data and must gear their methods of working, processes and infra­structures towards it. Time and time again, companies condemn the fact that legislation in this area is lagging behind its fast-paced development. All of this poses huge challenges — in IT departments and in the specialist divisions that process data. One other thing also became very clear in Vienna: a company that is guided by data can only be successful if its data is correct. Data quality is therefore directly linked to corporate success.

Impressions from Vienna

Credits: © imh

Get in touch with us now

Share post

More exciting topics from our newsroom

Shortcuts for SAP BW in Eclipse

This blog post explains five simple shortcuts to make working...

Read more

Bavarian Curling with the BIG.Cube

BIG.Cube employees went bavarian curling together after work. Find out...

Read more

Data Quality in SAP BW: Checking Data for Plausibility without Programming

Our standard software Q-THOR can easily improve data quality in...

Read more