ALV Reports
ABAP Developmentintermediate

ALV Reports Part 6: Hotspot and Double-Click Drill-Down

Key takeaway

Let users navigate from ALV rows: hotspot columns and double-click events, the classic user command callback of REUSE ALV GRID DISPLAY, HOTSPOT CLICK / DOUBLE CLICK events of CL GUI ALV GRID, and drill-down to a detail ALV or a standard transaction with SET PARAMETER ID and CALL TRANSACTION.

Explanation

📌 KEY POINTS
✅ Hotspot = a column shown as a link; a single click triggers an event. Double click works on any cell.

✅ REUSE_ALV_GRID_DISPLAY: pass i_callback_user_command = 'USER_COMMAND' and handle '&IC1' (double click/hotspot) in that FORM.

✅ CL_GUI_ALV_GRID: register handler methods FOR EVENT hotspot_click / double_click with SET HANDLER.

⚠️ Always check authorization (AUTHORITY-CHECK) before CALL TRANSACTION to a standard transaction.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Part 3 built an OO grid. Now users click a row to see details — the most requested ALV feature.\n\n━━━━━━━━━━━━━━━━━━━━\n▶ 1. CLASSIC CALLBACK (REUSE_ALV)\n• Field catalog: hotspot = 'X' for the link column.

  • i_callback_user_command = 'USER_COMMAND'.
  • FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.

– r_ucomm = '&IC1' for double click or hotspot.
– rs_selfield-tabindex = row index, rs_selfield-fieldname = clicked column, rs_selfield-value = cell value.\n\n━━━━━━━━━━━━━━━━━━━━\n▶ 2. OO EVENTS (CL_GUI_ALV_GRID)\n• Local class lcl_event_handler with METHODS on_hotspot FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id e_column_id.

  • METHODS on_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column.
  • SET HANDLER go_handler->on_hotspot FOR go_grid.
  • Read the row: READ TABLE gt_out INTO gs_out INDEX e_row_id-index.

━━━━━━━━━━━━━━━━━━━━
▶ 3. DRILL-DOWN TARGETS

  • Standard transaction: SET PARAMETER ID 'CAR' FIELD … then CALL TRANSACTION 'XXXX' AND SKIP FIRST SCREEN. Parameter IDs come from the data element (e.g. VBELN → AUN for VA03, BELNR/BUK/GJR for FB03).
  • Detail ALV: select the bookings of the clicked flight and show a second ALV (popup with REUSE_ALV_POPUP_TO_SELECT or a new grid).
  • In SALV: get_event( ) and SET HANDLER for link_click / double_click.

━━━━━━━━━━━━━━━━━━━━
▶ 4. AUTHORIZATION AND ERRORS

  • CALL TRANSACTION … WITH AUTHORITY-CHECK (7.40 SP… available) or AUTHORITY-CHECK OBJECT 'S_TCODE' before calling.
  • Handle empty detail results with a message.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Run the code example (REUSE_ALV version): click a connection number to see its bookings.
  2. Double-click a booking to see the customer details; study the commented FB03 pattern for navigation to a standard transaction.
  3. Build the OO variant with SET HANDLER (commented part) in your Part 3 report.

✅ CHECKPOINT: users can click from an overview ALV into details or into standard transactions safely.

Code example

