Hi,
Your code is resetting the lead selection.
Actually, your code should execute only during first time. On further action, you are not suppose to set data to context node because it re-sets the lead selection changes.
Restrict your code's execution only for first time
i.e. IF FIRST_TIME = ABAP_TRUE.
" Place your code inside this condition
ENDIF.
Hope this helps you.
Regards,
Rama