ALV with IDA(ALVonHANA)-11

alv-ida

Cell Action on ALV

 

 

Interface IF_SALV_GUI_TABLE_IDA  provides method FIELD_CATALOG which returns reference of IF_SALV_GUI_FIELD_CATALOG_IDA.

12

Interface IF_SALV_GUI_FIELD_CATALOG_IDA  provides method DISPLAY_OPTIONS which provides a referenc of IF_SALV_GUI_FIELD_DISPLAY_OPT

34

The interface IF_SALV_GUI_FIELD_DISPLAY_OPT provides method  DISPLAY_AS_LINK_TO_ACTION  to enable link to action for the field an the event  CELL_ACTION

56

Event CELL_ACTION provides reference of IF_SALV_GUI_ROW_DATA_IDA which has a method GET_ROW_DATA to read the row data.

789

Code:


CLASS lcl_handle_ca DEFINITION.
  PUBLIC SECTION.
  METHODS handle_cell_action
        FOR EVENT cell_action OF if_salv_gui_field_display_opt
        IMPORTING ev_field_name eo_row_data.
ENDCLASS.

CLASS lcl_handle_ca IMPLEMENTATION.
  METHOD handle_cell_action.
    DATAls_sflight TYPE sflight.
   CHECK ev_field_name ‘CARRID’.
* read the row data
   eo_row_data->get_row_data(
     EXPORTING
       iv_request_type if_salv_gui_selection_ida=>cs_request_typeall_fields
     IMPORTING
       es_row ls_sflight ).
* Display the row data
cl_salv_ida_show_data_row=>displayiv_text ‘Flight Row Info’ is_data ls_sflight ).
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
DATAlr_salv TYPE REF TO if_salv_gui_table_ida,
      lr_handle TYPE REF TO lcl_handle_ca.
cl_salv_gui_table_ida=>create(
  EXPORTING
    iv_table_name       =  ‘SFLIGHT’
  RECEIVING
    ro_alv_gui_table_ida lr_salv ).

DATA(lr_fld_displr_salv->field_catalog)->display_options).
* Enable link to action
lr_fld_disp->display_as_link_to_actioniv_field_name ‘CARRID’ ).

CREATE OBJECT lr_handle.
SET HANDLER lr_handle->handle_cell_action FOR ALL INSTANCES.

* Display ALV
lr_salv->fullscreen)->display).


Output- Link to Action is enabled for the field CARRID.

10

One click we get the popup with row data.

11


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s