Pergunta

Eu tenho um webdynpro contendo uma tabela exibindo inúmeras linhas. Depois que o usuário clica no botão Excluir, quero excluir a linha selecionada da tabela.

Meu problema agora é que não sei como implementar isso na chamada de eventos. Como posso identificar a linha selecionada da tabela?

Foi útil?

Solução 2

Eu finalmente consegui a solução:

No evento de botão, implemente o seguinte, para acessar o nó e, finalmente, o valor de identificação:

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.

Outras dicas

Se por "tabela" você quer dizer um ALV editável, há uma função predefinida para isso. Dar uma olhada em http://help.sap.com/saphelp_nw04s/helpdata/en/5f/ec57c72a1349c8bfdda56d976e9399/frameset.htm e http://help.sap.com/saphelp_nw04s/helpdata/en/5f/ec57c72a1349c8bfdda56d976e9399/frameset.htm Para detalhes sobre como processar a seleção manualmente, consulte http://help.sap.com/saphelp_nw04s/helpdata/en/5f/ec57c72a1349c8bfdda56d976e9399/frameset.htm.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top