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: 

ALV-OOPS

Former Member
0 Kudos
121

Hi,

Please help to acheive my below requirement

In ALV Grid using methods, I want to store & manipulate the

contents of a column variable once when it is double clicked.

How to do the same.

Regards,

Usha.

1 ACCEPTED SOLUTION

Vinod_Chandran
Active Contributor
0 Kudos
93

For this you have to use events.

Check the program BCALV_TEST_GRID_EVENTS. This is good example.

4 REPLIES 4

jayanthi_jayaraman
Active Contributor
0 Kudos
93

Hi,

CLASS lcl_event_receiver DEFINITION DEFERRED.

class cl_gui_container definition load.

DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,

o_dockingcontainer TYPE REF TO cl_gui_docking_container,

o_eventreceiver TYPE REF TO lcl_event_receiver,

CLASS lcl_event_receiver 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.

ENDCLASS.

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_double_click.

  • The double click drill down processing should be

  • coded in the form below.

PERFORM f9803_handle_double_click USING e_row

e_column

es_row_no.

ENDMETHOD.

ENDCLASS.

FORM f9803_handle_double_click USING p_row

p_column

p_row_no.

DATA: lw_output LIKE LINE OF i_output.

READ TABLE i_output INDEX p_row INTO lw_output.

SET PARAMETER ID 'MAT' FIELD lw_output-matnr.

CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.

ENDFORM. " f9803_handle_double_click

In PBO of the screen,

module STATUS_9001 output.

...

SET HANDLER o_eventreceiver->handle_double_click FOR o_Alvgrid.

endmodule.

Former Member
0 Kudos
93

U can perform this operation in the double click event.

----


  • CLASS LCL_EVENT_RECEIVER DEFINITION

----


CLASS LCL_EVENT_RECEIVER DEFINITION.

  • Event receiver definitions for ALV actions

PUBLIC SECTION.

CLASS-METHODS:

  • Row Double click for dirll down.

HANDLE_DOUBLE_CLICK

FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

IMPORTING E_ROW

E_COLUMN

ES_ROW_NO.

ENDCLASS.

  • Implementation

***********************************************************************

  • Every event handler that is specified below should also be set after

  • the object has been created. This is done in the PBO processing.

  • with the following command

  • SET HANDLER oEventreceiver->handle_toolbar FOR o_Alvgrid.

***********************************************************************

CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.

*&----


*& Method handle_double_click

*&----


  • This method is called when the user double clicks on a line to drill

  • down.

  • The following are exported from the ALV

  • LVC_S_ROW

  • LVC_S_COL

  • LVC_S_ROID

*----


METHOD HANDLE_DOUBLE_CLICK.

  • The double click drill down processing should be

  • coded in the form below.

PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW

E_COLUMN

ES_ROW_NO.

ENDMETHOD.

ENDCLASS.

FORM f9007_handle_double_click USING p_row

p_column

p_row_no.

DATA: lw_output LIKE LINE OF i_output.

READ TABLE i_output INDEX p_row INTO lw_output.

IF sy-subrc = 0.

SET PARAMETER ID 'BUK' FIELD lw_output-bukrs.

SET PARAMETER ID 'BLN' FIELD lw_output-belnr.

SET PARAMETER ID 'GJR' FIELD lw_output-gjahr.

CALL TRANSACTION c_transaction_call_fb03 AND SKIP FIRST SCREEN .

ENDIF.

ENDFORM

In PBO,

SET HANDLER o_eventreceiver->handle_double_click FOR o_alvgrid.

This example will call transaction when clicked on a row.

Similarly u can try it out.

If u have any clarification kindly get back to me.

Thanks & Regards,

Judith.

Vinod_Chandran
Active Contributor
0 Kudos
94

For this you have to use events.

Check the program BCALV_TEST_GRID_EVENTS. This is good example.

ssimsekler
Active Contributor
0 Kudos
93

Hi Usha

You can refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf">An Easy Reference For ALV Grid Control</a>.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>