Está en la página 1de 6

Borrar registros en un web dynpro

Crear componente Web Dynpro

Crear un nodo con la estructura de la tabla zyg_alumnos

Crear una tabla con referencia al nodo que creamos anteriormente


Dentro del mtodo WDDOINIT agregar el siguiente cdigo

method WDDOINIT.

data lo_nd_alumnos type ref to if_wd_context_node.


data lo_el_alumnos type ref to if_wd_context_element.
data ls_alumnos type wd_this->element_alumnos.

* navigate from <CONTEXT> to <KNA1> via lead selection


lo_nd_alumnos = wd_context->get_child_node( name = wd_this-
>wdctx_alumnos ).

data : it_alumnos type table of wd_this->element_alumnos.

select *
FROM zyg_alumnos
INTO TABLE it_alumnos.

lo_nd_alumnos->bind_table( it_alumnos ).

endmethod.
Posteriormente crearemos un botn para borrar las lneas y agregaremos una accin a dicho
boton.

Asignar el siguiente cdigo a la accin borrar.

method ONACTIONBORRAR .

data lo_nd_alumnos type ref to if_wd_context_node.


data lo_el_alumnos type ref to if_wd_context_element.
data ls_alumnos type wd_this->element_alumnos.
* navigate from <CONTEXT> to <KNA1> via lead selection
lo_nd_alumnos = wd_context->get_child_node( name = wd_this-
>wdctx_alumnos ).

data : it_alumnos type table of wd_this->element_alumnos.


data : lw_alumnos type wd_this->element_alumnos.

* get element via lead selection


lo_el_alumnos = lo_nd_alumnos->get_element( ).

lo_el_alumnos->get_static_attributes(
importing
static_attributes = lw_alumnos ).

lo_nd_alumnos->get_static_attributes_table(
importing
table = it_alumnos ).

DELETE it_alumnos where matricula eq lw_alumnos-matricula.

lo_nd_alumnos->bind_table( it_alumnos[] ).

endmethod.

Crear aplicacin Web Dynpro

También podría gustarte