Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Delete an Entry, Selected in a WebDynpro Table

Former Member
0 Likes
1,260

Hello Everybody,

i'm doing my first exercises programming in WebDynpro Abap and stuck at the following point:

I implemented a database-table containing customer data, created a function module which returns all entries, and a webdynpro view which displays this in a table.

i also added a "delete" button without any function jet.

my difficulty is that i did not understand yet:

- which parameters i need to perform the delete in a functionModule, since i could not find an object ID jet

- how to "ask" the table which entry is selected

Can you give me some tipps, or refere to a appropriate tutorial?

Thanks a lot!

Best Regards

Philipp

Edited by: Philipp.Heinemann on May 15, 2010 11:39 AM

Hello Everybody,

i'm doing my first exercises programming in WebDynpro Abap and stuck at the following point:

I implemented a database-table containing customer data, created a function module which returns all entries, and a webdynpro view which displays this in a table.

i also added a "delete" button without any function jet.

my difficulty is that i did not understand yet:

- which parameters i need to perform the delete in a functionModule, since i could not find an object ID jet

- how to "ask" the table which entry is selected

Can you give me some tipps, or refere to a appropriate tutorial?

Thanks a lot!

Best Regards

Philipp

Edited by: Philipp.Heinemann on May 15, 2010 11:39 AM

4 REPLIES 4
Read only

Former Member
0 Likes
871

Guys i thought this is basic stuff, isnt it?

Read only

Former Member
0 Likes
871

HI,

As you have created a button, just create action for the button, you can set that in buttons

properties table.

After creating action to the DELETE BUTTON.

add this sample code, here i have employee data.



   DATA lo_nd_zemp TYPE REF TO if_wd_context_node.
   DATA lo_el_zemp TYPE REF TO if_wd_context_element.
   DATA ls_zemp TYPE wd_this->element_zemp.
   data: it_tab type table of wd_this->element_zemp.

   lo_nd_zemp = wd_context->get_child_node( name = wd_this->wdctx_zemp ).


   lo_el_zemp = lo_nd_zemp->get_element(  ).

   lo_el_zemp->get_static_attributes(
     IMPORTING
       static_attributes = ls_zemp ).

lo_nd_zemp->get_static_attributes_table(
      importing
        table = it_tab ).
DELETE it_tab where empid eq ls_zemp-empid.
lo_nd_zemp->bind_table(  it_tab[] ).

I hope it helps

Regards and Best wishes.

Read only

Former Member
0 Likes
871

HI,

You can use <node>->get_lead_selection_index( ). Node must be reference of table node context. this method returns the value of the row that is selected

Read only

Former Member
0 Likes
871

Kiran Kumars tipp worked for me the following way:

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.

Thanks!!!