07-12-2006 1:23 PM
I need to get selected rows from my alv grid .
I need to handle and event or introduce a selection field on my internal table?
Thanks
07-12-2006 1:41 PM
Hi jorge,
check this link:
http://www.sapgenie.com/abap/controls/alvgrid.htm
reward if helpful.
regards,
kerthi.
07-12-2006 1:25 PM
hi,
use method CL_GUI_ALV_GRID->GET_SELECTED_ROWS
sample:
DATA rows TYPE lvc_t_row.
DATA wa_row TYPE lvc_s_row.
CALL METHOD grid->get_selected_rows
IMPORTING
et_index_rows = rows.
LOOP AT rows INTO wa_row.
...
Andreas
Message was edited by: Andreas Mann
07-12-2006 1:30 PM
Hi Jorge,
try this...
DATA: IT_ORDERS_SELECTED TYPE ZAUTO_T_T_ORDERS,
WA_SELECTED_ROW TYPE LVC_S_ROID.
*--getting the selected row indexes
CALL METHOD OBJ_GRID_DETAIL->GET_SELECTED_ROWS
IMPORTING
ET_ROW_NO = IT_SELECTED_ROWS.
this table will have all the row numbers selected
*--loop through the selected rows to get the row no's
REFRESH IT_ORDERS_SELECTED.
LOOP AT IT_SELECTED_ROWS INTO WA_SELECTED_ROW.
....write the logic here like reading the internal table with index WA_SELECTED_ROW-ROW_ID....
ENDLOOP.
Regards,
Vidya.
07-12-2006 1:41 PM
Hi jorge,
check this link:
http://www.sapgenie.com/abap/controls/alvgrid.htm
reward if helpful.
regards,
kerthi.
07-12-2006 3:18 PM
With the method GET_SELECTED_ROWS obtain the selected rows.
Mi answer is how to select rows ,how we create the buttons for selecting rows by the final user .
do I need to use something more ?
07-12-2006 3:28 PM
You can set the SELECTION MODE to 'D' in the layout.
LAYOUT-SEL_MODE = 'D'.
Then you can call the GET_SELECTED_ROWS method.
Regards,
Ravi
Note : Please mark all the helpful answers
07-12-2006 3:33 PM
Hi Jorge,
User can selet the rows by selecting the box which comes as first column in ALV GRId
or
u can use a check box in internal table and user can check then and u can loop at itab where checkbox = 'X' to get the selected records
07-12-2006 3:35 PM
Hi,
pass layout paramaters like below :
DATA : x_layout TYPE lvc_s_layo.
x_layout-sel_mode = 'A'.
Pass x_layout to method 'set_table_for_first_display'.
CALL METHOD x_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = x_layout
output of the ALV will contain buttons
Regards
Appana
07-12-2006 4:43 PM
Hi Jorge,
try this....
set the X_LAYOUT-SEL_MODE = 'C'. (this will enable you to select multiple rows)...
now pass this layout ...
CALL METHOD OBJ_GRID_DETAIL->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = X_LAYOUT
IS_VARIANT = X_VARIANT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FLDCAT_DETAILS
IT_OUTTAB = 'table to be displayed'
hope this helps..
Regards,
Vidya