Sometimes it’s useful to save and restore the selection of user’s parameters, after the program was started newly. For many parameters it can be achieved with construction PARAMETERS … MEMORY ID which stores the values of parameters as SPA/GPA in the SAP Memory. The MEMORY ID addition is not allowed for radio buttons, so here is a small example how you can code it by yourself.
PARAMETERS:
p1 RADIOBUTTON GROUP rg1,
p2 RADIOBUTTON GROUP rg1,
p3 RADIOBUTTON GROUP rg1.
AT SELECTION-SCREEN OUTPUT.
DATA:
lv_rg1(2) TYPE c.
* Restore selected radio button as SPA/GPA parameter in SAP memory
* and set its value
GET PARAMETER ID 'RG1' FIELD lv_rg1.
IF lv_rg1 = 'P1'.
p1 = 'X'. p2 = ''. p3 = ''.
ELSEIF lv_rg1 = 'P2'.
p1 = ''. p2 = 'X'. p3 = ''.
ELSEIF lv_rg1 = 'P3'.
p1 = ''. p2 = ''. p3 = 'X'.
ENDIF.
START-OF-SELECTION.
* Save selected radio button as SPA/GPA parameter in SAP memory
IF p1 = 'X'.
SET PARAMETER ID 'RG1' FIELD 'P1'.
ELSEIF p2 = 'X'.
SET PARAMETER ID 'RG1' FIELD 'P2'.
ELSEIF p3 = 'X'.
SET PARAMETER ID 'RG1' FIELD 'P3'.
ENDIF.
WRITE: / 'p1', p1.
WRITE: / 'p2', p2.
WRITE: / 'p3', p3.
See other related notes on my website: