2006 Feb 22 3:47 PM
As HR ABAPers know, using the Logical Database approach (I'm using PNPCE) gives you a system-generated Selection Screen. Part of the specs I have for this report involves making sure that the begin and end dates for the period selected are for a two-week period. If not, I should display an error message until the user enters a period such that the period (pn-begda and pn-endda) reflect a two-week period.
The code for the validation is easy enough, and I put it in the AT SELECTION-SCREEN event. But here's the problem -- the code fires every time the user clicks the "Reporting Period" drop-down box, never giving the user a chance to specify a two-week period. It fires because pn-begda and pn-endda are still all zeroes. Even if I select "Other Period" from the drop-down list, the text boxes to allow me to specify the begin and end dates don't appear.
I've been working on this for quite a while, trying all kinds of things, but I'm spinning my wheels now. I just want that check to happen when the user clicks the Execute button on the Selection Screen, not when he/she is still trying to enter criteria. I'm thinking screen field validation for a system-generated Selection Screen has to be a pretty common thing, and there must be a good solution out there.
Any ideas?
2006 Feb 22 3:52 PM
As HR ABAPers know, using the Logical Database approach (I'm using PNPCE) gives you a system-generated Selection Screen. Part of the specs I have for this report involves making sure that the begin and end dates for the period selected are for a two-week period. If not, I should display an error message until the user enters a period such that the period (pn-begda and pn-endda) reflect a two-week period.
The code for the validation is easy enough, and I put it in the AT SELECTION-SCREEN event. But here's the problem -- the code fires every time the user clicks the "Reporting Period" drop-down box, never giving the user a chance to specify a two-week period. It fires because pn-begda and pn-endda are still all zeroes. Even if I select "Other Period" from the drop-down list, the text boxes to allow me to specify the begin and end dates don't appear.
I've been working on this for quite a while, trying all kinds of things, but I'm spinning my wheels now. I just want that check to happen when the user clicks the Execute button on the Selection Screen, not when he/she is still trying to enter criteria. I'm thinking screen field validation for a system-generated Selection Screen has to be a pretty common thing, and there must be a good solution out there.
Any ideas?
2006 Feb 22 3:52 PM
2006 Feb 22 3:54 PM
Could you not initialize pn-begda and pn-endda at the INITIALIZATION event to something like today and two weeks from today?
Rob
2006 Feb 22 4:00 PM
Rich,
Absolutely beautiful -- that's exactly what I needed to learn. Thank you so much.
Rob, I thought about that. I even proposed to the users that I could default in a two-week range beginning with today, exactly as you suggested, but they didn't want that. They felt that this report would more often than not be run to reflect data from two-week periods not necessarily starting today. Still thought it was a good idea, but that's their call. _
Again, thanks Rich. Points awarded.
2006 Feb 22 4:04 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |