‎2004 Dec 08 7:33 PM
This one is too weird to believe. Here's what's happening. I have a normal abap list report with a checkbox parameter. I set the value to 'X' initialization and it works the first time the selection screen is presented. Upon running the program I turn off the checkbox. I want the value to be re-initialized to 'X' whenever the selection screen appears. The problem is when F3 is pressed on the list screen, the initialization is invoked and the parameter set to 'X' but the selection screen appears without the checkbox selected. I have verified this through the debugger. Is there a better to change the values of selection screen parameters?
‎2004 Dec 08 7:46 PM
‎2004 Dec 08 8:13 PM
yep, that works and I tried that before but I didn't like the fact that if the checkbox was selected and you just pressed enter not execute then the checkbox is reset which makes it seems squirrelly. maybe checking the command for enter in selection screen output and skip the setting to 'x' for enter would work?
‎2004 Dec 08 8:27 PM
‎2004 Dec 08 8:49 PM
that didn't work either. sy-ucomm is still space even when ending out of the report. Here's what I did but it gets ugly. it works but if someone has a better idea, please let me know.
p_check as checkbox default = 'X'.
AT SELECTION-SCREEN OUTPUT.
IMPORT w_from_end_of_selection FROM MEMORY ID 'key1'.
IF w_from_end_of_selection = 'X'.
p_test = 'X'.
CLEAR w_from_end_of_selection.
EXPORT w_from_end_of_selection TO MEMORY ID 'key1'.
ENDIF.
END-OF-SELECTION.
w_from_end_of_selection = 'X'.
EXPORT w_from_end_of_selection TO MEMORY ID 'key1'.
‎2004 Dec 08 9:04 PM
here's a cleaner solution.
Test Option.
PARAMETERS: p_test AS CHECKBOX.
INITIALIZATION.
w_from_initialization = 'X'.
AT SELECTION-SCREEN OUTPUT.
IF w_from_initialization = 'X'.
can only get here from initialization
use this to reset the test option to "on".
p_test = 'X'.
CLEAR w_from_initialization.
ENDIF.
‎2004 Dec 09 4:13 AM
Hello Scott,
I'm not sure if you know about this, so I would explain it to you.
In case of selection-screen processing, the UCOMM value is to be obtained from the structure SSCRFIELDS, as against the structure SY(ST) in case of normal screen processing.
Consider the following code snippet.
====================================================
tables sscrfields.
parameters : p_check as checkbox.
data :w_do_not_reset type flag.
at selection-screen output.
if w_do_not_reset eq space.
p_check = 'X'.
endif.
at selection-screen.
if sscrfields-ucomm eq space.
w_do_not_reset = 'X'.
else.
clear w_do_not_reset.
endif.
start-of-selection.
write : p_check.
====================================================
As the example illustrates, we need to declare the structure SSCRFIELDS with a tables statement and use the value of SSCRFIELDS-UCOMM.
Hope this helps.
Regards,
Anand Mandalika.
P.S. : If you are satisfied with the solution, please award the points.
‎2004 Dec 09 7:30 AM
Why not just try
parameters : p_check as checkbox memory id xxx .
Regards
Raja