Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Dynamic Date is a very useful control within SmartFilter. Dynamic Date is possible ONLY within a SmartFilter. But it is very tricky to get this control to work. I got it to work recently and wanted to share this quick 'How To'.

Step 1.

Ensure that you have a SmartFilter control

Step 2.

Within the SmartFilter ensure that you have set property 'useDateRangeType="true"'.

Step 3.

Ensure that oData property is of type Edm.DateTime.

Step 4.

Ensure that the date oData property has below annotation

sap:display-format="Date" sap:filter-restriction="interval"

For setting these annotations you can write the below code in MPC_EXT class, DEFINE method.

super->define( ).    
DATA(lo_txt_property) = model->get_entity_type( <EntityType Name> )->get_property( <Property Name> ).
"DynamicDate Control
DATA(lo_text_anno) = lo_txt_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
lo_text_anno->add( iv_key = 'filter-restriction' iv_value = 'interval')
lo_text_anno->add( iv_key = 'display-format' iv_value = 'Date').

If you are using Fiori OVP

In the app's manifest/descriptor file
"sap.ovp": {//section for ovp-specific app descriptor settings
“useDateRangeType”: true, //Flag to enable or disable Dynamic Date. The default value is false.

“cards”: {
“card01”: {
Labels in this area