Skip to Content
-2

Dependent parameter in selection screen

Jun 13 at 12:31 PM

107

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Arthur Parisius Jun 13 at 01:15 PM
0

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?

Show 8 Share
10 |10000 characters needed characters left characters exceeded

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.

0

AT SELECTION-SCREEN OUTPUT

1

I dont get it, sorry. AT SELECTION-SCREEN OUTPUT is called as latest AT SELECTION-SCREEN event, so the value is already changed there.

0

"AT SELECTION-SCREEN OUTPUT is called as latest AT SELECTION-SCREEN event"

No it isn't.

0

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.

0
See below.
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.
0

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.

0

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.

0
Sooraj D Jun 14 at 06:23 AM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0