Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV HOTSPOT AND ON CLICK EVENT

Former Member

Dear Friends ,

I am using ALV FACTORY METHOD.

<< Moderator message - Everyone's problem is important >>

I am Using following code snippet but still I am unable to see the Hotspot on the col and drill down fucntionality is not working.

If some on have used this please let me know.

METHOD set_hotspot_vbeln.**...HotSpot   

*...HotSpot
    DATA: lo_cols_tab TYPE REF TO cl_salv_columns_table,
          lo_col_tab  TYPE REF TO cl_salv_column_table.
*
*   get Columns object
    lo_cols_tab = co_alv->get_columns( ).
*
*   Get VBELN column
    TRY.
        lo_col_tab ?= lo_cols_tab->get_column( 'VBELN' ).
      CATCH cx_salv_not_found.
    ENDTRY.
*
*   Set the HotSpot for VBELN Column
    TRY.
        CALL METHOD lo_col_tab->set_cell_type
          EXPORTING
            value = if_salv_c_cell_type=>hotspot.
        .
      CATCH cx_salv_data_error .
    ENDTRY.
*
*...Events
    DATA: lo_events TYPE REF TO cl_salv_events_table.
*
*   all events
    lo_events = o_alv->get_event( ).
*
*   event handler
    SET HANDLER co_report->on_link_click FOR lo_events.
*
  ENDMETHOD.                    "set_hotspot_vbeln

Regards

Ramesh

...and please use code tags

Edited by: Rob Burbank on Oct 27, 2010 3:52 PM

1 ACCEPTED SOLUTION

Former Member

you need to handle...consider sample code below...adapt to you situation.:

*----------------------------------------------------------------------*
*       CLASS lcl_events DEFINITION
*----------------------------------------------------------------------*
* SALV Event Handler Definition                                        *
*----------------------------------------------------------------------*
class lcl_events definition.
  public section.
    methods:
    on_link_click for event link_click  "Hotspot Handler
      of cl_salv_events_table
      importing row column.
endclass.                    "lcl_events DEFINITION
*
data: gr_event_handler type ref to lcl_events.
*
*----------------------------------------------------------------------*
*       CLASS lcl_events IMPLEMENTATION
*----------------------------------------------------------------------*
*  SAL Event Handler Methods                                           *
*----------------------------------------------------------------------*
class lcl_events implementation.
  method on_link_click.

    field-symbols <lfs_it> type gtyp_claims_plus.
* Only respond to a single click when the user pointed to the CLAIM or
* the TRANSID column, in a specific row.
*
    read table gt_itab assigning <lfs_it>
        index row.
    if <lfs_it> is assigned.

      if column eq 'CLAIM'.
*  do what is needed...
      endif.

      if column eq 'TRANSID'.
        if <lfs_it>-transid is not initial.
* do something else.
      endif.  "value not initial.
    endif. "if <fs> assigned

    endif. "row in ALV obtained
  endmethod.                    "on_link_click
*
 endclass.                    "lcl_events IMPLEMENTATION

in your factory method call before -> display.

* Add Hotspot Handlers 
  create object gr_event_handler. "type ref to lcl_events.
  set handler gr_event_handler->on_link_click   for gr_events.

1 REPLY 1

Former Member

you need to handle...consider sample code below...adapt to you situation.:

*----------------------------------------------------------------------*
*       CLASS lcl_events DEFINITION
*----------------------------------------------------------------------*
* SALV Event Handler Definition                                        *
*----------------------------------------------------------------------*
class lcl_events definition.
  public section.
    methods:
    on_link_click for event link_click  "Hotspot Handler
      of cl_salv_events_table
      importing row column.
endclass.                    "lcl_events DEFINITION
*
data: gr_event_handler type ref to lcl_events.
*
*----------------------------------------------------------------------*
*       CLASS lcl_events IMPLEMENTATION
*----------------------------------------------------------------------*
*  SAL Event Handler Methods                                           *
*----------------------------------------------------------------------*
class lcl_events implementation.
  method on_link_click.

    field-symbols <lfs_it> type gtyp_claims_plus.
* Only respond to a single click when the user pointed to the CLAIM or
* the TRANSID column, in a specific row.
*
    read table gt_itab assigning <lfs_it>
        index row.
    if <lfs_it> is assigned.

      if column eq 'CLAIM'.
*  do what is needed...
      endif.

      if column eq 'TRANSID'.
        if <lfs_it>-transid is not initial.
* do something else.
      endif.  "value not initial.
    endif. "if <fs> assigned

    endif. "row in ALV obtained
  endmethod.                    "on_link_click
*
 endclass.                    "lcl_events IMPLEMENTATION

in your factory method call before -> display.

* Add Hotspot Handlers 
  create object gr_event_handler. "type ref to lcl_events.
  set handler gr_event_handler->on_link_click   for gr_events.