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: 

How to make use of class cl_gui_alv_grid

Former Member
0 Kudos

Hi Expert,

I have an ALV which has been developed using Object Oriented Programming. Now i need to enable the push button, that will enable the users to select any row they want. i have investigated and found the i need to update the field SEL_MODE with the value 'A' in order to have this functionality working.

i have tried with my obect to call the method set_table_for_first_display, but i'm getting an errror message saying that it is protected or unknown..

Can anyone let me know on how to enable this functionality?

Thank you very much.

Nitin

2 REPLIES 2

karthik_vardhan
Explorer
0 Kudos

Hi ,

To enable Push button,

Handle this event BUTTON_CLICK of Cl_gui_alv_grid .

or u can use GET_SELECTED_ROWS method of CL_GUI_ALV_GRID for getting selected rows .

from that method u will get selected row indexes & Row ID's .

Former Member
0 Kudos

Hi,

refresh your objects when you use set_table_for_first_display.


  IF gr_custom_container IS NOT INITIAL.
    CALL METHOD gr_custom_container->free.
    CLEAR gr_custom_container.
  ENDIF.

  CREATE OBJECT gr_custom_container
         EXPORTING container_name = gv_container.

  CREATE OBJECT gr_grid
         EXPORTING i_parent = gr_custom_container.

  CALL METHOD gr_grid->set_table_for_first_display
    EXPORTING
      is_layout       = gs_layout
    CHANGING
      it_outtab       = gt_zalcrdata
      it_fieldcatalog = gt_catalog.

To get the selected rows you can use:


  CALL METHOD gr_grid->get_selected_rows
    IMPORTING
      et_row_no = gt_roid.

* Data variables used
DATA: gr_custom_container TYPE REF TO         cl_gui_custom_container,
      gr_grid             TYPE REF TO         cl_gui_alv_grid,
      gt_catalog    TYPE          lvc_t_fcat,
      gt_roid       TYPE          lvc_t_roid,
gs_layout     TYPE          lvc_s_layo.


Best regards,

John