on 02-18-2008 7:16 AM
Hi ,
I want to delete a selected record from a table using the index how can i do that??
Can u please help me regarding this with the code or any relative document.
Thanks,
Deepika
hi deepika....
you can just read the attribute using code wizard... which returns you the index....
then using the index delete the record in teh internal table using
delete <itab> index <i>.
then bind it again to the node.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
Can i use this code for getting the index of the selected line??????
for eg:
alternative access via index
lo_el_infty_tab = lo_nd_infty_tab->get_element( index = 1 ).
@TODO handle non existant child
IF lo_el_infty_tab IS INITIAL.
ENDIF.
and in
" DATA: lo_el_infty_tab TYPE REF TO if_wd_context_element."
is "loel_infty_tab"_ my internal table??
Thanks,
Deepika
hi deepika.........
first read the attribute using code wizard....
you will be getting the index.
then use the method get_static_attributes_table in the class if_wd_context_node.
it returns the value to an internal table taht you pass.
now delete the record using index.
now bind it again to the node using bind_table().
---regards,
alex b justin
Hi Alex,
I have tried what u have told in previous reply..... but i have doubt....
please check the code ... what ever i m doing is correct or not ??
Actually i m just a beginner in Web Dynpro world...
Code::::::::::::::::::
DATA lo_nd_z_rfc_prv_emp0023_ge TYPE REF TO if_wd_context_node.
DATA lo_nd_changing TYPE REF TO if_wd_context_node.
DATA lo_nd_infty_tab TYPE REF TO if_wd_context_node.
DATA lo_el_infty_tab TYPE REF TO if_wd_context_element.
DATA ls_infty_tab TYPE wd_this->element_infty_tab .
navigate from <CONTEXT> to <Z_RFC_PRV_EMP0023_GE> via lead selection
lo_nd_z_rfc_prv_emp0023_ge = wd_context->get_child_node( name = wd_this->wdctx_z_rfc_prv_emp0023_ge ).
navigate from <Z_RFC_PRV_EMP0023_GE> to <CHANGING> via lead selection
lo_nd_changing = lo_nd_z_rfc_prv_emp0023_ge->get_child_node( name = wd_this->wdctx_changing ).
navigate from <CHANGING> to <INFTY_TAB> via lead selection
lo_nd_infty_tab = lo_nd_changing->get_child_node( name = wd_this->wdctx_infty_tab ).
@TODO handle not set lead selection
IF lo_nd_infty_tab IS INITIAL.
ENDIF.
*
get element via lead selection
lo_el_infty_tab = lo_nd_infty_tab->get_element( ).
*
@TODO handle not set lead selection
IF lo_el_infty_tab IS INITIAL.
ENDIF.
alternative access via index
lo_el_infty_tab = lo_nd_infty_tab->get_element( index = 1 ).
@TODO handle non existant child
IF lo_el_infty_tab IS INITIAL.
ENDIF.
get all declared attributes
lo_el_infty_tab->get_static_attributes(
IMPORTING
static_attributes = ls_infty_tab ).
if sy-subrc = 0.
DELETE ???????????????? INDEX ??????????.
endif.
lo_nd_infty_tab->Bind_Table( ????????????? ).
Note: Which internal table's record i need to delete????
hi deepika....
check this:
DATA lo_nd_po TYPE REF TO if_wd_context_node.
DATA lo_el_po TYPE REF TO if_wd_context_element.
DATA ls_po TYPE wd_this->element_po.
* navigate from <CONTEXT> to <PO> via lead selection
lo_nd_po = wd_context->get_child_node( name = wd_this->wdctx_po ).
* @TODO handle not set lead selection
IF lo_nd_po IS INITIAL.
ENDIF.
* get element via lead selection
lo_el_po = lo_nd_po->get_element( ).
* @TODO handle not set lead selection
IF lo_el_po IS INITIAL.
ENDIF.
* alternative access via index
* lo_el_po = lo_nd_po->get_element( index = 1 ).
* @TODO handle non existant child
* IF lo_el_po IS INITIAL.
* ENDIF.
* get all declared attributes
lo_el_po->get_static_attributes(
IMPORTING
static_attributes = ls_po ).
data:
i1 type i.
lo_el_po->get_index( i1).
lo_nd_po->get_static_attributes_table( itab ).
delete itab index i1.
lo_nd_po->bind_table( itab ).
---regards,
alex b justin
This is deleting the record from that internal table but it is not deleting the record from the Data base table.
So for deleting the record what i need to do???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi deepika.........
you can now read teh index... so using that you read the primary key....
eg:
your database table has empid as teh primary key,
then
read table <itab> into <wa> index i1.
delete from <dbtab> where <field> = <wa-empid>.
my personal id is: jalexjustin@gmail.com
---regards,
alex b justin.
Hi Deepika,
You can additionally try using the supply function and capture the selected row into an internal table in the context and read the context element back in the action and delete the captured row from you main table and then rebind it across
and Alex has advised.
regds,
Srini
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.