12-04-2007 3:36 PM
Hi Experts,
I got a problem with ALV like this:
I have an ALV grid display. Now, I have to select one row from this grid and
display it through subscreen. My problem is how to read the selected row:
Is there any means:
I am new to ABAP so please tell me simple interactive way, but not in OOPS.
Thanks in advance,
12-04-2007 3:53 PM
Try this
CALL METHOD grid1->get_current_cell
IMPORTING
es_row_id = ws_row_id
es_col_id = ws_col_id
es_row_no = lvc_s_roid.
READ TABLE <<ITAB>> into <<WORKAREA>> INDEX ws_row_id-index.
Thanks
Pavan
12-04-2007 3:53 PM
Try this
CALL METHOD grid1->get_current_cell
IMPORTING
es_row_id = ws_row_id
es_col_id = ws_col_id
es_row_no = lvc_s_roid.
READ TABLE <<ITAB>> into <<WORKAREA>> INDEX ws_row_id-index.
Thanks
Pavan
12-04-2007 3:55 PM
I am assuming you are using REUSE_ALV_GRID_DISPLAY. Set a field for selection in the internal table (CBOX for example). In your user_command form you can just do loop at itab where cbox = 'X'.
do your stuff
endloop.
If you need more details let me know.
Albert
12-04-2007 4:05 PM
Hi Albert,
I have created one field (sel) in my internal table, but the table des not read this
field as marked or 'X'. My internal table has 108 fields and I have created structure
to built fieldcatlog and to populate it. tell me how to read the selected row now?.....
12-04-2007 3:56 PM
Hi,
You should use the method GET_SELECTED_ROWS. This method belongs to object ALV it means you declared (for instance): o_alv type ref to cl_gui_alv_grid
the mathod is called as follow: call method o_alv->GET_SELECTED_ROWS. Use the button "Pretty Printer" then the system put all parameters required to use method.
Regards
Adam