2023 Jun 21 12:31 AM
I Want to display dropdown list for entered date in selection screen.
the dropdown list should contain possible combination of dates(YYYYMMDD) which are possible.
example: 1123
output in dropdown list:
20230101
20110203
20110302
20120103
20120301
2023 Jun 21 9:30 AM
Is your question about the logic or about Dropdown?
Dropdown (in dynpro) is the same whatever it's a date or any other kind of field, and you can find many answers in the Web.
The logic is more complex.
2023 Jun 21 9:29 PM
2023 Jul 07 9:12 AM
2023 Jul 07 10:20 AM
Descrobe how you expect it to work. That's the logic you need to implement. If you can't describe how you want it to work, we can't help you.
I can see how 1123 could be 1.1.23 (DDMMYYYY) or 11.2.3 (YYYYMMDD) or 11.3.2 (YYYYDDMM) but not how it could become 2012.01.03 or 2012.03.01.
What troubles me more is why would you need this? In over 40 years of using IT applications, I've never seen such a requirement. I think it would be more confusing than helpful.
2023 Jul 07 10:51 AM
I guess it's an exercise, because by default
PARAMETERS p_date TYPE d.
1123 is invalid. 010123 is valid and is interpreted by SAP according to the user's date format. If the format is DDMMYYYY, 010123 is interpreted as 01012023.
Now, concerning your exercise, here are a few tips.
Based on your example, 1123, you have to find all possibilities what it means.
It's composed of 3 elements of contiguous characters of size 1, 1 and 2. Other orders are possible: 1, 2, 1 or 2, 1, 1.
So, 1123 can represent:
An element of 1 character between 1 and 9 may represent a day, a month or a year.
An element of 1 character which is 0 can represent only a year.
An element of 2 characters between 1 and 12 may represent a day, a month or a year.
An element of 2 characters between 13 and 31 may represent either a month or a year, but not a day.
An element of 2 characters which is 00 or is between 32 and 99 can represent only a year.
For each combination, you must find the possible combinations
Note that in your example, you have years 2000 represented, in SAP if a user is typing the dates "010140" to "010199" in DDMMYYYY format, they are interpreted as years 1940 to 1999, while "010100" to "010139" they are interpreted as years 2000 to 2039.
I hope it will help you, good luck!