2007 Sep 17 3:03 PM
Hi
I have a ALV grid with objects. I want to enable the user to select any one row and then be able to clear the entry there by clicking a button . What is the event to initiate this .
Thankyou
2007 Sep 17 4:12 PM
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows
et_row_no = lt_rowno.
LOOP AT lt_rowno INTO lh_rowno.
READ TABLE t_screen INTO lh_screen INDEX lh_rowno-row_id.
ENDLOOP.
Hi
I have a ALV grid with objects. I want to enable the user to select any one row and then be able to clear the entry there by clicking a button . What is the event to initiate this .
Thankyou
2007 Sep 17 3:06 PM
hi
clear means remove the entry from the output. if it is like that select that entry and click on delete option.
if it not like that please explain ur requiremnent.
thanks,
maheedhar.
2007 Sep 17 3:09 PM
You can determine the selected rows by calling the method get_selected_rows. Once you know what rows have been selected you can delete them from you internal table.
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows
et_row_no = lt_rowno.
2007 Sep 17 3:10 PM
Hi
CALL METHOD grid->get_selected_rows
IMPORTING
et_index_rows = t_selected_rows.
To get the selected rows
perform operation on your final internal table (remove the records from your table)
(put this under when sy-ucomm = pushbutton code)
and again call
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = wa_layout
CHANGING
it_outtab = t_outtab[]
it_fieldcatalog = t_fldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
pass the same internal table again to the display
now out put will be refreshed and will not show the deleted records
Regards
Vasu
2007 Sep 17 4:04 PM
When I pass the value obtained from the get_selected_rows method , I get a type mismatch error. I am not able to get the value and use it as an index to access my internal table , here is what my code looks like. :
FORM CANCEL_SEL.
DATA : TABIN TYPE I.
DATA T_SELECTED_ROWS TYPE LVC_T_ROW.
DATA LT_ROWNO TYPE LVC_T_ROID .
C_SELQUANT_N TYPE P DECIMALS 3.
CALL METHOD GO_grid->get_selected_rows
IMPORTING
et_index_rows = t_selected_rows
et_row_no = lt_rowno.
*APPEND T_SELECTED_ROWS.
*TABIN = LT_ROWNO.
CLEAR ITAB_W.
READ TABLE ITAB INTO ITAB_W INDEX <b>T_SELECTED_ROWS-ROW_ID.</b>C_SELQUANT = ITAB_W-SEL_QUANT.
C_BALQUANT = ITAB_W-BALQUANT.
C_SELECTED = ITAB_W-F_SELQUANT.
C_SELECTED = C_SELECTED - C_SELQUANT.
C_BALQUANT = C_BALQUANT + C_SELQUANT.
C_SELQUANT = 0.
ITAB_W-SEL_QUANT = C_SELQUANT .
ITAB_W-BALQUANT = C_BALQUANT.
ITAB_W-F_SELQUANT = C_SELECTED.
MODIFY ITAB FROM ITAB_W INDEX T_SELECTED_ROWS.
call method go_grid->refresh_table_display.
ENDFORM.
I have to find the index and pass it to the internal table to be able to update it .The bold portion is what is giving me trouble.
2007 Sep 17 4:12 PM
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows
et_row_no = lt_rowno.
LOOP AT lt_rowno INTO lh_rowno.
READ TABLE t_screen INTO lh_screen INDEX lh_rowno-row_id.
ENDLOOP.
2007 Sep 17 4:27 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |