Enter dates in your SAP Fiori Elements App without actually entering dates
Here I am, writing my first blog post. Here I am trying to share a Fiori Elements app feature, which I discovered recently.
Do you know you can use words like ‘now’, ‘tomorrow’, ‘today’, ‘yesterday’, ‘next month’, ‘next year’ etc. in a Fiori Element App Preview while entering values for date and timestamp fields without any additional implementation. This may come handy while testing RAP generated oData services through Preview Tool URLs. If you are new to RAP/Preview Tool URLs, please refer Getting Started with RAP.
Here is the list of all the words and how you can use these:
Open your Service Binding in ADT and select the entity which has date/timestamp fields enabled for CREATE mode. Hit Preview button in ADT to launch Fiori Elements App preview and then hit Create button in Fiori App Preview
Please note that all the screenshots were captured on April 5th, 2021 so all the next/previous dates are with reference to April 5th, 2021.
- Enter ‘today’ in your date field
Hit Enter to see it picking today’s date automatically
- Similarly, input ‘yesterday’
Hit Enter
- Input ‘tomorrow’
Hit Enter
- Input ‘now’
Hit Enter
- Input ‘next week’
Hit Enter
- Input ‘next month’
Hit Enter
- Input ‘next year’
Hit Enter
- Input ‘last week’
Hit Enter
- Input ‘last month’
Hit Enter
- Input ‘last year’
Hit Enter
Same also applies even to the Timestamp fields i.e. it adds respective date value and appends ‘current’ time value to it
- Input ‘today’
Hit Enter
- Input ‘yesterday’
Hit Enter
- Input ‘tomorrow’
Hit Enter
- Input ‘now’
Hit Enter
- Input ‘next week’
Hit Enter
- Input ‘next month’
Hit Enter
- Input ‘next year’
Hit Enter
- Input ‘last week’
Hit Enter
- Input ‘last month’
Hit Enter
- Input ‘last year’
Hit Enter
Data Element behind attribute ‘Last Changed At’:
Data Element behind attribute ‘End Date’:
Screenshots attached are from ABAP Cloud trial environment, but same is also supported on On-Premise systems.
So, here is a quick summary of what have we learned – In order to enter some random/generic values in data/timestamp values in your SAP Fiori Elements App, you can also enter some generic keywords like ‘now’, ‘next week’, ‘last year’, ‘yesterday’ etc. Framework is intelligent enough to pick respective date and time as per the word entered, and this is in built and does not require any additional implementation. It usually saves time while we are testing our app, we won’t need to click each time on date/time picker to select a date/time.
Please do share this with you friend and colleagues.
Thanks for reading Hope you liked it.
Best Regards,