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

Recognize with ALV Instance has been selected.

SantiMoreno
Participant
0 Likes
757

Hi everybody.

I'm not sure how to perform the next situation:

I'm working with two ALV Grid (OO) at the same time. I have defined an Exit Handler class to get the value of a field since a double-click perform. Obviously each ALV has an own fcat and data.

Is it there a way to determine which ALV Instance has been double-clicked to get data just for its corresponding data table, or I shorld do it directly?

Can I use a method such like cl_exithandler=>get_instance (obviously if there's one available?

Cheers!!

I would highly reward a good question.

1 ACCEPTED SOLUTION
Read only

alejandro_lpez
Contributor
0 Likes
695

Hi Santiago,

If you are using version 4.6c or superior. You can define the importing parameter SENDER in the method that is called for double_click event. Something like this:

CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS: get_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING row

SENDER.

ENDCLASS.

DATA: event_handler TYPE REF TO lcl_event_handler.

CLASS lcl_event_handler IMPLEMENTATION.

METHOD get_double_click

if sender = alv_grid1.

do something...

elseif sender = alv_grid2.

...

endif.

ENDMETHOD.

ENDCLASS.

regards,

Alejandro

Hi everybody.

I'm not sure how to perform the next situation:

I'm working with two ALV Grid (OO) at the same time. I have defined an Exit Handler class to get the value of a field since a double-click perform. Obviously each ALV has an own fcat and data.

Is it there a way to determine which ALV Instance has been double-clicked to get data just for its corresponding data table, or I shorld do it directly?

Can I use a method such like cl_exithandler=>get_instance (obviously if there's one available?

Cheers!!

I would highly reward a good question.

5 REPLIES 5
Read only

Former Member
0 Likes
695

Do need to identify which instance.

it will take u to the exact instance of the alv.

I think u have written diffrent defination for different instance

Make different Event reciever for different instance

o_evt_rcvr1 TYPE REF TO lcl_event_receiver1. for first instance

o_evt_rcvr2 TYPE REF TO lcl_event_receiver2. for first instance

and raise Event for different instnace

*Set the event handlers for first instance

SET HANDLER o_evt_rcvr1->double_click FOR o_alvgrid1.

*Set the event handlers for second instance

SET HANDLER o_evt_rcvr2->double_click FOR o_alvgrid2.

It will Take u to the Exact defination

Message was edited by: Manoj Gupta

Read only

0 Likes
695

so, what you mean is that I have to define to instances of the event handler class, don't I?

But, may the event handler class be the same for both instances?

Cheers!

Read only

0 Likes
695

Well unfortunately you will define two different event receivers one for each grid. As the problem is that you cannot identify the instance of the grid on which the event has happened.

Probably you can differentiate using the column name on which the double click has happened provided there are no common columns. Then you need to know which column exists in which grid.

Makes sense?

Regards,

Ravi

Note : Please mark the helpful answers

Read only

alejandro_lpez
Contributor
0 Likes
696

Hi Santiago,

If you are using version 4.6c or superior. You can define the importing parameter SENDER in the method that is called for double_click event. Something like this:

CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS: get_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING row

SENDER.

ENDCLASS.

DATA: event_handler TYPE REF TO lcl_event_handler.

CLASS lcl_event_handler IMPLEMENTATION.

METHOD get_double_click

if sender = alv_grid1.

do something...

elseif sender = alv_grid2.

...

endif.

ENDMETHOD.

ENDCLASS.

regards,

Alejandro

Read only

0 Likes
695

By the way,

Once I have selected a row of the ALV Grid, is it there any way to force an automatic refresh of the full dynpro.

The thing is that when I select the row, the field is not show in the destiny field (an output field) until I press Intro.

Is it there any solution to this?

Cheers.