Skip to Content

date in filter option of the sapui5 list report

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Jan 23, 2018 at 02:53 PM

    Hello Saurabh,

    Did you figure it out ?

    Thank you mate !

    Olivier

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 04, 2018 at 01:02 PM

    (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' ).


    capture.png (16.3 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 09, 2018 at 10:34 PM

    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?

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 15, 2018 at 10:18 AM

    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

    Add comment
    10|10000 characters needed characters exceeded