Skip to Content

Fixed value List with CDS annotations

Jul 13, 2017 at 07:35 AM


avatar image
Former Member


I'm creating a Fiori app using fiori elements/templates and CDS annotations.

One of the fields requires a search-help value list, This just needs to be a drop down list with PASS and FAIL in it.

I have created another view that returns a table with these results and then create a foreign key association and linked the field to the value help




This is working however the result is a two step search help (i.e. I click on the possible entries which brings up a dialog box where I then have to click go to show the list of entries as per below).

Is it possible to get the entries to appear as an immediate list similar to the one below?

Can this be done via annotations?

Any help much appreciated

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Chiuaru Catalin Jul 21, 2017 at 02:23 PM

Hi Andrew,

This is an feature which I am also interested in it. I think for now there is only the implementation approach available to define such dropdown list. See here:

I hope that sun there will be a ABAP CDS View Annotation which you can add to element level and define a field as dropdown list.

Kind regards,


10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 28 at 01:19 AM

Hi Vinay,

in the end I did manage to get the blog to work. You need to redefine the 'DEFINE' method of your model provider (MPC) class.

Here is a sample of the code (qires is the name of the field that I want to have the look up)

method DEFINE.

* Method-local declarations:

DATA lo_entity_setTYPE REF TO /iwbep/if_mgw_odata_entity_set.

DATA lo_propertyTYPE REF TO /iwbep/if_mgw_odata_property.

DATA lo_annotationTYPE REF TO /iwbep/if_mgw_odata_annotation.

*Call parent:

super->define( ).

lo_entity_set = model->get_entity_set( 'ZMYENTITYSET' ).

lo_annotation = lo_entity_set->create_annotation( 'sap' ).

lo_annotation->add( iv_key = 'semantics' iv_value = 'fixed-values').

DATA(lo_entitytype) = model->get_entity_type( 'ZMYENTITYSETType' ).

lo_entitytype->set_is_value_list( abap_true ).

data(lo_txt_property) = model->get_entity_type( 'ZMYENTITYSETType' )->get_property( 'qires' ).

lo_txt_property->set_value_list( /iwbep/if_mgw_odata_property=>gcs_value_list_type_property-fixed_values ).

data(lo_text_anno) = lo_txt_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).

lo_text_anno->add( iv_key = 'text' iv_value = 'to_result/qires').

lo_txt_property = model->get_entity_type( 'ZMYCDSLOOKUPVIEWType' )->get_property( 'qires' ).

lo_txt_property->set_value_list( /iwbep/if_mgw_odata_property=>gcs_value_list_type_property-fixed_values ).

lo_text_anno = lo_txt_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).

lo_text_anno->add( iv_key = 'text' iv_value = 'qires').


10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 10, 2017 at 01:54 AM

Thanks Chiuaru,

I've tried to follow this blog but can't get it to work. The the end I've had to extend the app and add a custom field and bind it to my CDS view field.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Andrew,

I'm trying to create the Value help as what you did in the above question. but unable to get the desired F4.

I'm fetching data from another CDS View which is working fine but when i use it as association in my Consumption View, it doesn't show up. Instead it shows the standard Search Help Window.

Can you please help me with the annotations required in Consumption View?