2009 Nov 11 5:47 AM
How do we create selection column like those in a table control? I'm using OO.
2009 Nov 11 3:00 PM
The selection column is controlled via a method set_selection_mode in object CL_SALV_SELECTIONS.
it takes values
No selection NONE 0
Single selection SINGLE 1
Multiple selection MULTIPLE 2
Cell selection CELL 3
Row- and column selection ROW_COLUMN 4
using value 1 or 2 will cause the alv to create a selection column.
if you have an alv object created
alv_object type ref to cl_salv_table,
then you need code along the lines
data: gr_selections type ref to cl_salv_selections.
gr_selections = alv_object->get_selections( ).
gr_selections->set_selection_mode( 1 ). "Single row selection
2009 Nov 11 6:39 AM
2009 Nov 11 3:00 PM
The selection column is controlled via a method set_selection_mode in object CL_SALV_SELECTIONS.
it takes values
No selection NONE 0
Single selection SINGLE 1
Multiple selection MULTIPLE 2
Cell selection CELL 3
Row- and column selection ROW_COLUMN 4
using value 1 or 2 will cause the alv to create a selection column.
if you have an alv object created
alv_object type ref to cl_salv_table,
then you need code along the lines
data: gr_selections type ref to cl_salv_selections.
gr_selections = alv_object->get_selections( ).
gr_selections->set_selection_mode( 1 ). "Single row selection
2020 Jan 06 6:30 AM
2009 Nov 11 3:20 PM
Hi,
you can make use of CHECKBOX field of structure LVC_S_FCAT, so that Selection will come for every row of the ALV.
& to capture the event when every row is selected use method get_selected_rows of cl_gui_alv_grid
Regards
Abhii...
2009 Nov 11 11:45 PM
Hi Abhii ,
FYI: There is no fieldcat accessible in SALV. Please search (read?) before answer, thank you.
Regards,
Clemens
2009 Nov 12 3:30 AM
I tried cl_salv_selections as below but I still do not see the selection column.
data: zref_var type ref to cl_salv_table,
zref_fun type ref to cl_salv_functions,
zrv_cols type ref to cl_salv_columns_table,
zref_col type ref to cl_salv_column_table.
data: gr_selections type ref to cl_salv_selections.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = zref_var
CHANGING
t_table = ztb_alv1.
CATCH cx_salv_data_error cx_salv_not_found.
ENDTRY.
data: event_handler type ref to lcl_handle_events.
zrv_cols = zref_var->get_columns( ).
zrv_cols->set_exception_column( value = 'LIGHT' ).
* change column name
TRY.
zref_col ?= zrv_cols->get_column( 'MATNR' ).
zref_col->set_long_text( 'Material Number' ).
zref_col->set_medium_text( 'Material No' ).
zref_col->set_short_text( 'Material' ).
CATCH cx_salv_not_found.
ENDTRY.
* Set up selections.
gr_selections = zref_var->get_selections( ).
gr_selections->set_selection_mode( 2 ).
* display alv
CALL METHOD zref_var->display.
2009 Nov 12 7:58 AM
Sorry wrong info, value of 3 will create the selection column.
gr_selections->set_selection_mode( 3 ).
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |