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: 

on_double_click field value

Former Member
0 Kudos

Hi all,

with a doubleclick event handler I get the row and column where I have double clicked.

When I do a read on my table with the row as index, I get the clicked row in a structure.

But how do I get the value of the clicked field (column)?

I somehow have to cocattenate the structure and the column...

lf_value = ls_structure-column.

something like that, but how?

Greetings Fred.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

in the field E_COLUMN , you will be getting the column name double clicked,

and already you are reading the table to get that row,,

field-symbols : <FS> type any.

ASSIGN COMPONENT E_COLUMN OF STRUCTURE ls_structure TO <FS>.

<FS> will contain the value...

3 REPLIES 3

Former Member
0 Kudos

on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row

e_column

es_row_no.

CREATE OBJECT grid_container1

EXPORTING

container_name = 'CCONTAINER1'.

CREATE OBJECT grid1

EXPORTING

i_parent = grid_container1.

SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.

METHOD on_dubbelklik.

break-point 1.

ENDMETHOD.

e_column has the name of the column, es_row has the row number so you are in business.

Z_OBJECT references the instance of your class where you've defined all the bits and pieces (methods, events etc etc).

e.g

CLASS zcl_dog DEFINITION.

  • all your definitions and implementations.

Then from the application program instantiate the class

DATA: z_object type ref to zcl_dog,

CREATE OBJECT z_object EXPORTING z_object = z_object.

now call any method in the class

CALL METHOD z_object->****** Your method*

and you are all set.

Cheers

Jimbo

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hi Fred, there is a couple way to handle this. For example, if you have a few possible columns to handle the double click for. you can do something like this.

So you event handler would be like so.



CLASS CL_EVENT_RECEIVER IMPLEMENTATION.
  METHOD HANDLE_DOUBLE_CLICK.

  READ TABLE IALV into xalv INDEX e_row.
   check SY-SUBRC = 0.

case e_column.
   when 'MATNR'.
    SET PARAMETER ID 'MAT' FIELD xalv-MATNR.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
   when 'AUFNR'.
      set parameter id 'ANR' field xalv-aufnr.
      call transaction 'CO03' and skip first screen. 
ENDCASE.


  ENDMETHOD.
ENDCLASS.

Regards,

Rich Heilman

Former Member
0 Kudos

in the field E_COLUMN , you will be getting the column name double clicked,

and already you are reading the table to get that row,,

field-symbols : <FS> type any.

ASSIGN COMPONENT E_COLUMN OF STRUCTURE ls_structure TO <FS>.

<FS> will contain the value...