cancel
Showing results for 
Search instead for 
Did you mean: 

date in filter option of the sapui5 list report

ssd_deshmukh1210
Explorer

Hi Experts,

I have created sapui5 list report using list report template, i have one field "As on Date" in the selection fields of the report. this fields is showing as Multiinput instead of Datepicker on the screen. I want to show that field in

- There is no annotation coming from backend system.

- filed is type date (Edm.DateTime) in the backend.

- in metdata file i have maintained sap:display-format="Date" property

-Metadata file:

<Property Name="Dmdt" Type="Edm.DateTime" Nullable="false" Precision="7" sap:label="As on date" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:display-format="Date"/>

I want to show field as Datepicker.

Please suggest way forward.

Regards,

Saurabh

former_member228602
Contributor
0 Kudos

Hello Saurabh,

I checked the smart filter bar code and it looks for display-format annotation. Can you share the snippet of the code to check further.

Thanks and Regards,

Veera

ssd_deshmukh1210
Explorer
0 Kudos

Hi,

Below is the snippet:

this is my metadata file:

I have added display-format ="Date" for date field but it is not showing me 'Datepicker' on the selection screen

Accepted Solutions (0)

Answers (4)

Answers (4)

Hi,

As Mark Castle mentioned, you can use filter restrictions. If you want to show a date picker instead of date range selection, use filter-restriction value as Single.

Sample CDS annotation:

Common.FilterExpressionRestrictions: [{ Property: <your Date Field>, AllowedExpressions: #SingleInterval } ]

hope it helps.

Regards,

Vinod

mdcastle
Active Participant

(In case anyone stumbles across this in the future)

If this is the type of field you are looking for it can be achieved by adding an additional annotation via a redefinition of the DEFINE Method in the implementing class.

DATA: lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
      lo_property    TYPE REF TO /iwbep/cl_mgw_odata_property,
      lo_annotation  TYPE REF TO /iwbep/if_mgw_odata_annotation.

super->define( ).

lo_entity_type = model->get_entity_type( iv_entity_name = 'ZSomeODataServiceType' ).
lo_property ?= lo_entity_type->get_property( iv_property_name = 'SomeDateField' ).

CALL METHOD lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation
  EXPORTING
    iv_annotation_namespace = /iwbep/if_mgw_med_odata_types=>gc_sap_namespace
  RECEIVING
    ro_annotation           = lo_annotation.

lo_annotation->add( iv_key = 'filter-restriction' iv_value = 'interval' ).

0 Kudos

If you want to show a date picker instead of date range selection, use filter-restriction value as 'single-value'.

gabriel_alves
Explorer
0 Kudos

Hello,

I'm with this very same problem. I created both annotations "display-format" and "filter-restriction" to my DateTime field and my smart filter does not change.

Any solutions?

former_member512938
Participant
0 Kudos

Hello Saurabh,

Did you figure it out ?

Thank you mate !

Olivier