Skip to Content
1
Jan 04, 2023 at 06:36 PM

RAP: CDS annotations: @UI.lineItem.position / @UI.identification.position

424 Views Last edit Jan 06, 2023 at 04:41 PM 3 rev

When creating a Fiori app with RAP you have to give the two annotations above for every field. At least if you want a detail view.

This is tedious for views with many fields (even when using templates) and is cluttering the CDS views which makes them hard read.

Most of my use cases are

  • All fields of the view should appear
  • Order of fields in the app is the same as in the view

Is there a general annotation which refers to the whole view which handles this and spares the 2 annotations per field ?

From so:

define view entity z_test
as select from zt_test
{
@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
key kokrs as Kokrs,
@UI.lineItem: [{ position: 20 }]
@UI.identification: [{ position: 20 }]
finve as Finve,
@UI.lineItem: [{ position: 30 }]
@UI.identification: [{ position: 30 }]
vrwdg as Vrwdg,
@UI.lineItem: [{ position: 40 }]
@UI.identification: [{ position: 40 }]
versi as Versi,
@UI.lineItem: [{ position: 50 }]
@UI.identification: [{ position: 50 }]
waers as Waers,
.......

To so:

@UI.lineItem.position.allInOrderOfAppearance
@UI.identification.position.allInOrderOfAppearance
define view entity z_test
as select from zt_test
{
key kokrs as Kokrs,
finve as Finve,
vrwdg as Vrwdg,
versi as Versi,
waers as Waers,
.......