Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
OliverGraeff
Product and Topic Expert
Product and Topic Expert
4,895


Update July 19, 2023: The change described in this blog post has been postponed until further notice and will not happen in SAPUI5 1.118. In general, removing the usage of deprecated code stays a good practice to keep the framework and applications ready for the future.

Current situation


The table controls of the SAPUI5 sap.ui.table library provide shortcuts to define titles, footers, column headers, and cell templates for tables. If only a string is given for these aggregations, the table control creates the required text or label controls automatically using sap.m controls, as long as the sap.m library is loaded in the application. If not, the corresponding controls of sap.ui.commons are used.
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.ui.commons" 
xmlns:table="sap.ui.table" controllerName="myController" displayBlock="true">
<table:Table rows="{/data}" title="Title" footer="Footer">
<table:columns>
<table:Column label="Lastname" template="lastname"> </table:Column>
<table:Column label="Firstname" template="firstname"> </table:Column>
</table:columns>
</table:Table>
</mvc:View>

XML View Example



var oTable = new sap.ui.table.Table({
title: "Title",
footer: "Footer",
rows: "{/data}",
columns: [
new sap.ui.table.Column({
label: "Firstname",
template: "firstname"
}),
new sap.ui.table.Column({
label: "Lastname",
template: "lastname"
})
]
});

Code Example



What will happen with SAPUI5 1.118?


The sap.ui.commons library is deprecated as of version SAPUI5 1.38. To make SAPUI5 ready for future innovations, we plan to remove the support for the shortcuts in combination with the sap.ui.commons library with SAPUI5 1.118. Starting with this version, the table library will get a dependency to sap.m and always use sap.m controls for the shortcuts.

What does this mean for applications?


If your UI5 application uses the table controls from sap.ui.table without loading sap.m, the application might be affected by this change. To find out whether the sap.m library is already loaded in your application, open the UI5 Diagnostics window by pressing Ctrl/Cmd+Alt+Shift+S. You can find the information about "Loaded Libraries" in the "Technical Information" section in the support dialog that opens. If sap.m is not listed, it will be automatically loaded when using SAPUI5 1.118.



UI5 Diagnostics window



How to preview this change for testing purposes?


To preview and test whether this causes your application to behave differently, you may add sap.m already before using SAPUI5 1.118. This can be done, for example, in the SAPUI5 bootstrap or the metadata of your application component. In case you encounter issues with the shortcut definitions of the title, footer, column headers, or cell templates of the table, then you should replace them with explicit aggregated controls. The examples above will then look as follows:
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.ui.commons"
xmlns:table="sap.ui.table" controllerName="myController"
displayBlock="true">
<table:Table rows="{/data}">
<table:title>
<TextView text="Title" wrapping="false"
class="sapUiTableHdrTitle"/>
</table:title>
<table:footer>
<TextView text="Footer" wrapping="false"/>
</table:footer>
<table:columns>
<table:Column>
<table:label>
<Label text="Lastname"/>
</table:label>
<table:template>
<TextView text="{lastname}" wrapping="false"/>
</table:template>
</table:Column>
<table:Column>
<table:label>
<Label text="Firstname"/>
</table:label>
<table:template>
<TextView text="{firstname}" wrapping="false"/>
</table:template>
</table:Column>
</table:columns>
</table:Table>
</mvc:View>

XML View Example



var oTable = new sap.ui.table.Table({
title: new sap.ui.commons.TextView({text: "Title",
wrapping: false}).addStyleClass("sapUiTableHdrTitle"),
footer: new sap.ui.commons.TextView({text: "Footer", wrapping: false}),
rows: "{/data}",
columns: [
new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Firstname"}),
template: new sap.ui.commons.TextView({text: "{firstname}",
wrapping: false})
}),
new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Lastname"}),
template: new sap.ui.commons.TextView({text: "{lastname}",
wrapping: false})
})
]
});

Code Example


5 Comments
sebastian_schipplick
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Oliver,

Thanks for sharing this. You wrote "If sap.m is not listed, it will be automatically loaded when using SAPUI5 1.118." - is this going to happen really always (hard-coded) or only if "string-only aggregations" are used in the sap.ui.table?

Background of my question is that we are still using sap.ui.commons in a few productively used ~10 year old applications. And if sap.ui.table is loading sap.m this may (if I am not mistaken) also impact other (e.g. the "unified") controls, right?

There are plans to replace these legacy apps midterm - but this will still take > 1 year...

Thanks & regards,
Sebastian
jens_pflueger
Employee
Employee
Hello Sebastian,

thanks for giving us this feedback.

Yes, the table library will get the dependency to sap.m always because we want to benefit also from other code, utilities, etc. which already is available there.

You are right. This might have also an effect on other controls, e.g. Form.

I recommend to try out in your applications what the consequences are when you add manually the dependency to sap.m.

Please also think about whether for such old applications a switch from using always the latest UI5 version to some stable long-term maintenance version wouldn't be the better choice. UI5 1.108 is e.g. supported util Q4/2027 and should be available on Cloud until 2028, see https://sapui5.hana.ondemand.com/versionoverview.html

Thanks and Best Regards

Jens

 
sebastian_schipplick
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Jens,

Thanks for your reply. We tested it, and in our application the only thing which really looked odd was the FileUpload control.

So we go for UI5 1.108 for the Non-Fiori-UIs now, this looks good so far and should be fine assuming that we can get rid of the non-Fiori UIs until end of 2027...

Thanks & regards,
Sebastian
enryuu
Explorer
0 Kudos

Hi there,

i wanted to provide some feedback as well, not sure if this is the right location.

But in our use case we are using the the UI commons table for one sole reason and that is its capability to have easy provided access to filter, sort  and column movement controls.

Also we do not build for mobile and it is desktop specific application.

The sap.m.Table does not offer those controls that i am aware, yes you can add sorters but not in the same way the UI table provides them.

If the intend was to link UI common table to m library does that mean current functionality of UI table is preserved?

kind regards,

stephan

jens_pflueger
Employee
Employee
0 Kudos

Hello Stephan,

The table controls of the library sap.ui.table will also be available in future.

The library sap.ui.commons which contains basic bread and butter controls like Label, Text, Input, etc. is deprecated for a very long time and was replaced with the library sap.m.

The table controls of the library sap.ui.table work in principle with both of these libraries. But because of the deprecation of sap.ui.commons we need to stop some automatic build in functionality for sap.ui.commons controls in the tables.

If you are using the sap.ui.table tables in combination with sap.m controls already (for cell content, column headers, etc.), you are not affected by the change described above.

I hope this clarifies your question.

 

Btw., just because you mentioned it. You are right, the tables of the library sap.ui.table have for historical reasons a deeper integration for sorting etc like the sap.m.Table. For the sap.m.Table we follow a more open approach.

Here are 2 examples from our master branch which show how the same p13n scenario (Column Visibility, Column Width, Sorting, Grouping for sap.m.Table) could be handled with both table types:

https://openui5nightly.hana.ondemand.com/entity/sap.ui.table.Table/sample/sap.m.sample.p13n.EngineGr...

https://openui5nightly.hana.ondemand.com/entity/sap.m.Table/sample/sap.m.sample.p13n.Engine

 

Best Regards

Jens