cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot deselect line of a table element

Former Member
0 Kudos

Hi all,

I use a table in my WD abap. I have a simple problem : once I've selected a line, I cannot deselect it. Is it a normal behaviour ? I want the user to be able to delesect the line, so that no line of the table is selected.

Here are my settings :

- Context node :

Cardinality : 0..n

Selection : 0..1

Initialization lead selection : blank

Singleton : blank

- Table element :

selectionChangeBehaviour : auto

selectionMode : auto

Thanks for your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can check in this Web Dynpro component: WDR_TEST_TABLE

Go to the View 'Selection'. It has everything you want from tables.

If you are still not able to get your solution than revert back.

Regards,

Saud

Former Member
0 Kudos

Thanks Saud, it helped me a lot.

Finally I was forced to add some code to deselect the line. I think it's strange to have to do this, but I don't find any alternative...

Here's the code I put in the ONSELECT action of the table :

DATA : ls_old_ev_param TYPE wdr_event_parameter,
         ls_new_ev_param TYPE wdr_event_parameter.

  DATA : ls_old_sel TYPE wd_this->element_histo,
         ls_new_sel TYPE wd_this->element_histo.

  DATA : lo_element TYPE REF TO cl_wdr_context_element.

  DATA : lv_index TYPE i.

  FIELD-SYMBOLS : <ls_data> TYPE ANY.

  DATA : lo_node_table TYPE REF TO if_wd_context_node.

  READ TABLE wdevent->parameters
    WITH KEY name = 'OLD_LEAD_SELECTION'
      INTO ls_old_ev_param.

  IF sy-subrc = 0.

    ASSIGN ls_old_ev_param-value->* TO <ls_data>.

    IF <ls_data> IS NOT INITIAL.

      lo_element ?= <ls_data>.

      CALL METHOD lo_element->if_wd_context_element~get_static_attributes
        IMPORTING
          static_attributes = ls_old_sel.

    ENDIF.

  ENDIF.

  READ TABLE wdevent->parameters
    WITH KEY name = 'NEW_LEAD_SELECTION'
      INTO ls_new_ev_param.

  IF sy-subrc = 0.

    ASSIGN ls_new_ev_param-value->* TO <ls_data>.

    IF <ls_data> IS NOT INITIAL.

      lo_element ?= <ls_data>.

      CALL METHOD lo_element->if_wd_context_element~get_static_attributes
        IMPORTING
          static_attributes = ls_new_sel.

    ENDIF.

  ENDIF.

*** Same selection -> deselection
  IF ls_old_sel-objid = ls_new_sel-objid.

    lo_node_table = wd_context->get_child_node( 'HISTO' ).

    CALL METHOD lo_element->if_wd_context_element~get_index
      RECEIVING
        my_index = lv_index.

    CALL METHOD lo_node_table->set_selected
      EXPORTING
        flag  = abap_false
        index = lv_index.

    lo_node_table->set_lead_selection_index( lo_node_table->no_selection ).

  ENDIF.

Edited by: Julien999 on May 31, 2010 3:56 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Julien,

you can select/delesect the table row by changing the selection mode to Single instead of auto. Hope it works.

Former Member
0 Kudos

Thanks for your answer. But it doesn't work.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Initial lead selection : blank

the default first line is not selected with the above change.

to not to allow users for selecting any row,

you can change the selection mode property of the table to None

Thanks

Abhi

Former Member
0 Kudos

Have you tried the Initialize lead selection check box as checked ?

Former Member
0 Kudos

Sanket, it didn't solved the problem, but thanks anyway for your answers.

Edited by: Julien999 on May 31, 2010 3:58 PM