cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving acceptable date format

Former Member
0 Kudos

I'm developing a script using SAP GUI Scripting API,

There are some fields on user's screen which must be filled with a date.

For some users, these fields accepts date in MM.DD.YYYY format, while for some others the accepted format is DD.MM.YYYY.

My question is: How can I know which date format is accepted by a GuiComponent in order to make the correct input?

Could not find any method or property in any component that could give me a clue.

(I'm having troubles with decimal values too, once I cannot determine if the separator is a dot or a comma, but I suppose solving the date problem may lead to solving this one too.)

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi Ycarus,

there are as always several solutions. One of these might look like this:

For example, is the date entered as follows:: 01.03.2011


. . .
on error resume next
session.findById("wnd[0]/usr/. . .").text = "31.12.9999"
if error.number > 0 or error.number < 0 then  
  session.findById("wnd[0]/usr/. . .").text = "03.01.2011"
else
 session.findById("wnd[0]/usr/. . .").text = "01.03.2011"
end if
on error goto 0
. . .

To find out whether a comma or a decimal point to be used as a separator, you could take a similar approach.

Regards,

ScriptMan

Edited by: ScriptMan on Mar 28, 2011 11:10 AM