Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
chengalarayulu
Active Contributor
0 Kudos

Scope: This document teaches you that how to select multiple rows in a table without taking help of CTRL key from key board. If you select the row which is already selected, that will be deselected.

steps to be followed:

1. Create a component

2. Create a node under the context of Component Controller like shown below

3. Map this node to your view.

4. Create a table UI element on view, maintain context mapping with above created node. please observe the below snap, which is inserted cell editor(LinkToAction) also while binding(Yellow marked).

5. Create an action for LinkToAction UI element on Table, which is going to use as multiple selector.(MULTI_SELECT)

6. Now come WDDOINIT method of View, and write the below code / Process your selection/model operations. And bind the value set to the table bound node(ND_TABLE).

    DATA lo_nd_nd_table TYPE REF TO if_wd_context_node.
  DATA lt_nd_table TYPE wd_this->elements_nd_table.

* navigate from <CONTEXT> to <ND_TABLE> via lead selection
  lo_nd_nd_table = wd_context->get_child_node( name = wd_this->wdctx_nd_table ).

  SELECT *
    FROM zhr_resume_det
    INTO CORRESPONDING FIELDS OF TABLE lt_nd_table UP TO 10 ROWS.

  lo_nd_nd_table->bind_table( new_items = lt_nd_table set_initial_elements = abap_true ).

7. Write the below code on MULTI_SELECT action.

    DATA lo_el_nd_table TYPE REF TO if_wd_context_element.

* get element via lead selection
  lo_el_nd_table = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

  IF lo_el_nd_table->is_selected( ) EQ abap_true.
    lo_el_nd_table->set_selected( flag = abap_false ).
  ELSE.
    lo_el_nd_table->set_selected( flag = abap_true ).
  ENDIF.

8. Now create an application, test. (Click on the link to select/deselect).

Note:- You can also implement same thing onSelect action of Table UI element.

1 Comment
Labels in this area