ABAP Developmentintermediate
Interactive ALV: Hotspots, F4 and Events
Wiring drill-down, F4 help and column-based colouring.
Explanation
Register a handler for the LINK_CLICK event on CL_SALV_TABLE to react to hotspot clicks. Use GET_FUNCTIONS to add custom toolbar buttons. Column colouring uses CL_SALV_COLUMN->SET_COLOR. F4 help attaches through the underlying dictionary type โ always declare with dictionary types (KUNNR, MATNR) rather than STRING.
Code example
ABAP Code
SET HANDLER lcl_events=>on_link_click FOR lo_alv->get_event( ).lo_alv->get_functions( )->set_all( abap_true ).Real project scenario
A shipping cockpit uses colour to flag late deliveries โ red for >5 days late, amber for 1โ5.
Common mistakes
Registering handlers after DISPLAY; hardcoding colour indexes instead of using constants.
Best practices
Encapsulate ALV code in a dedicated builder class; keep event handlers thin and delegate to services.
Interview angle
How do you pass the clicked row's key to another transaction?