openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

Example of sap.ui.mdc.Table with OData V4 and annotation.xml

Open frazam opened this issue 1 year ago • 2 comments

What is the issue and how can we reproduce it?

Hello,

I'm new to OPENUI5 and would like to understand how to use sap.ui.mdc.Table with an OData V4 service.

In particular, I’ve created a SAPUI5 freestyle application and I’m trying to define the table columns using an annotation.xml file. Here’s an example from SAP Fiori Development Portal:

<Annotations Target="TravelService.Travel">
	<Annotation Term="UI.LineItem">
		<Collection>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="TravelID" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="BeginDate" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="EndDate" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="to_Agency_AgencyID" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="BookingFee" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="TotalPrice" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="CurrencyCode_code" />
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="Description" />
			</Record>
		</Collection>
	</Annotation>
</Annotations>

However, it seems that this feature (defining columns via annotations for sap.ui.mdc.Table in a freestyle app) might not yet be fully supported.

Could you please confirm if this is possible, and if so, provide an example or some guidance on how to set it up correctly?

Thank you very much for your help.

Best regards, Francesco

Which OpenUI5 version is your project targeting?

1.142

Is the issue device- or browser-specific?

No response

Confirmation

  • [x] I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
  • [x] I am not disclosing any internal or sensitive information.

frazam avatar Nov 09 '25 14:11 frazam

Hello @frazam , Thank you for sharing this finding. I've created an internal incident DINC0712195. The status of the issue will be updated here in GitHub.

50gY avatar Nov 19 '25 15:11 50gY

In combination with OData V4 it is recommended to use Fiori Elements for OData V4. Therefore, there are no samples showing direct usage of the sap.ui.mdc.Table or other MDC controls with OData V4. Please take a look at this blog post which provides guidance on when to use which part of the stack: https://community.sap.com/t5/technology-blog-posts-by-sap/smart-choices-for-your-ui-when-to-use-sap-ui-mdc/ba-p/13869819

You can use the Building Blocks of the SAP Fiori elements framework. For example, the Table Building Block. The documentation of the Table Building Block contains further links to samples, for example a Table with FilterBar. You may also have a look at the Learning Journey Developing an SAP Fiori Elements App Based on a CAP OData V4 Service.

JumpNRun avatar Nov 20 '25 09:11 JumpNRun