4

Need to display possible dates in dropdown in selection screen when input is dat...

 11 months ago
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

Do you have an S- or P- account?
If so, you need SAP Universal ID. In a few months, SAP Universal ID will be the only option to login to SAP Community. Without it, you will lose your content and badges. If you have multiple accounts, use the Consolidation Tool to merge your content.
Get started with SAP Universal ID
Search Questions and Answers
Jun 20 at 11:31 PM

Need to display possible dates in dropdown in selection screen when input is date in any format?

102 Views

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

3 comments
Jun 21, 2023 at 08: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.

Hi Sandra ,
I need help in the logic part.
thanks

38 minutes ago

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.

1 Answer
Sort by:

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!

Know someone who can answer? Share a link to this

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.

Please provide a distinct answer and use the comment option for clarifying purposes.
10 characters required.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK