on 08-04-2011 2:11 PM
Hi All,
I have a requirement where I need to put a button to delete the selected row from the item table and for this I have written the following code:
DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
DATA ls_t_bseg TYPE wd_this->element_t_bseg.
data: it_tab type table of wd_this->element_t_bseg.
lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
lo_el_t_bseg->get_static_attributes(
IMPORTING
static_attributes = ls_t_bseg ).
lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
IF lo_el_t_bseg IS not INITIAL.
lo_nd_t_bseg->remove_element( lo_el_t_bseg ).
ENDIF.
Now the problem is although it's deleteing the selected line correctly but because of this I am losing one line on the screen for the user to enter... my form has a fixed number of lines and in my case it's 10... so everytime I am using deleting a line item I am losing one line to enter..... can you please tell me how can I avoid this?
Edited by: rajatg on Aug 4, 2011 3:12 PM
dont clear the table...clear the context_element (selected element), it will delete the row in the table
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the text as 'Clear' rather than 'Delete '...
this elements has the values lo_el_t_bseg and all you have to do is to clear those...
use GET /SET static attributes methods ,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if i try to clear the table then this will not delete the entry from the internal table... the requirement is let say i have a parked document with three line items and now user opens that document and decides to delete one line item and save it back ... so now that particular document should only have 2 line tems... can you please tell me how can I do this !!!
lets say...
i have 1,2,3 documents
i have cleared , document 2....
1. when the user selects this record.... you can read the context_element....using the context element you can get the values and clear those values and set the blank values...
when the user click on save ...you can have only those two records in the table.
2. conitnue with your logic .... remove_element. once it is done ,,, create_element at the deleted index...
3. when clicked on delete ...remove_element ( current code).... bind the table to the node... and you will have ur values
clear the values and bind it..
lo_el_t_bseg >> get static attributes....>> this returns ls_str
clear the ls_str
and now use set_static_attributes
Edited by: ssm on Aug 4, 2011 6:46 PM
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 | |
6 | |
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.