![](/style/images/good.png)
![](/style/images/bad.png)
Need to display possible dates in dropdown in selection screen when input is dat...
source link: https://answers.sap.com/questions/13909648/need-to-display-possible-dates-in-dropdown-in-sele.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Need to display possible dates in dropdown in selection screen when input is date in any format?Skip to Content
Need to display possible dates in dropdown in selection screen when input is date in any format?
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
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.
Hi Sandra ,
I need help in the logic part.
thanks
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.
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:
- 1 - 1 - 23
- 1 - 12 - 3
- 11 - 2 - 3
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
- 1 - 1 - 23 may correspond to DMY - DMY - Y. As Y MUST be in the 3rd group, the last possibility is DM - DM - Y, and you can loop at combinations: D - M - Y and M - D - Y.
- 1 - 12 - 3 may correspond to DMY - DMY - DMY. You have 6 possibilities: D - M - Y, D - Y - M, M - D - Y, etc.
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!
Before answering
You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that your answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK