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!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Date prompt:

User response to a date prompt can be got using webi function UserResponse (). However, the function returns a string value in accordance with the current locale’s regional settings.

For example, if we input for a date prompt,

We could get the user response in the report as below using the formula which is circled in the below screenshot,

To convert the string to date, todate () is used,

Date Todate (“string date”;”Date_format”)

If the region is uk for say, the date format should be dd:M:yyyy hh:mm:ss,

Todate (userResponse(“Date:”);” dd:M:yyyy hh:mm:ss”)

, as depicted below,

And to display the date in a standard required format, formatdate () function could be used.

If this report is run for us region (where languages in the regional settings will be English (US)), the report will throw an error as below,

Since the report is run in US region, the date returned by the userresponse() will be in the format, M/dd/yyyy hh:mm:ss A(as in the circled date in the above fig), which is in contradiction to the format that is used in the Todate() function in the Report(i.e.,dd/M/yyyy hh:mm:ss). Hence the server will throw an error on this.

A Report might be used in locations across globe. In that case, date prompts will return dates in the locale’s format. To make a report independent on the format (and correspondingly the locale), the dynamic formats can be used. The dynamic input formats are “INPUT_DATE_TIME”, “INPUT_DATE”.

So:

= ToDate(UserResponse("Date:");"INPUT_DATE_TIME")

, Where "INPUT_DATE_TIME" will return the date format of the current locale as per its regional settings.

Now, for the above report, INPUT_DATE_TIME can be used instead of giving the specific date format in accordance with the regional settings.

when there is a change in language to English (South Africa), whose date format is yyyy/mm/dd, as below

we could see the change in format of the date in the prompt value, as below,

But still we get the standard format in our required format because the dynamic format, returns the current locale’s format. This way, dynamic format works for any region irrespective of the variation in settings.

Hence, dynamic formatting is the simplest and efficient method used for making the date prompts independent on the locale.

5 Comments
Labels in this area