on 09-20-2010 5:50 AM
Hi All
In my requirement, when user click on add button i want to add empty rec as first record, then user enters data and save. i wrote some code for this. record is adding after last record in the table. how to add at first?? any help.
Thanks
kris.
Hi ,
Please create a blank structure of type your table and insert the structure into the internal table that is binded to context at index 1. For more details please see the code below,
node = wd_context->get_child_node( name = wd_This->wdctx_n_sflight ).
node->get_static_attributes_Table(
IMPORTING
table = itab ).
INSERT ls_Sfl into itab index 1. " ls_Sfl is the structure or line that is being inserted.
node->bind_table( itab ).
With Regards,
Shridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aditya and Manas,
i am reading index using get_lead_selection_index.
ind = lo_nd_itab->get_lead_selectio_(index( ).
ind = ind + 1.
insert itab into stru index 'ind'.
lo_nd_it_result->bind_table( stru ).
i defined ind as type i.
i am getting error " Unable to interpret ind as a number".? please tel me how to solve?
Thanks,
kris.
Hi,
You can get the selected element by the using get_lead_selection method, read its attributes and bind the same to the node.
Please see below,
read lead selected element ***
node = wd_context->get_child_node( name = wd_This->wdctx_n_sflight ).
element = node->get_lead_selection( ).
element->get_Static_Attributes(
IMPORTING
static_Attributes = ls_Sfl ).
get index ***
index = element->get_index( ).
index = index + 1.
bind element ***
node->bind_structure(
EXPORTING
new_item = ls_Sfl
SET_INITIAL_ELEMENTS = ABAP_FALSE
index = index ).
Note : You need to take care of Primary Key matters.
With Regards,
Shridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can u post the way you followed to add a new row at the end??
Aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
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.