on 05-19-2006 8:50 PM
I have a very simple ALV table in a view in my application, and need to identify the row the user selected. Could someone please tell me what method I need to use and what the code should look like to identify the selected row in the ALV? Please keep simple (I'm still learning WDA).
OK, I added the data declaration. My module now looks like:
METHOD onactiondelete_row .
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
DATA lt_selected_rows TYPE lvc_t_roid .
DATA ls_selected_row TYPE lvc_s_roid .
<b>CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows.</b>
READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
IF sy-subrc NE 0 .
ENDIF.
ENDMETHOD.
I get a dump on the call method:
OBJECTS_OBJREF_NOT_ASSIGNED
Please help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you should read this similar thread:
Michelle Braun has done an excellent job of detailing the row selection mechanism within Web Dynpro ABAP/ALV.
I wouldn't suggest trying to mix the SAP Gui ALV classes (cl_gui_alv_grid) along with Web Dynpro logic. Further more you are trying to use a class reference (gr_alvgrid) without every instantiating it. I would abondond this approach (as it should only be used in classic dynpro) and follow the technique that Michelle has detailed.
Hi Bob,
Thomas is right. Your are mixing 2 different technologies.
- Michelle
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sharada K,
Your solution has me close to solving the problem.
However, you left out the data declaration, etc. for gr_alvgrid. Help anyone?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The code to identify the selected rows in an ALV is :
DATA lt_selected_rows TYPE lvc_t_roid .
DATA ls_selected_row TYPE lvc_s_roid .
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows .
READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
IF sy-subrc ne 0 .
ENDIF .
Hope this helps..
Regards,
Sharadha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
-
loop at r_param->t_modified_cells into ls_cell.
L_index = t_modified_cells-index.
-
(where r_param is a parameter of the event handler method created for handling ON_DATA_CHECK, L_index is your locally created variable to store the index/selected row number).
Hope this's useful!
Rgds,
Adi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.