Initiate the 'AT selection-screen' EVENT from a LISTBOX within an ABAP report sel screen

In-order for the Listbox selection process to initiate the 'AT selection-screen' event you need to add the USER-COMMAND option to the parameter declaration. See code below for exact syntax or simply create an BAP report with the following code. You can then execute it to see the code in action.

The example simply hides the field P_uname when the user selects and option from the listbox dropdown.

*Code used to Initiate the 'AT selection-screen' EVENT from LISTBOX.
REPORT LISTBOX_UCOMM.
DATA: gd_ucomm type sy-ucomm.
PARAMETERS p_cid TYPE spfli-carrid
                    AS LISTBOX VISIBLE LENGTH 25
                    USER-COMMAND UPD.
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'. "listbox selection made
*     loop at screen code is used to change the display properties of the screen fields.
*     I.e. allows you to hide, display or set as output only fields on the ABAP selection
*     screen 
      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.
  ENDCASE.

Also See:
Add dropdown list (listbox)
Initiate AT selection-screen from RADIOBUTTON
Initiate AT selection-screen from CHECKBOX
<--Report selection screen main menu


Related Articles

Adding buttons to an ABAP report selection screen within SAP
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
ABAP Radiobutton to Initiate the 'AT selection-screen' EVENT on SAP report
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