Reputation: 1
everybody. I'm making a request to the HCM department and using some Standard Logicaldatabase, and I am facing a problem that when the BUKRS filter is not filled, I fill it with a specific BUKRS, but when it returns to the selection screen even if I clear the pnpbukrs and pnpbukrs[] in the code, the field continues to be filled with my value. I've tried everything, even modifying the variables in debug, but i can't clean my select options of PNPBUKRS. Does anyone have any ideas that how can I clean that?
Here is the code in which I pass the value of select options which works, but when I try to clear it when returning to the selection screen it remains filled
AT SELECTION-SCREEN.
IF pnpbukrs[] IS INITIAL.
pnpbukrs-sign = 'I'.
pnpbukrs-option = 'EQ'.
pnpbukrs-low = '1021'.
APPEND pnpbukrs.
ENDIF.
GET pernr.
PERFORM f_seleciona_dados.
END-OF-SELECTION.
START-OF-SELECTION.
IF t_p0001 IS INITIAL.
LOOP AT pnpbukrs.
CLEAR pnpbukrs-low.
CLEAR pnpbukrs-high.
CLEAR pnpbukrs-option.
CLEAR pnpbukrs-sign.
MODIFY pnpbukrs.
ENDLOOP.
CLEAR: pnpbukrs[],
pnpbukrs.
Upvotes: 0
Views: 146
Reputation: 13656
You are trying to change the value of a selection screen parameter during the START-OF-SELECTION
event.
It's not possible (easily). Here's why.
The selection screen parameters are automatically saved to the memory after leaving the selection screen and restored when re-entering it the first time during AT SELECTION-SCREEN OUTPUT
, so it's useless modifying them during the events START-OF-SELECTION
or END-OF-SELECTION
(and also the logical database events).
You can set the values of the selection screen parameters only during the events AT SELECTION-SCREEN
, AT SELECTION-SCREEN OUTPUT
, INITIALIZATION
and LOAD-OF-PROGRAM
events.
After the block START-OF-SELECTION
, the program is restarted, i.e. all the global variables are cleared or reset to their default values, so the only way to clear the parameters, it's to do it during AT SELECTION-SCREEN OUTPUT
(when the saved values are restored) but do it only when the program restarts. To know if it's a restart, the only way I know is to store the information in memory via SET MEMORY
and retrieve it via GET MEMORY
.
For information, there are other tricky situations due to the save/restore of selection screen parameters, one is explained here: https://community.sap.com/t5/technology-q-a/how-to-change-the-value-of-a-parameter-used-in-several-selection-screens/qaq-p/13799731.
NB: the issue is not specific to the logical database; it concerns the selection screens globally.
Upvotes: 0