ABAP Radiobutton to Initiate the 'AT selection-screen' EVENT on SAP report
In-order for the Radiobutton selection process to initiate the 'AT selection-screen' event you need to
add the 'USER-COMMAND' option to the parameter declaration. See code below or just copy it into an new ABAP
program and execute it to see how it works.
The example simply displays or hides the field P_uname based on which radio button the user selects.
*Code used to Initiate the 'AT selection-screen' EVENT from radiobuttons. selection-screen begin of block group with frame title text-s04. parameters: p_sel1 type c radiobutton group sel user-command upd. parameters: p_sel2 type c radiobutton group sel. parameters: p_sel3 type c radiobutton group sel. selection-screen end of block group. DATA: gd_ucomm type sy-ucomm. PARAMETERS: p_uname type uname. AT SELECTION-SCREEN. *This event is then triggered when a user selects an option from the LISTBOX gd_ucomm = sy-ucomm. "capture user command If sy-ucomm eq 'UPD'. "listbox selection made * add code here to process data ENDIF. AT SELECTION-SCREEN OUTPUT. * The OUTPUT event is also trigged to re-draw ABAP report screen allowing it to * be used to hide, display or deactivate fields. Please note at this point sy-ucomm field * has been refreshed so you need to use value captured above in gd_ucomm case gd_ucomm. when 'UPD'. "radiobutton selection made if p_sel2 eq 'X'. "hide field if second radio button selected * loop at screen code is used to change the output/display properties of the * screen fields. LOOP at screen. * Use cs as this then captures all elements of the field inc text if screen-name cs 'P_UNAME'. screen-active = 0. "remove field from screen * screen-input = 0. "set field as display only modify screen. endif. ENDLOOP. else. "else show field if 1st or 3rd radiobutton is selected LOOP at screen. * Use cs as this then captures all elements of the field inc text if screen-name cs 'P_UNAME'. screen-active = 1. "display field from screen * screen-input = 1. "set field as input modify screen. endif. ENDLOOP. endif. ENDCASE.
Also See:
Initiate AT selection-screen from LISTBOX dropdown
Initiate AT selection-screen from CHECKBOX
<--Report selection screen main menu
Related Articles
Add buttons to Application toolbar of selection screen
Add buttons with icon to selection screen
Add buttons to dynamically change the selection screen entry fields
ABAP parameter as checkbox plus initiate 'AT selection-screen' EVENT to unselect other checkboxes
Initiate the 'AT selection-screen' EVENT from a checkbox
Dynamically alter a selection screen based on user
SAP dropdown list box for an ABAP report selection screen
Initiate the 'AT selection-screen' EVENT from a LISTBOX within an ABAP report sel screen
ABAP Begin of Block to group selection-screen fields plus add title and frame
Report Selection Screen - Example code and information on various sel screen processing techniques
Selection screen push buttons
F4 search help manually called from report selection screen
Modify Selection Screen(LOOP AT SCREEN)
Restrict select-options to only allow specific restrictions
Radiobutton (inc desc) and entry field on same line of SAP selection screen
Add blank line to SAP report selection screen
Add Tab strip to Selection Screen