‎2007 Apr 17 9:17 AM
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.
‎2007 Apr 17 9:30 AM
‎2007 Apr 17 9:23 AM
Hi Antonio ,
Is this your whole code for the report or is it just for the pop-up ?
Regards
‎2007 Apr 17 9:41 AM
hi Caglar Ozkor
this is my all code excpet the select statment
regards
‎2007 Apr 17 9:30 AM
‎2007 Apr 17 9:46 AM
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
‎2007 Apr 17 10:01 AM
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
‎2007 Apr 17 9:45 AM
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
‎2007 Apr 17 9:54 AM
‎2007 Apr 17 9:54 AM
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
‎2007 Apr 17 10:05 AM
hi Chandrasekhar
did i have to change my alv or field catalog defntion or its o.k.
regards
‎2007 Apr 17 10:08 AM
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
‎2007 Apr 17 10:09 AM
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.
‎2007 Apr 17 10:14 AM
" 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.
‎2007 Apr 17 9:59 AM
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.