12-18-2008 10:01 AM
Hi all,
I have a screen. In the screen , I have 2 custom container and each custom container has 1 alv grid control.
I need to handle double click event for both of alv grid controls in my screen.
I defined 2 local event handler class for each alv grid and defined 2 handle_double_click event.
In the first Alv grid double click works fine , everything is ok, world is peaceful.
But in the second alvgrid, the row parameters (E_ROW, E_COLUMN, ES_ROW_NO) comes initial so i cannot handle it.
All i need is to call a different transaction (displaying the equipment-IE03) when user double-click on a field in the second alv grid control. I tried to use hotspot_click event too but it does'nt give the row id either.
I read some posts in the forms ([|]).
I tried everything but nothing works.
Please help. Your answers will be appreciated.
12-29-2008 3:55 AM
Hi,
Hope you are not using both hotspot & double click.
check for refgrid you are assigning.
check event_receiver1.
SET HANDLER event_receiver1->handle_hotspot_click FOR ref_grid.
Thanks,
Krishna...
12-18-2008 12:04 PM
12-18-2008 12:58 PM
I had similar requirement.
I had to show two ALV grids, one should have PO details, other should have PR details.
Clicking the lines should take you to respective document display (ME23N for PO & ME53N for PR)
I have done it in this way, just have a look, it might help you.
Event Receiver Class Definition
CLASS LCL_EVENT_RECEIVER DEFINITION.
* Definition:
* ~~~~~~~~~~~
PUBLIC SECTION.
DATA: W_ALV_NAME(2) TYPE C.
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS.
See the variable w_alv_name defined in the public section above. With this I identify which grid did the user click upon.
Create Event Receiver object
Assign Event Receiver object a Name as 'PO'
Set the event receiver handler for the grid of PO
* Define event receiver
DATA PO_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
* Create event receiver.
CREATE OBJECT PO_EVENT_RECEIVER.
PO_EVENT_RECEIVER->W_ALV_NAME = 'PO'.
* Set the handler for hotspot click event.
SET HANDLER PO_EVENT_RECEIVER->HANDLE_HOTSPOT_CLICK FOR PO_GRID.
Create one more object of LCL_EVENT_RECEIVER.
Assign Event Receiver object a Name as 'PR'
Set the event receiver handler for the grid of PR
* Define event receiver
DATA PR_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
* Create event receiver.
CREATE OBJECT PR_EVENT_RECEIVER.
PR_EVENT_RECEIVER->W_ALV_NAME = 'PR'.
* Set the handler for hotspot click event.
SET HANDLER PR_EVENT_RECEIVER->HANDLE_HOTSPOT_CLICK FOR PR_GRID.
Event Receiver Implementation
In the Event receiver implementation check the name before further action.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD: HANDLE_HOTSPOT_CLICK.
IF E_ROW_ID-ROWTYPE IS INITIAL.
IF ME->W_ALV_NAME = 'PO'.
READ TABLE IT_PO INTO WA_PO INDEX E_ROW_ID-INDEX.
W_EBELN = WA_PO-EBELN.
SET PARAMETER ID 'BES' FIELD W_EBELN.
CALL TRANSACTION 'ME23N'.
ELSEIF ME->W_ALV_NAME = 'PR'.
READ TABLE IT_PR INTO WA_PR INDEX E_ROW_ID-INDEX.
W_BANFN = WA_PR-BANFN.
SET PARAMETER ID 'BAN' FIELD W_BANFN.
CALL TRANSACTION 'ME53N'.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
12-21-2008 10:41 AM
Thank you Abhijit, but it didn't work.
I did the same think but e_row-index is still initial.
The difference between my codes and yours is that when i double-click my first ALV , the details shows up in the second ALV. I mean it is like headers and details. When I double-click the main ALV everything works fine, but when i double-click the second (details ALV) i can not handle the double_click event because row parameters are initial. I am about to go crazy.
Here is my codes. May be somebody can see my mistake if i have one.
DEFINITIONS
*---------------------------------------------------------------------*
* Class definitions
*---------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION DEFERRED.
DATA: gr_event_handler TYPE REF TO lcl_event_handler.
DATA: g2_event_handler TYPE REF TO lcl_event_handler.
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
DATA: clv_alv_name(3) TYPE c.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column es_row_no sender,
PRIVATE SECTION.
ENDCLASS. "lcl_event_h
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION .
METHOD handle_double_click .
BREAK-POINT.
IF me->clv_alv_name = 'HDR'.
PERFORM handle_double_click USING e_row e_column es_row_no .
ELSEIF me->clv_alv_name = 'DET'.
"* THE PROBLEM IS : E_ROW COMES INITIAL HERE*
PERFORM handle_double_click_det USING e_row e_column es_row_no .
ENDIF.
ENDMETHOD . "handle_double_click
ENDCLASS . "lcl_event_handler IMPLEMENTATION
handle_double_click Routines
FORM handle_double_click USING i_row TYPE lvc_s_row
i_column TYPE lvc_s_col
is_row_no TYPE lvc_s_roid.
READ TABLE gt_main INDEX i_row-index.
REFRESH g2_data.
LOOP AT gt_data WHERE zz_modelkd = gt_main-zz_modelkd
AND zz_must_top = gt_main-zz_must_top.
APPEND gt_data TO g2_data.
ENDLOOP.
CALL METHOD g2_alvgrid->refresh_table_display.
ENDFORM. " HANDLE_DOUBLE_CLICK
*----------------------------------------------------------------------*
FORM handle_double_click_det USING e_row TYPE lvc_s_row
e_column TYPE lvc_s_col.
es_row_no TYPE lvc_s_roid.
READ TABLE g2_data INDEX e_row-index.
" *IT CAN NOT READ TABLE BECAUSE e_row-index is initial*
.....
ENDFORM. " HANDLE_DOUBLE_CLICK
DISPLAY_ALVGRIDS
MODULE display_alvgrids OUTPUT.
IF gr_alvgrid IS INITIAL .
PERFORM display_alvgrid_main.
ELSE .
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
STOP.
ENDIF.
ENDIF .
IF g2_alvgrid IS INITIAL .
PERFORM display_alvgrid_detail.
ELSE .
CALL METHOD g2_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
STOP.
ENDIF.
ENDIF .
ENDMODULE. " display_alvgrids
*----------------------------------------------------------------------*
FORM display_alvgrid_main .
...
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = 'A'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = gt_main[]
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
STOP.
ENDIF.
CREATE OBJECT gr_event_handler .
gr_event_handler->clv_alv_name = 'HDR'.
SET HANDLER gr_event_handler->handle_double_click FOR
gr_alvgrid .
ENDFORM. " DISPLAY_ALVGRID_MAIN
*----------------------------------------------------------------------*
FORM display_alvgrid_detail.
...
CALL METHOD g2_alvgrid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = 'A'
is_layout = g2_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = g2_data[]
it_fieldcatalog = g2_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
STOP.
ENDIF.
CREATE OBJECT g2_event_handler.
g2_event_handler->clv_alv_name = 'DET'.
SET HANDLER g2_event_handler->handle_double_click FOR g2_alvgrid.
ENDFORM. " DISPLAY_ALVGRID_DETAIL
-
12-24-2008 7:53 PM
Hello ,
Does anyone have an answer to my question please ?
Regards.
.
12-28-2008 8:04 PM
Hello Eagle
There is no need for a second event handler (although you can use this approach). Instead, add the optional parameter SENDER to you event handler method definition. Within the implementation you can distinguish the event raising control using this parameter.
For a sample report have a look at ZUS_SDN_THREE_ALV_GRIDS in thread
The crucial parts of the coding are shown below:
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " NOTE: Optional parameter, can be added to any event handler method
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap.
CASE sender.
WHEN go_grid1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
WHEN go_grid2.
READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN go_grid3.
...
Regards
Uwe
12-29-2008 3:55 AM
Hi,
Hope you are not using both hotspot & double click.
check for refgrid you are assigning.
check event_receiver1.
SET HANDLER event_receiver1->handle_hotspot_click FOR ref_grid.
Thanks,
Krishna...
01-02-2009 4:33 PM
Thanks Uwe but it didn't work.
when i use method or g2_alvgrid->get_current_cell SY-SUBRC gets value 4.
CALL METHOD g2_alvgrid->get_current_cell
IMPORTING
e_row = i_row.
And i use the method g2_alvgrid->set_current_cell_via_id the row numbers comes initial. It is not working
CALL METHOD g2_alvgrid->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
01-02-2009 4:35 PM
Thanks Krishna,
Yes i was using both hotspot & double click. But i think the problem was not that.
After your warning i deleted the method handle_click_hotspot. But still does not work.
01-03-2009 2:58 PM
Hello Eagle
I am not sure where the problem lies in your case but sample report ZUS_SDN_THREE_ALV_GRIDS_01 shows that you can always find out the current cell after the double-click event (in any case you have the current cell already as IMPORTING parameters of the event):
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_THREE_ALV_GRIDS_01
*&
*&---------------------------------------------------------------------*
*& Flow logic of screen '0100' (no screen elements, ok-code => GD_OKCODE):
** PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
***
** PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
*&---------------------------------------------------------------------*
*& Thread: problem in handling double click in the second alv grid control
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1172052"></a>
*&---------------------------------------------------------------------*
REPORT zus_sdn_three_alv_grids_01.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
*
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_outtab TYPE STANDARD TABLE OF vbak,
gt_outtab_2 TYPE STANDARD TABLE OF vbap,
gt_outtab_3 TYPE STANDARD TABLE OF vbep.
**PARAMETERS:
** p_bukrs TYPE bukrs DEFAULT '1000'.
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
ms_row TYPE lvc_s_row,
ms_col TYPE lvc_s_col.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_outtab TYPE vbak,
ls_outtab_2 TYPE vbap,
ls_outtab_3 TYPE vbep.
" Initialize class data
CLEAR: ms_row,
ms_col.
CASE sender.
WHEN go_grid1.
ms_row = e_row.
ms_col = e_column.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'GET_ITEMS'
* IMPORTING
* rc =
.
WHEN go_grid2.
ms_row = e_row.
ms_col = e_column.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'GET_SCHEDULE_LINES'
* IMPORTING
* rc =
.
WHEN go_grid3.
** READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
** CHECK ( ls_vbap-matnr IS NOT INITIAL ).
** SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
** CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM vbak INTO TABLE gt_outtab UP TO 100 ROWS.
PERFORM init_controls.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_outtab
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_outtab_2.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_outtab_2 " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_outtab_3.
CALL METHOD go_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'VBEP'
CHANGING
it_outtab = gt_outtab_3 " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro:
*
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
**
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "ORDERS"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Refresh display of detail ALV list
CALL METHOD go_grid3->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
" Double-click on first or second ALV grid
WHEN 'GET_ITEMS' OR
'GET_SCHEDULE_LINES'.
PERFORM get_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form INIT_CONTROLS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
* Create 2nd splitter container
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_cell_left
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid3
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
ENDFORM. " INIT_CONTROLS
*&---------------------------------------------------------------------*
*& Form GET_DETAILS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_details .
* define local data
DATA: ls_row TYPE lvc_s_row,
ls_col TYPE lvc_s_col.
data: ls_outtab type vbak,
ls_outtab_2 type vbap,
ls_outtab_3 type vbep.
BREAK-POINT.
CASE gd_okcode.
WHEN 'GET_ITEMS'.
CALL METHOD go_grid1->get_current_cell
IMPORTING
* e_row =
* e_value =
* e_col =
es_row_id = ls_row
es_col_id = ls_col
* es_row_no =
.
read TABLE gt_outtab into ls_outtab index ls_row-index.
refresh: gt_outtab_2,
gt_outtab_3.
SELECT * FROM vbap into TABLE gt_outtab_2
WHERE vbeln = ls_outtab-vbeln.
WHEN 'GET_SCHEDULE_LINES'.
CALL METHOD go_grid2->get_current_cell
IMPORTING
* e_row =
* e_value =
* e_col =
es_row_id = ls_row
es_col_id = ls_col
* es_row_no =
.
READ TABLE gt_outtab_2 into ls_outtab_2 index ls_row-index.
refresh: gt_outtab_3.
SELECT * FROM vbep into TABLE gt_outtab_3
WHERE vbeln = ls_outtab_2-vbeln
AND posnr = ls_outtab_2-posnr.
WHEN OTHERS.
RETURN.
ENDCASE.
IF ( lcl_eventhandler=>ms_row = ls_row AND
lcl_eventhandler=>ms_col = ls_col ).
MESSAGE 'Current cell identical' TYPE 'I'.
ELSE.
MESSAGE 'Current cell NOT identical' TYPE 'I'.
ENDIF.
ENDFORM. " GET_DETAILS
Regards
Uwe
01-27-2009 8:38 AM
Hello,
I solved this problem 2 weeks ago and i just realized i did'nt close this post.
I will explain my mistake in case anyone has a problem like this.
In the second ALV grid, there was also another methods than handle_double_click;
1) "handle_data_changed" for "data_changed" event . I was checking the input data in this method.
2) "handle_data_changed_finished" for "data_changed_finished" event. I was changing one field in according to the entry in this method. (User was entering production week and year , i was finding the month in this method with given week and year, and display it in another field of alv.)
In handle_data_changed_finished there was "refresh_table_display" method.
When i double click a row in the ALV Grid control first it was calling the handle_data_changed_finished (which i don't know why) and then it was calling handle_double_click method. The data_changed_finished event works before double_click event surprisingly when you double click. That is why "refresh_table_display" method was working before double_click event in my code and it was clearing the selected row ids in runtime.
Good works everyone.
Thanks.