‎2018 Jun 13 1:31 PM
Hello guys,
I'm facing the problem to fill a parameter dependent on another parameter in the selection screen. Of course the filling of the parameter is not the problem because I can do that whenever it gets changed in event AT SELECTION SCREEN OUTPUT.
But my problem is how can I differentiate when user wants to change the parameter manually. Let me explain.
I have parameter date A which is at start 31.03.2018 and date B which is set like date A to 31.03.2018. Now when user changes date A to 31.05.2018, date B should also change to that. But, now here is the point, when user wants to change date B manually it should not get overwritten by date A. How can I use that? I thought at USER-COMMAND but I canot assign that to date field. And event enter also does not work because I only need the overwriting when user changes field A.
Regards
Michael
‎2018 Jun 13 2:15 PM
Have you thought of using an extra variable which also contains the value for date A.
In the AT SELECTION SCREEN compare it to the value of date A and if there is no change do nothing?
‎2018 Jun 13 2:15 PM
Have you thought of using an extra variable which also contains the value for date A.
In the AT SELECTION SCREEN compare it to the value of date A and if there is no change do nothing?
‎2018 Jun 13 2:26 PM
Yes thought about that but where to fill this variable? Only in INITIALZIATION is not enough, because what when user changes it several times? I did not find the point where to separate between filling the variable with old value and checking it between old value. All AT SELECTION SCREEN events already have the new value when debugging it.
‎2018 Jun 13 4:00 PM
‎2018 Jun 13 6:12 PM
I dont get it, sorry. AT SELECTION-SCREEN OUTPUT is called as latest AT SELECTION-SCREEN event, so the value is already changed there.
‎2018 Jun 14 5:16 AM
‎2018 Jun 14 8:23 AM
Follow the link, I gave above.
If you think, SAP has to rewrite that documentation, feel free to open a ticket.
‎2018 Jun 14 8:38 AM
A little bit explaining would have been more helpful than lecture. You're right, it works, thanks for that. But when doing lecture, get it exactly.
When debugging it, after pressing enter, first AT SELECTION-SCREEN ON, than AT SELECTION-SCREEN and at last AT SELECTION-SCREEN OUTPUT is called. Of course the first ones are PAI, and the last one is PBO, but in sequence it is like I said. It only works because AT SELECTION-SCREEN OUTPUT is also called before first appearance of selection screen.
‎2018 Jun 15 8:17 AM
INITIALIZATION.
lv_checkdate = lv_a.
AT SELECTION-SCREEN ON lv_a.
if lv_checkdate NE lv_a.
lv_checkdate = lv_a.
lv_b = lv_a.
endif.
‎2018 Jun 15 11:38 AM
Instead of INITIALIZATION you must use AT SELECTION-SCREEN OUTPUT if the selection screen is called several times. INITIALIZATION is triggered once after SUBMIT, AT SELECTION-SCREEN OUTPUT is triggered as the PBO event before displaying each selection screen.
‎2018 Jun 15 3:19 PM
I use Initilization just to set the initial value. The AT SELECTION_SCREEN ON part does the rest. Also I didn't put in AT SELECTION_SCREEN OUTPUT because like you said that that is the PBO and I only want to action perform on the action on the date parameter and not every time which would happen if I placed it there.
‎2018 Jun 14 7:23 AM
Check the following code
PARAMETERS lv_a TYPE sy-datum.
PARAMETERS lv_b TYPE sy-datum.
AT SELECTION-SCREEN ON lv_a.
lv_b = lv_a.
Here the two parameters are dates and when you press enter the date is changed. but only if data is entered in lv_a
‎2018 Jun 14 8:16 AM
Hello Sooraj,
I thought like that but unfortunately thats not correct. Event gets triggered when pressing enter no matter which date is changed. I debugged it and get into it whenever pressing enter.
Regards
Michael