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: 

Can I have multiple hotspots on the same ALV grid?

Former Member
0 Kudos

Hi,

I have a simple ALV grid report with a hotspot. I can't seem to find any examples or information on whether I can have 2 hotspots on the same ALV grid line.

Is this possible and is there an example somewhere that I can look at?

Thanks for your help!

Andy

1 ACCEPTED SOLUTION

Former Member
0 Kudos

sure you can. You can have up to number of fields in ALV hotspots.

in your routine where you react on the hotspot click do a:

case on the clicked field.

like


CASE column.
      WHEN 'VBELN'.
        SET PARAMETER ID 'AUN' FIELD gs_data_detail2-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      WHEN 'EBELN'.
        SET PARAMETER ID 'BES' FIELD gs_data_detail2-ebeln.
        CALL TRANSACTION 'ME23N'." AND SKIP FIRST SCREEN.
      WHEN OTHERS.
*       ...
    ENDCASE.

8 REPLIES 8

Former Member
0 Kudos

sure you can. You can have up to number of fields in ALV hotspots.

in your routine where you react on the hotspot click do a:

case on the clicked field.

like


CASE column.
      WHEN 'VBELN'.
        SET PARAMETER ID 'AUN' FIELD gs_data_detail2-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      WHEN 'EBELN'.
        SET PARAMETER ID 'BES' FIELD gs_data_detail2-ebeln.
        CALL TRANSACTION 'ME23N'." AND SKIP FIRST SCREEN.
      WHEN OTHERS.
*       ...
    ENDCASE.

0 Kudos

Florian,

Thank you for the reply.

So on my Event Definition how do I code the IMPORTING parameter?

This is how it is now:

METHODS: on_link_click FOR EVENT link_click OF cl_salv_events_table

IMPORTING row.

Andy

0 Kudos

Check the code below


  METHODS:set_hotspot_ebeln CHANGING pc_alv TYPE REF TO cl_salv_table
                                     pc_report TYPE REF TO lcl_report.

*--Event Handlers for alv
    METHODS:on_link_click FOR EVENT link_click OF cl_salv_events_table
                          IMPORTING row column .

METHOD set_hotspot_ebeln.

    DATA: lf_cols_tab TYPE REF TO cl_salv_columns_table,
          lf_col_tab  TYPE REF TO cl_salv_column_table.
    DATA: lf_events TYPE REF TO cl_salv_events_table.

    lf_cols_tab = pc_alv->get_columns( ).

    TRY.
        lf_col_tab ?= lf_cols_tab->get_column( 'VGBEL' ).
      CATCH cx_salv_not_found.
    ENDTRY.

    TRY.
        CALL METHOD lf_col_tab->set_cell_type
          EXPORTING
            value = if_salv_c_cell_type=>hotspot. "5-stands for hot spot
      CATCH cx_salv_data_error .
    ENDTRY.


    TRY.
        lf_col_tab ?= lf_cols_tab->get_column( 'VBELN' ).
      CATCH cx_salv_not_found.
    ENDTRY.


    TRY.
        CALL METHOD lf_col_tab->set_cell_type
          EXPORTING
            value = if_salv_c_cell_type=>hotspot. "5-stands for hot spot
      CATCH cx_salv_data_error .
    ENDTRY.

    lf_events = pc_alv->get_event( ).
*--Set event handler for click on cell
    SET HANDLER lf_report->on_link_click FOR lf_events.

  ENDMETHOD.                    "set_hotspot_ebeln

  METHOD on_link_click.

    DATA:la_put TYPE type_put.

    READ TABLE lf_report->i_put INTO la_put INDEX row.
    CHECK sy-subrc = 0.
    if column = 'VGBEL'.
    SET PARAMETER ID 'BES' FIELD la_put-vgbel.
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    elseif column = 'VBELN'
   "<----
   endif.

  ENDMETHOD.                    "on_link_click

0 Kudos

Hi Andrew,

You can use,

METHODS: handle_hotspot

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id

for hotspot.

Hope it helps.

Sujay

0 Kudos

Excellent...thank you very much!!!

0 Kudos

For more details please check the programs

SALV_DEMO_TABLE_EVENTS

SALV_DEMO_TABLE_FORM_EVENTS

0 Kudos

Thank you.

Former Member
0 Kudos

Thanks you all!