abapwebdynpro

How to get the selected entry in WebDynpro ABAP table?


I have a webdynpro containing a table displaying numerous lines. After the user clicks the delete button I want to delete the selected line of the table.

My problem right now is, that I don't know how to implement this in the event-call.

How can I identify the selected line of the table?


Solution

  • I finally got the solution:

    In the button event implement the following, to access the node and finally the id-value:

    method ONACTIONZSS10_15_ONDELETE .  
      DATA ls_cust type wd_this->element_IT_Cust.
      DATA lo_nd_cust TYPE REF TO if_wd_context_node.
      DATA lo_el_cust TYPE REF TO if_wd_context_element.
    
      " Get the selected element
      lo_nd_cust = wd_context->get_child_node( name = 'IT_CUST' ).
      lo_el_cust = lo_nd_cust->get_element( ).
    
      " Get the attributes of the node-element
      lo_el_cust->get_static_attributes(
        IMPORTING
          static_attributes = ls_cust ).
    
      " Call the delete-function
      CALL FUNCTION 'ZSS10_15_CUST_FM_DELETE'
        EXPORTING
          custid        = ls_cust-ID
                .
    endmethod.