on ‎2017 Jul 13 8:35 AM
Hi,
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
@Consumption.valueHelp:'_Result'
@ObjectModel:{foreignKey.association:'_Result',mandatory:true}
ZHEADER.qires,
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

Request clarification before answering.
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,
Catalin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Annotate your value help CDS view with
@ObjectModel.resultSet.sizeCategory: #XSThis will automatically create the fixed-values metadata annotation and shows a dropdown in Fiori Elements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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').
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.