Skip to Content
Technical Articles
Author's profile photo Abyson Joseph

Dropdown List in Fiori Elements

Adding a dropdown list in a Fiori Element based app is somewhat tricky before. We had a requirement in our project and have checked all these blogs, and one could normally find the solution as redefining the method of class MPC_EXT, as mentioned in the blog

https://blogs.sap.com/2016/04/16/how-to-build-a-drop-down-list-using-smart-template-cds-view/#jive_content_id_Step1_Create_a_simple_CDS_view_to_hold_status_code_and_status_description

But we can simply achieve this with an annotation.

@ObjectModel.resultSet.sizeCategory: #XS

 

Most of you might know how to use this, anyways I shall just explain it for a quick understanding for newbies.

Here we are bringing the dropdown list as a filter in a List Report.

Add the mentioned annotation in the CDS which will be consumed as a valueHelp for the respective filter in List Report.

 

Association is added in the Main CDS where the above CDS is consumed.

Valuehelp is assigned inside select.

 

Mentioned as selectionField in  Metadata Extension. This can be mentioned in CDS also as shown above.

 

Generate application and Execute. The filter field is displayed as Dropdown List.

 

 

Assigned Tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nabheet Madan
      Nabheet Madan

      thanks for the good tip.

      Author's profile photo Vamshi Jangama
      Vamshi Jangama

      Thanks for the great tip.

      Author's profile photo Jan Nyfeler
      Jan Nyfeler

      What version is required for @ObjectModel.resultSet.sizeCategory-Annotation? This is not working for me, resultset is not recognized.....

       

      Author's profile photo Luc Olivier
      Luc Olivier

      Hello,

      Same for me. I followed the simple instruction and it doesn’t work ?

      I’m using Web IDE of SCP… Obvioulsy latest version of SAP UI5 lib.

      I have a nice liveSearch result when I enter something but no Dropdown.

      Thanks for any advice,

      Luc

      Author's profile photo Vladyslav Andrieiev
      Vladyslav Andrieiev

      the annotation (@ObjectModel.resultSet.sizeCategory:#XS ) works only starting from NW 7.52 version for S/4HANA – version 7.51 does not support this annotation

      Author's profile photo Vladyslav Andrieiev
      Vladyslav Andrieiev

      the annotation (@ObjectModel.resultSet.sizeCategory:#XS ) works only starting from NW 7.52 version for S/4HANA – version  7.51  does not support this annotation

      Author's profile photo Luc Olivier
      Luc Olivier

      Hi Vladyslav,

      Thanks for your answer. I'm working on SAP Web IDE and deploying on SCP. The current version is 1.64. You means that I need S/4Hana and not only SCP ?

      Luc

      Author's profile photo Vladyslav Andrieiev
      Vladyslav Andrieiev

      Hi Luc,

      1.64  it is UI5 version for front end part

      NW 7.52   it Back ends part ( for CDS annotation @ObjectModel.resultSet.sizeCategory:#XS) .

      you could check version list on

      https://sapui5.hana.ondemand.com/versionoverview.html

      Author's profile photo Luc Olivier
      Luc Olivier

      Hi Vladyslav,

      Thanks now I got my mistake...

      The UI annotations of the CDS View are calculated (rigth word ?) with SADL (is it true) of the Backend system, not the Gateway/SCP one...

      In our case, we are in 7.50. That's crystal clear 🙂

      Luc

      Author's profile photo Jocelyn Dart
      Jocelyn Dart

      Thanks Abyson- I've added this blog to the Fiori elements wiki.

      Author's profile photo Jaewon Oh
      Jaewon Oh

      thanks a lot~

      Author's profile photo Olga Becker
      Olga Becker

      Hello.

      I want to show more than 100 entries in the drop-down list.
      I've tried this: @ObjectModel.resultSet.sizeCategory: #S
      Unfortunately, no success.
      The annotation ObjectModel.resultSet.sizeCategory expects a String(3), but #S has the length 2.

      Can someone help me there?

       

      Olga

      Author's profile photo Mio Yasutake
      Mio Yasutake

      Thanks for sharing this!

      Author's profile photo Archana Palani
      Archana Palani

      I have explored it , It works fine ! Thanks for sharing...

      But dropdown only shows first 100 columns , can you suggest to show all the items in dropdown box ?

       

      Author's profile photo Joao Mariano
      Joao Mariano

      Very good. You saved my week! Thanks

      Author's profile photo Nooruddin Bohra
      Nooruddin Bohra

      Thanks alot for the efforts, it helped me. Just one additional requirement.

      I have key and text, my requirement is to display the text but when the call is made to Backend in filter I should get the key.

      I'm not getting description if I map only code

       

       

      Author's profile photo Patrik Spiess
      Patrik Spiess

      Hi. I have exactly the same requirement. Key and value should be displayed.

      Author's profile photo Nooruddin Bohra
      Nooruddin Bohra

      Hi Patrik,

      I've found the solution to it; it was pretty easy actually. Need to assign text element to the value field in the CDS.

      It will display "Description" but store/transmits "Value".