Application Development and Automation 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: 
Read only

double click help

Former Member
0 Likes
1,339

Hallow

I doing alv report and I wont to use double click.

when the user click on one row in the first Colman it open a small window like popup (popup_tab) and he can choose their on click.

How can I do that, its my first time and it not working

What I doing wrong?

<b>any Tipp will help</b>

Regards

This is my code

&----


*& Class USED QUOTA CLASS

&----


  • Text

----


CLASS class DEFINITION.

PUBLIC SECTION.

METHODS:

handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column.

PRIVATE SECTION.

ENDCLASS. "USED QUOTA CLASS

& Class (Implementation) quota_class

&----


  • Text

----


CLASS class IMPLEMENTATION.

METHOD handle_double_click.

DATA: wa_pop_tab LIKE LINE OF pop_tab.

READ TABLE pop_tab INDEX e_row-index INTO wa_pop_tab.

CALL SCREEN 200.

ENDMETHOD. "handle_double_click

*----


MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

gs_layout-grid_title = text-020.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_Q4_STR'

  • it_toolbar_excluding = gt_exclude

is_layout = gs_layout

is_variant = variant

i_save = 'A'

CHANGING

it_outtab = itab

it_fieldcatalog = fcat. " FOR FIELD CATALOG

ENDIF.

ENDMODULE.

FORM create_field_cat .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'YHR_Q4_STR' "STRUCTRE NAME

CHANGING

ct_fieldcat = ct_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

ENDIF.

LOOP AT ct_fieldcat INTO wa_fieldcat.

MOVE-CORRESPONDING wa_fieldcat TO wa_fcat.

CASE wa_fieldcat-fieldname.

WHEN 'OBJID'.

wa_fcat-coltext = text-001.

wa_fcat-outputlen = 9.

ENDCASE.

APPEND wa_fcat TO fcat.

CLEAR wa_fcat.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,311

please go through the prog BCALV_GRID_03

regards

shiba dutta

13 REPLIES 13
Read only

Former Member
0 Likes
1,311

Hi Antonio ,

Is this your whole code for the report or is it just for the pop-up ?

Regards

Read only

0 Likes
1,311

hi Caglar Ozkor

this is my all code excpet the select statment

regards

Read only

Former Member
0 Likes
1,312

please go through the prog BCALV_GRID_03

regards

shiba dutta

Read only

0 Likes
1,311

hi SHIBA

i try that but i dont understand how i refer to just first colman in alv

and their choose just one row.

and how i call to my table pop_tab in double click

regards

Read only

0 Likes
1,311

Hi Antonio ,

As said in my previous post you class definition and implementation is not complete , in the calss definition you need to define a method for the event DOUBLE_CLICK of the class CL_GUI_ALV_GRID , this even has three parameters E_ROW , E_COLUMN , ES_ROW_NO , so you will get the row and the column on which the user had clicked.

Here is a sample of how you class definition must look

**--> Class for event handeling

class event_handler definition.
  public section.
    methods : handle_double_click
                for event double_click
                of cl_gui_alv_grid
                importing e_row 
                             e_column.
endclass.

Please do refer to the standard program for more info.

Regards

Arun

Read only

Former Member
0 Likes
1,311

Hi Antonio ,

Your class implementation does not seem to be complete , you need to first get the record on which the user clicked .

Please refer to the standard programs provided .They start with BCALV_GRID*.

Regards

Arun

Read only

0 Likes
1,311

hi Arun R

maybe u have an idea how to change that

regards

Read only

Former Member
0 Likes
1,311
CLASS LCL_EVENT_RECEIVER DEFINITION.

  PUBLIC SECTION.
    METHODS:
*method used for double click
    HANDLE_DOUBLE_CLICK
        FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW E_COLUMN.

ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION


CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*implementation of the method double click
  METHOD HANDLE_DOUBLE_CLICK.


IF E_COLUMN = 'COL1'.  "<---- To ensure first column is clicked , chk the fieldname of column 1
      READ TABLE ITAB INTO WA_ITAB INDEX E_ROW-INDEX.
         CALL SCREEN 200.

    ENDIF.
  ENDMETHOD.                    "handle_double_click
Read only

0 Likes
1,311

hi Chandrasekhar

did i have to change my alv or field catalog defntion or its o.k.

regards

Read only

0 Likes
1,311

Hi ,

No change in the feild catalog is required , but as anil has mentioned in his post do remember to register a handler , other wise the method will not be called.

Regards

Arun

Read only

0 Likes
1,311

hi antonio,

You have to change ur fieldcatalog , while using containers u have to use FM LVC_FIELDCATALOG_MERGE

data : pt_fieldcat type table of lvc_t_fcat.

call function 'LVC_FIELDCATALOG_MERGE'
       exporting
            i_structure_name = 'SFLIGHT'
       changing
            ct_fieldcat      = pt_fieldcat.

Read only

0 Likes
1,311
" add the below 2 lines at the top of ur code 

*for event handling
CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
DATA : W_EVENT_RECEIVER    TYPE REF TO LCL_EVENT_RECEIVER.

"also add this after calling SET_TABLE_FOR_FIRST_DISPLAY

*cretes an instance of event receiver class
  CREATE OBJECT W_EVENT_RECEIVER.

*sets double click event
  SET HANDLER W_EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR W_GRID.
Read only

Former Member
0 Likes
1,311

Hi Antonio,

You haven't set the handler for the grid.

You can code that directly after you set the data for first display.

event_receiver type ref to <class>.

create object event_receiver.

set handler event_receiver->handle_double_click for grid3.