cancel
Showing results for 
Search instead for 
Did you mean: 

Lead selection removal from table

former_member205842
Participant
0 Kudos

Hi,

        i removed default lead selection from table ...its working fine but how to deselect lead selection from screen .....please tell me its adj....

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member205842
Participant
0 Kudos

hi Ram,

            i think you didn't get my requirement....my req is after executing WD component, i mean in browser ...am displying table with fields without lead selection, user selected first row using lead selection when user want's to deselect that row(by double click on the same row) which is selected by user ...how to do this? ...after deselecting user my table dont have any lead selection.

GirieshM
Active Contributor
0 Kudos

Hi Syed,

I hope your requirement is to deselect the selected row in the table programatically. I think it is not possible. Either you can use a additional checkbox column or the solution provided by Kiran LinktoUI action. When I select the table selection row manually it is unable to reset it in program but when I select via program then it I am able to deselect it.

Let see whether others have any solution to it.

With Regards,

Giriesh M

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,

I think I have understood your requirement as below

Let us say we have 2 records in table

Now user clicks on first line, ( select a row ) as below

Again user clicks on second line ( select another row ) as below

Now, user can click on any row to deselect.

Ex. user clicked on first line to deselect

If this is your requirement, please follow my earlier repl for the solution.

Regards,

Rama

former_member205842
Participant
0 Kudos

HI Ram ,

                 Excately but i don want to select multiple rows .....okay i just want to deselect row which i selected ...by double clicking ........please give the code .it helpful to me...

Former Member
0 Kudos

Using Double click we can't deselect any row in ABAP.

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,


Syed Sarmath Hussain wrote:

                 Excately but i don want to select multiple rows .....okay i just want to deselect row which i selected ...by double clicking ........please give the code .it helpful to me...

If you need to select only one row  on click and deselect it without using CTRL key.

Please follow steps in  my earlier reply and write the below code in event handler method


DATA lo_ctx_element TYPE REF TO if_wd_context_element.
  DATA lo_ctx_node TYPE REF TO if_wd_context_node.
  DATA lt_selected_elements  TYPE wdr_context_element_set.
  DATA lo_selected_element   TYPE REF TO if_wd_context_element.


  lo_ctx_element = wdevent->get_context_element( name =
'NEW_ROW_ELEMENT' ).

  IF lo_ctx_element IS NOT BOUND.
    RETURN.
  ENDIF.
 
  " get node reference
  lo_ctx_node = lo_ctx_element->get_node( ).
 
  " get selected elements
  lt_selected_elements = lo_ctx_node->get_selected_elements( ).

    " de-select all elements except the currenty processing element


  LOOP AT lt_selected_elements INTO lo_selected_element.
    IF lo_selected_element NE lo_ctx_element.
      lo_selected_element->set_selected( abap_false ).
    ENDIF.

  ENDLOOP.

  " check if element is selected
  IF lo_ctx_element->is_selected( ) EQ abap_true.
    lo_ctx_element->set_selected( flag = abap_false ).
  ELSE.
    lo_ctx_element->set_selected( flag = abap_true ).
  ENDIF.

Hope this resolves your issue.

Regards,

Rama

former_member191161
Participant
0 Kudos

Excellent effort Gangappa...

Thanks for sharing valuable info....

Ragards,

Siva R

former_member205842
Participant
0 Kudos

Hi,

     Thanks for replying but my scenaio is diff, i want to select & unselect lead selection when user double click lead selection it should b  unselectable....how to do it...

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,

To unselect first row ( initial lead selection ) of table, please un check the context node property "Initialization Lead Selection" as below

Now, using my earlier reply with this change, you can select / de-select any line/lines

Hope this resolves your issue.

Regards,

Rama

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,

To unselect a record on table, please use CTRL + click

i.e., Hold the key CTRL and click on the row which is to be reset/unselect

Hope this helps you.

Regards,

Rama

former_member205842
Participant
0 Kudos

Hi Ram,

              I got it but user doesnt accept this i mean holding ctrl n unselect the row ......without holding ctrl can't we do this?

former_member184578
Active Contributor
0 Kudos

Hi,

Use set_selected ( ) method of context element and pass value abap_false. You could check this document for reference: http://scn.sap.com/docs/DOC-28915

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,

You can select multiple rows without CTRL key, also but you need to do it through program.

Please follow the below points

  • Change the property of selection to 0....n in context

        

  • Set the tabel properties viz "selectionChangeBehaviour" , selectionMode and create an event handler method for an event "onLeadSelect" as below

         

  • Write the below code in event handler method

METHOD onactionlead_select .


  DATA lo_ctx_element TYPE REF TO if_wd_context_element.

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

  IF lo_ctx_element IS NOT BOUND.
    RETURN.
  ENDIF.


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


ENDMETHOD.

Hope this resolves your issue.

Regards,

Rama

GirieshM
Active Contributor
0 Kudos

Hi Syed,

Can you please explain the issue clearly. Are you getting the first row selected in the table and you need it to be unselected by default. uncheck the the removal of Initialize lead selection in the table property. If it is done confirm whether the Selection property set to 0..1

With Regards,

Giriesh M