2010 May 15 10: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
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
2010 May 15 6:19 PM
2010 May 15 6:51 PM
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.
2010 May 17 5:23 AM
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
2010 May 17 2:33 PM
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!!!
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |