Task description
Solution | Sample code, images | Restrictions, R/3 Release, Sapgui version, GuiXT version |
6 Date comparison: before and after You want to compare the current date with a certain fixed date
Solution Let us assume that you want to distinguish between the time before November 7, 2001, and after. GuiXT only knows how to compare a variable with a value: The value can also be the content of a 2nd variable: if V[variable=&[variable2]] It is necessary to use the date format “year month day”, since GuiXT converts each string into a number before comparing it with “<” or “>”. So you can use the command if V[variable>&[today_ymd]] // Sample coding If the date field has a different format, e.g “d.m.y” like 22.04.2002, you can use string functions in order to obtain the right format: // F[Date] contains a date in format d.m.y set V[NewDate] “&F[Date](7-10)&F[Date](4-5)&F[Date](1-2)” Note: As of GuiXT version 2003 Q1 9, direct date comparisons and calculations are possible, see Tip 14 for an example. | Last update: August 2, 2002 | No restrictions
InputAssistant |