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

ALV using OOPS

Former Member
0 Likes
611

Hi Experts,

We are having two ALV GRIDS on a single screen. When a particular field (say date) is clicked in GRID 1, the second grid (GRID2) should appear on the same screen with flight details for that particular date.

We are using the following

1. We are creating a OOPS ALV program , we have our output in the ALV grid with a date display in that with a HOTSPOT link. Clicking on the hotspot link should display other output in the same screen in a ALV grid. For this we are using grid Container.

To catch that hotspot click, we are using a custom methods as below

METHOD handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm.

METHOD handle_hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id es_row_no .

2. We are calling this method in the PAI event of the 1st grid output screen.

3. While debugging the code we identified that the module in PAI event is not getting called.

Request you to suggest a solution.

The classes we use for this program are

CL_GUI_ALV_GRID.

CL_GUI_CUSTOM_CONTAINER.

4 REPLIES 4
Read only

Former Member
0 Likes
563

Hi,,

try this std program...BCALV_GRID_05

it has the same requirment.

regards

vivek

Read only

Former Member
0 Likes
563

Hi,

DATA :  w_eventrec TYPE REF TO lcl_event_receiver "lcl_event_receiver is your class where hot spot methods are define.

"IN PBO of the first grid before displaying alv write the below code

CREATE OBJECT w_eventrec.

      SET HANDLER w_eventrec->handle_hotspot_click FOR w_alvgrid.
      SET HANDLER w_eventrec->handle_double_click FOR w_alvgrid.

Hope this help

Read only

Former Member
0 Likes
563

Hello,

For handling events in ALv using OOP, you need to follow the below steps,

1) create a local class for event handling.

2) define the method for event handling in the class.

3) Implement the method.

4) create an instance of enevt handler.

5) using this instance link the event handling methods to the ALV grid instance.

eg:

CLASS <lcl_event_handler> DEFINITION .

PUBLIC SECTION .

METHODS:

*Hotspot click control

<handle_hotspot_click>

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id es_row_no .

PRIVATE SECTION.

ENDCLASS.

CLASS <lcl_event_handler> IMPLEMENTATION .

*Handle Hotspot Click

METHOD <handle_hotspot_click> .

PERFORM <handle_hotspot_click> USING e_row_id e_column_id es_row_no .

" Implement this subroutine.

ENDMETHOD .

ENDCLASS .

DATA <gr_event_handler> TYPE REF TO <lcl_event_handler> .

*--Creating an instance for the event handler

CREATE OBJECT <gr_event_handler> .

*--Registering handler methods to handle ALV Grid events

SET HANDLER <gr_event_handler> -> <handle_hotspot_click> FOR <gr_alvgrid> .

"<gr_alvgrid> is ALV grid Instance used to call the method for diplay ALV.

.....

Now once you click the hotspot in ALV grid,

the PERFORM <handle_hotspot_click> will be callled.

You can write your reqd code to display the other grid in the subroutine.

Regards.

Sachinkumar Mehta

Read only

Former Member
0 Likes
563

see the standard report BCALV_GRID_02 and BCALV_GRID_03 u double click on any column it will open second window booking window