‎2024 Aug 19 6:11 PM - edited ‎2024 Aug 30 8:19 AM
The below program has 2 selection screens 1000 and 1001, both having the same parameter DUMMY, and we go from 1000 to 1001 by pressing F8 (Execute), and back to 1000 by pressing F3 (Back).
If I type a value in the parameter DUMMY in the selection screen 1001, press Enter to automatically transport the screen value to the global variable (don't miss it, back buttons don't transport the values), go back (F3 or whatever) to the selection screen 1000, this value is not shown in the selection screen 1000, and by debug we can see that the global variable DUMMY has been cleared by the system.
How to retain the parameter value?
For information, if I type the value in the selection screen 1000 and go to the selection screen 1001, the value is shown. It seems to be a backward-only "issue".
REPORT zzsro_selection_screen_include.
TABLES sscrfields.
PARAMETERS dummy.
SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN COMMENT /1(83) text1001.
SELECTION-SCREEN INCLUDE PARAMETERS dummy.
SELECTION-SCREEN END OF SCREEN 1001.
INITIALIZATION.
text1001 = 'Screen 1001'.
AT SELECTION-SCREEN.
IF sy-dynnr = '1000' AND sscrfields-ucomm = 'ONLI'.
sscrfields-ucomm = ''.
CALL SELECTION-SCREEN 1001.
ENDIF.
IF sy-dynnr = '1001' AND sscrfields-ucomm = 'CRET'.
sscrfields-ucomm = ''. " Execute -> stays on 1001
ENDIF.
Request clarification before answering.
When leaving a selection screen, the parameters are saved by the kernel to the memory, and when coming back to the selection screen, they are restored from the memory.
Add the below code, that will replace the values in memory with the current parameter values, when leaving the selection screen 1001 to get back to the selection screen 1000. That's an "evil" workaround and may stop working at any time if SAP does a change of the "kernel" or any system ABAP program (RSDBSPVA, RSDBRUNT, etc.) so better redesign your program to use any other supported solution.
AT SELECTION-SCREEN ON EXIT-COMMAND.
IF sy-dynnr = '1001'.
PERFORM export_variables.
ENDIF.
FORM export_variables.
FIELD-SYMBOLS <restore_memkey> TYPE RSVAMEMKEY.
ASSIGN ('(RSDBSPVA)RESTORE-MEMKEY') TO <restore_memkey>.
PERFORM %_export_var_to_mem IN PROGRAM (sy-repid) USING <restore_memkey>.
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.