cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the reference of the currently focused cell in ALV ?

Former Member
0 Kudos

Hi Experts,

Can you please let me know if it's possible to retrieve the reference of the currently focused cell in ALV ?

I can see the view controller is having a method "REQUEST_FOCUS" through which I can set the focus to a particular UI element but in my ALV table I want the retrieve the reference of the cell which one is currently focused i. e i want to retrieve the position of the cursor (Row and Column id / reference )

Thanks in advance,

Sonia.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sonia,

Using attribute r_param you can get selected cell.

Cehck this..

Cheers,

Kris.

Former Member
0 Kudos

Hi Kris,

Thanks for your reply , but my editable ALV is having InputField as cell editor, so I am unable to capture the r_param value on on_click event of ALV.

My requirement is I want to add an additional button in toolbar and keeping my cursor in on editable input cell when I will click that button I want to display a pop-up window specific to that cell only.

Thanks for your help.

Sonia.

Former Member
0 Kudos

Hi Sonia,

Please check below thread.. follow sarbjeet answer, i think that will work for u.

OR You can change your focus like this...

for example : Try to modify according to your requirement.

Case lv_setfocus.

When 'G'.
lv_v_sort = view->get_element( 'VSORTENTER' ).
IF lv_v_sort IS BOUND.
view->request_focus_on_view_elem( lv_v_sort ).
ENDIF.
when 'M'.
lv_v_cinq = view->get_element( 'SUBMIT' ).
IF lv_v_cinq IS BOUND.
view->request_focus_on_view_elem( lv_v_cinq ).
ENDIF.
when 'H'.
lv_v_cpric = view->get_element( 'ENTERCUSTPRIC' ).
IF lv_v_cpric IS BOUND.
view->request_focus_on_view_elem( lv_v_cpric ).
ENDIF.
endcase.

Cheers,

Kris.

Former Member
0 Kudos

Hi Kris,

My requirement is not to change or set the focus to another cell in the table or to any other element in the view my requirement.

Let me give you the detailed requirement..

In my ALV table I have 4 columns a, b, c, d and all are InputFields.

Now the requirement is after entering the data/input in each of these columns for each row I should be able add some additional comments for each cell on clicking a button viz "Add comments" in the toolbar.

When I will keep my cursor in column 'a' for row1 and will click on 'Add comments' , one pop-up window should open where I can add some comments specific to that cell (column a for row 1).

In similar fashion I should be able to add comments for all the cells for each row.

So while keeping cursor on a particular cell (InputField)of a particular row when I will click "Add comments" , I should retrieve the details of the cell in which I have kept my cursor.

The idea is similar to get_focus... but I am not sure if this is at all achieve able or not ?

Hope I am able to explain the requirement clearly.

Please suggest.

Thanks,

Sonia

Former Member
0 Kudos

Hi Sonia,

I Think ON_CLICK event is works for you. R_PARAM has one attribute INDEX. it gives index of the row in which the cell with the UI element is located.

Check this...

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c9/6af78ae2794f71a9f303e7fc19323b/frameset.htm.

I am giving this idea.. i dont know this will work ot not for u.

For ex: Code like this..

LO_ND_BUTTON = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_BUTTON).
LO_EL_BUTTON  = LO_ND_BUTTON->GET_ELEMENT( R_PARAM->INDEX ).
 
IF R_PARAM->COLUMN = 'YOUR ATTRIBUTE". 
LO_EL_BUTTON->GET_ATTRIBUTE(
EXPORTING
NAME = 'YOUR ATTRIBUTE'
IMPORTING
VALUE = LV_BUTTON ).

OR

You can loop all column ids..

lt_columns = lt_column_settings->get_columns( ).

  LOOP AT lt_columns INTO ls_columns.
    lv_column = ls_columns-r_column.
    CASE ls_columns-id.
      WHEN 'DEALER '. // Your attribute

    // write code to set your comments here.
  ENDCASE.
ENDLOOP.

Cheers,

Kris.