ABAP Code
REPORT zalv_drilldown. DATA: gt_flights  TYPE STANDARD TABLE OF sflight,      gt_bookings TYPE STANDARD TABLE OF sbook,      gt_fcat     TYPE slis_t_fieldcat_alv,      gs_fcat     TYPE slis_fieldcat_alv. START-OF-SELECTION.  SELECT * FROM sflight INTO TABLE gt_flights WHERE carrid = 'LH'.   CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'    EXPORTING i_structure_name = 'SFLIGHT'    CHANGING  ct_fieldcat      = gt_fcat.  LOOP AT gt_fcat INTO gs_fcat WHERE fieldname = 'CONNID'.    gs_fcat-hotspot = 'X'.                           " shown as a link    MODIFY gt_fcat FROM gs_fcat.  ENDLOOP.   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'    EXPORTING      i_callback_program      = sy-repid      i_callback_user_command = 'USER_COMMAND'      " FORM name below      it_fieldcat             = gt_fcat    TABLES      t_outtab                = gt_flights. *----------------------------------------------------------------------** Callback for clicks in the flight list*----------------------------------------------------------------------*FORM user_command USING r_ucomm     LIKE sy-ucomm                        rs_selfield TYPE slis_selfield.  DATA ls_flight TYPE sflight.   CASE r_ucomm.    WHEN '&IC1'.                                      " hotspot or double click      READ TABLE gt_flights INTO ls_flight INDEX rs_selfield-tabindex.      CHECK sy-subrc = 0.      SELECT * FROM sbook INTO TABLE gt_bookings        WHERE carrid = ls_flight-carrid          AND connid = ls_flight-connid          AND fldate = ls_flight-fldate.      IF gt_bookings IS INITIAL.        MESSAGE 'No bookings for this flight' TYPE 'S'.        RETURN.      ENDIF.      PERFORM show_bookings.  ENDCASE.ENDFORM. FORM show_bookings.  DATA lt_fcat TYPE slis_t_fieldcat_alv.  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'    EXPORTING i_structure_name = 'SBOOK'    CHANGING  ct_fieldcat      = lt_fcat.  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'             " second-level ALV    EXPORTING      i_callback_program      = sy-repid      i_callback_user_command = 'USER_COMMAND_BOOKING'      it_fieldcat             = lt_fcat    TABLES      t_outtab                = gt_bookings.ENDFORM. FORM user_command_booking USING r_ucomm     LIKE sy-ucomm                                rs_selfield TYPE slis_selfield.  DATA ls_booking TYPE sbook.  IF r_ucomm = '&IC1'.    READ TABLE gt_bookings INTO ls_booking INDEX rs_selfield-tabindex.    CHECK sy-subrc = 0.    DATA ls_cust TYPE scustom.    SELECT SINGLE * FROM scustom INTO ls_cust WHERE id = ls_booking-customid.    IF sy-subrc = 0.      MESSAGE i000(0k) WITH ls_cust-name ls_cust-city ls_cust-telephone.   " simple detail popup    ENDIF.  ENDIF.ENDFORM. * ===== Drill-down into a standard transaction (real project pattern: FI document) =====* Hotspot on BELNR in an FI ALV:*   AUTHORITY-CHECK OBJECT 'S_TCODE' ID 'TCD' FIELD 'FB03'.*   IF sy-subrc <> 0.*     MESSAGE 'No authorization for FB03' TYPE 'S' DISPLAY LIKE 'E'.*     RETURN.*   ENDIF.*   SET PARAMETER ID 'BLN' FIELD ls_out-belnr.     " parameter IDs from the data elements*   SET PARAMETER ID 'BUK' FIELD ls_out-bukrs.*   SET PARAMETER ID 'GJR' FIELD ls_out-gjahr.*   CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN. * ===== OO variant (CL_GUI_ALV_GRID, see Part 3) =====* CLASS lcl_handler DEFINITION.*   PUBLIC SECTION.*     METHODS on_hotspot FOR EVENT hotspot_click OF cl_gui_alv_grid*       IMPORTING e_row_id e_column_id.* ENDCLASS.* CLASS lcl_handler IMPLEMENTATION.*   METHOD on_hotspot.*     READ TABLE gt_flights INTO ls_flight INDEX e_row_id-index.*     ...*   ENDMETHOD.* ENDCLASS.* In PBO after creating the grid:  SET HANDLER go_handler->on_hotspot FOR go_grid.

Real project scenario

An accounts payable report listed invoices, and users copied each document number into FB03 manually — about 200 times a day for the team. Adding a hotspot on BELNR with SET PARAMETER ID 'BLN', 'BUK' and 'GJR' and CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN turned it into one click.
In testing, a user without FB03 authorization got a short dump-like error; an AUTHORITY-CHECK on S_TCODE with a friendly message was added before the call.

Common mistakes

  • Forgetting i_callback_program or the callback FORM name in uppercase mismatch.
  • Reading the clicked row from a sorted/filtered view wrongly (use the index given by ALV on the original table).
  • Wrong parameter IDs, so SKIP FIRST SCREEN opens an empty screen.
  • No authorization check before CALL TRANSACTION.
  • Registering event handlers before the grid exists (SET HANDLER on initial reference).

Best practices

  • Mark only meaningful columns as hotspot.
  • Use the row index provided by the event/callback.
  • Take parameter IDs from the data element (SE11).
  • Check authorization before navigation.
  • Give clear messages when no detail data exists.

Interview angle

Questions: "How do you implement drill-down in ALV?", "What is &IC1?", "How do you handle hotspot click in CL_GUI_ALV_GRID?"
Strong answer: hotspot in the field catalog; REUSE_ALV with i_callback_user_command and FORM user_command (r_ucomm '&IC1', rs_selfield-tabindex/value); OO grid with FOR EVENT hotspot_click/double_click handler methods and SET HANDLER; navigate with SET PARAMETER ID + CALL TRANSACTION AND SKIP FIRST SCREEN after authority check, or show a detail ALV.

Practice this lesson

Quick check

1. What should a report do before CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN from an ALV hotspot?

2. Which ABAP object-oriented statement is used to register a handler method for an event raised by CL_GUI_ALV_GRID, such as a double-click on a row?

3. Which event fires when a hotspot is clicked?

Interview questions

1. A finance ALV opens billing documents with SET PARAMETER and CALL TRANSACTION, but some users get errors and others see documents they should not. How do you make the drill-down robust?

Answer it in your own words first, then compare.

2. How do you add a hotspot in CL_SALV_TABLE?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics