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

finding active ALV grid

former_member219399
Active Participant
0 Likes
692

Hi,

I have two editable ALV grids in my screen. I have created them thru custom containers. I want to know in which ALV my cursor is positioned. If I have selected a cell in first grid and then selected another cell in second grid, on executing get_current_cell fetching value for both the grids. How can I identify the cursor is in second grid and to execute the above method for the second grid only.

Thanks in advance.

With regards,

Vamsi

Hi,

I have two editable ALV grids in my screen. I have created them thru custom containers. I want to know in which ALV my cursor is positioned. If I have selected a cell in first grid and then selected another cell in second grid, on executing get_current_cell fetching value for both the grids. How can I identify the cursor is in second grid and to execute the above method for the second grid only.

Thanks in advance.

With regards,

Vamsi

4 REPLIES 4
Read only

Former Member
0 Likes
598

Hi Vamsi,

As you have two alv grids, you also have two alv controls, with this you can get information of the selected rows or cells.

CALL METHOD grid1->get_selected_rows

IMPORTING et_row_no = i_row_no.

CALL METHOD grid2->get_selected_rows

IMPORTING et_row_no = i_row_no.

Read only

0 Likes
598

Hi Kesav,

But I want to execute the code for 2nd grid only. ie. if my cursor in 2nd grid I want to execute it for 2nd grid. if it is in first grid, execute for first grid only. is there a way to clear selected cell in first grid if my cursor in 2nd grid?

thanks and regards,

Vamsi

Read only

0 Likes
598

Use the following method to get active alv


data: ACT_ALV type ref to cl_gui_control.
CALL METHOD cl_gui_control=>get_focus
     IMPORTING  control           = ACT_ALV
     EXCEPTIONS cntl_error        = 1
                cntl_system_error = 2.

get cell value using ACT_ALV->GET_CURRENT_CELL

Regards

Sridhar

Read only

0 Likes
598

Hi,

using the <b>SET_FOCUS</b> method you can see which one is active. and let me know do you want it using code.

Regards

vijay