Z_LOCKED_USERS.abap
This code is an ABAP report that displays a list of locked or unlocked users based on the user's selection and allows navigation to transaction SU01 for user maintenance.
Dependencies
cl_salv_table
external
cl_salv_events_table
external
cl_salv_columns_table
external
if_salv_c_cell_type
external
cx_salv_msg
external
cx_salv_not_found
external
Visualization
Code Elements
Report
z_locked_users
global
Main program for reporting locked/unlocked users.
Standard ABAP report header used for defining the report name.
Table
usr02
global
ABAP table used to store user data, specifically for user information in the system.
Tables statement used to declare the SAP standard table USR02 for fetching user data.
Type
ty_user
global
Structure used to define the layout of user data.
Data type definition for storing individual user information with fields bname (username), erdat (creation date), and uflag (user flag status indicating locked or unlocked).
Variable
gt_user
global
Internal table for storing user data fetched from database based on selection screen input.
Data declaration for an internal table holding multiple user entries.
gs_user
global
Work area for individual user records during table operations.
Data declaration for a work area used to process single user entries within gt_user.
lr_table
local
Reference variable for ALV table object
Holds reference to the main ALV grid table object for display configuration
lr_events
local
Reference variable for ALV events
Manages event handling for the ALV grid
lr_columns_table
local
Reference variable for ALV columns configuration
Handles column settings and properties for the ALV display
lv_heading
local
Stores the header text for the ALV grid.
Dynamic header for ALV grid based on the count and selection of locked or unlocked users.
lv_count
local
Stores the number of lines in the internal table gt_user.
Describes and holds the number of users matching the selected criteria.
Class
lcl_alv_handler
local
Local class that functions as an event handler for ALV grid row click events.
Defines methods to handle click events, specifically navigating to transaction SU01 for the clicked user.
Method
on_line_click
local
Handles click events on the ALV grid to navigate to user maintenance (SU01).
Reads selected row data to set the user parameter and initiates a call to transaction SU01 with that parameter.
Selection-Screen Element
SELECTION-SCREEN BLOCK
global
Defines the user interface for selecting reporting criteria.
Group of screen elements allowing user to select locked or unlocked users through radio buttons.
Selection-Screen Parameter
p_lock
global
Radio button for selecting locked users.
Parameter for user input to signify the report should list locked users.
p_nlock
global
Radio button for selecting unlocked users.
Parameter for user input to signify the report should list unlocked users.
Text-Symbol
text-001
global
Text symbol used for selection screen block title
Text symbol defining the title of the selection screen block
Form
get_data
local
Retrieves user data based on selected criteria from the selection screen.
ABAP form routine that selects users from USR02 table based on their lock status (uflag).
display_data
local
Displays the fetched user data in an ALV grid.
Sets up ALV grid with event handlers and displays the user data, allowing interaction.