on 07-15-2009 7:37 AM
Hi all,
i am new to webdynpro abap. and i want to know how to handle selection event(such as select all / unselect ) in my simple alv application.
Thanks very much
Hi,
By default when you use the selection mode for the ALV as Multi/Mutli No Lead then this option is enabled.
Try to implement the event ONLEADSELECT and check wether this event is triggered or not.
DATA: lo_value type ref to cl_salv_wd_config_table.
CALL METHOD lo_value->if_salv_wd_table_settings~set_selection_mode
EXPORTING
value = cl_wd_table=>e_selection_mode-multi_no_lead.
Try to implement these event for ALV and put a break-point and test which event is getting triggered.
ON_CLICK
ON_DATA_CHECK
ON_FUNCTION
ON_LEAD_SELECT
ON_STD_FUNCTION_AFTE
ON_STD_FUNCTION_BEFO
Please provide more inputs.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Working with Selection/LeadSelection of an ALV is no different from how you work with the Selection/LeadSelection of a normal table UI element. So if you wanted to get the element at LeadSelection you do a get_lead_selection & if you want to get the multiple rows which are selected by the user then you do an get_selected_elements.
Regards,
Uday
Use the below code snippets logic to select all the rows of your ALV:
METHOD onactionselect_all_rows.
DATA: wd_node TYPE REF TO if_wd_context_node,
line_count TYPE i,
lt_kna1_value TYPE ig_componentcontroller=>elements_node1,
lt_kna1_element TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'NODE1' ).
CALL METHOD wd_node->get_element_count
RECEIVING
count = line_count.
DO line_count TIMES.
wd_node->set_selected( index = sy-index ).
ENDDO.
ENDMETHOD.
Use the below snippet to get all rows selected in a ALV & copy them to another ALV:
METHOD onactioncopy_selected_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
ls_node1 TYPE ig_componentcontroller=>element_node1,
lt_node1 TYPE ig_componentcontroller=>elements_node1,
lt_node2 TYPE ig_componentcontroller=>elements_node2,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'NODE1' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
wd_node = wd_context->get_child_node( name = 'NODE2' ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.