Skip to Content

ABAP CDS Smart table: annotation to display either key or value


A field defined in a CDS as:

     @UI: {
          lineItem: {position: 30, label: 'Status' },
          selectionField: {position: 30 }
      @EndUserText.label: 'Status'
      @ObjectModel.foreignKey.association: '_Status'
      @Consumption.valueHelp: '_Status'
      Header.status_id                                 as Status

Will display a search help in the filter bar, which is great. the line item displays both the description and the key in brackets.

Draft (E0001)

I would like to choose which one to display, the key or the description. I hardly ever want both. Lists and tables tend to become real large if they have a lot of statuses or business partners (with names and search helps) in it. Standard width is modelled after key field width, which means all fields constructed this way are too small in a grid table.

If I leave out `@ObjectModel.foreignKey.association: '_Status'`, I get only the key.

I've had minor success duplicating fields, and trying to hide one from the filters, and the other from the table personalisation.

How do I get only the description?

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.