2006 Nov 23 6:46 AM
Hi,
I am using the following code to display the ALV list,I get a column for selecting rows , the issue here is that selecting multiple rows is not posssible without keeping the "CTRL" key pressed down, is there any way i can do the multiple selections part without keeping the "CTRL" key pressed down?
in other words is there any other way writing the statement
*... §7.1 set selection mode
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
perform set_columns_technical using lr_columns.
*... §6 register to the events of cl_salv_table
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
create object gr_events.
*... §6.1 register to the event USER_COMMAND
set handler gr_events->on_user_command for lr_events.
*... §7 selections
data: lr_selections type ref to cl_salv_selections,
lt_rows type salv_t_row,
lt_column type salv_t_column,
ls_cell type salv_s_cell.
lr_selections = gr_table->get_selections( ).
*... §7.1 set selection mode
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
*... §4 display the table
gr_table->display( ).
endform.
Hi,
I am using the following code to display the ALV list,I get a column for selecting rows , the issue here is that selecting multiple rows is not posssible without keeping the "CTRL" key pressed down, is there any way i can do the multiple selections part without keeping the "CTRL" key pressed down?
in other words is there any other way writing the statement
*... §7.1 set selection mode
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
perform set_columns_technical using lr_columns.
*... §6 register to the events of cl_salv_table
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
create object gr_events.
*... §6.1 register to the event USER_COMMAND
set handler gr_events->on_user_command for lr_events.
*... §7 selections
data: lr_selections type ref to cl_salv_selections,
lt_rows type salv_t_row,
lt_column type salv_t_column,
ls_cell type salv_s_cell.
lr_selections = gr_table->get_selections( ).
*... §7.1 set selection mode
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
*... §4 display the table
gr_table->display( ).
endform.
2006 Nov 23 7:11 AM
Hi,
Add a field in your internal table of type C and populate it in Layout of type BOX.
Regards,
Amit
2006 Nov 23 7:18 AM
Hi,
Thanks for responding! but i already have the column, i need to select multiple rows without keeping the CTRL key pressed.
Regards
Narendiran Rathinavelu
2006 Nov 23 7:21 AM
Hi Naren,
If u need to select multiple rows then u have press the CNTRL kay else its not possible to select multiple rows..
2006 Nov 23 7:57 AM
Hi Narendiran.
If you don't want to use control key,
as you have box field on left,
You can use tab key to come to that box and than press spacebar , the box will be marked.
Regards
Kaushal N. Shah .
2006 Nov 23 7:41 AM
Hi
Selection of multiple rows using grid that too without CNTL button is not possible in Grid. My suggestion is use ALV LIST display for this or just print some message in Header that press CNTL button and select for multile selections.
2006 Nov 23 7:45 AM
Please check this example
REPORT zkb_test.
TYPES: BEGIN OF t_table,
status TYPE c,
sdate TYPE sy-datum,
emptype(20) TYPE c,
celltab TYPE lvc_t_styl,
END OF t_table.
DATA: o_grid TYPE REF TO cl_gui_alv_grid,
o_container TYPE REF TO cl_gui_custom_container.
DATA: i_table TYPE TABLE OF t_table.
DATA: w_table TYPE t_table.
DATA: i_fcat TYPE lvc_t_fcat,
i_layo TYPE lvc_s_layo.
START-OF-SELECTION.
PERFORM populate_data.
PERFORM build_field_catalogue.
END-OF-SELECTION.
CALL SCREEN 9000.
&----
*& Form populate_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM populate_data .
CLEAR w_table.
w_table-status = 'X'.
w_table-sdate = '20061025'.
w_table-emptype = 'Active'.
APPEND w_table TO i_table.
CLEAR w_table.
w_table-status = ' '.
w_table-sdate = '20061023'.
w_table-emptype = 'Active'.
APPEND w_table TO i_table.
CLEAR w_table.
w_table-status = ' '.
w_table-sdate = '20061005'.
w_table-emptype = 'With-Drawn'.
APPEND w_table TO i_table.
CLEAR w_table.
w_table-status = 'X'.
w_table-sdate = '20061025'.
w_table-emptype = 'Active'.
APPEND w_table TO i_table.
ENDFORM. " populate_data
&----
*& Form build_field_catalogue
&----
text
----
--> p1 text
<-- p2 text
----
FORM build_field_catalogue .
DATA: ls_fcat TYPE lvc_s_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'STATUS'. "Fieldname
ls_fcat-inttype = 'CHAR'. "Data type
ls_fcat-outputlen = '1'. "Column width
ls_fcat-coltext = 'Status'. "Column Header
ls_fcat-seltext = 'Status'. "Column Desc
ls_fcat-checkbox = 'X'. "Set as Check Box
ls_fcat-edit = 'X'. "Set editable
APPEND ls_fcat TO i_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'SDATE'. "Fieldname
ls_fcat-inttype = 'DATS'. "Data type
ls_fcat-outputlen = '8'. "Column width
ls_fcat-coltext = 'Date'. "Column Header
ls_fcat-seltext = 'Date'. "Column Desc
ls_fcat-edit = 'X'. "Set editable
APPEND ls_fcat TO i_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'EMPTYPE'. "Fieldname
ls_fcat-inttype = 'CHAR'. "Data type
ls_fcat-outputlen = '20'. "Column width
ls_fcat-coltext = 'Emp Type'. "Column Header
ls_fcat-seltext = 'Emp Type'. "Column Desc
ls_fcat-edit = 'X'. "Set editable
APPEND ls_fcat TO i_fcat.
ENDFORM. " build_field_catalogue
&----
*& Module status_9000 OUTPUT
&----
text
----
MODULE status_9000 OUTPUT.
SET PF-STATUS '9000'.
ENDMODULE. " status_9000 OUTPUT
&----
*& Module user_command_9000 INPUT
&----
text
----
MODULE user_command_9000 INPUT.
CASE sy-ucomm .
WHEN 'BACK' OR 'EXIT'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
&----
*& Module init_9000 OUTPUT
&----
text
----
MODULE init_9000 OUTPUT.
IF o_container IS INITIAL.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
Create a custom container control for ALV Control
CREATE OBJECT o_container
EXPORTING
container_name = 'CUSTOM_CONTROL'.
Create a ALV Control
CREATE OBJECT o_grid
EXPORTING i_parent = o_container.
Layout Defaults
i_layo-no_rowmark = 'X'.
i_layo-cwidth_opt = 'X'.
Display ALV Grid
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_layout = i_layo
CHANGING
it_outtab = i_table
it_fieldcatalog = i_fcat.
ENDIF.
ENDIF.
ENDMODULE. " init_9000 OUTPUT
Regards
Kathirvel
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |