on 05-02-2013 11:45 AM
Dear Experts,
I am having a table. In the table i am showing some data passed from input field. there is an option for me in my application i can clear the input fields an i can input new values. But my requirement is whenever i input data in inputfield and click on add button the table should be able to show me the inserted values from input field. i mean a new row should be added in the table with the values from input field.
Kindly suggest me the way of acheiving it.
Thanks & Regards
Arun.K.P
Hi Arun,
In your Add button action write code like below.
DATA lo_nd_ship_disp TYPE REF TO if_wd_context_node.
DATA lo_el_ship_disp TYPE REF TO if_wd_context_element.
DATA lt_ship_disp TYPE wd_this->elements_ship_disp.
DATA ls_ship_disp TYPE wd_this->element_ship_disp.
lo_nd_ship_disp = wd_context->get_child_node( name = wd_this->wdctx_ship_disp ).
lo_nd_ship_disp->get_static_attributes_table( IMPORTING table = lt_ship_disp ).
lo_el_ship_disp = lo_nd_ship_disp->create_element( ).
ls_ship_disp-kschl = 'Your input field value '.
ls_ship_disp-vtext = 'Your input field value '.
ls_ship_disp-kbetr = 'Your input field value '.
lo_el_ship_disp = lo_nd_ship_disp->bind_structure( new_item = ls_ship_disp
set_initial_elements = abap_false ).
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Krishna,
Thank you for the immediate response. Your input really helped me.. But If i am using the table row as inputfield. if i enter the values in first row and click on add button the first row should descend and new row should appear. again i am entering 3rd row then 2 rows shld be descended.
Please guide here also...
Thanks & Regards
Arun.K.P
Hi Arun,
Just modify your code like this..
Initially Add record with space. Now enter some data in input and click add button new record at index 1. Hope it solves.
DATA lo_nd_data TYPE REF TO if_wd_context_node.
DATA lo_el_data TYPE REF TO if_wd_context_element.
DATA ls_data TYPE wd_this->Element_data.
DATA lt_data TYPE wd_this->Elements_data.
* navigate from <CONTEXT> to <DATA> via lead selection
lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_data ).
* get all declared attributes
lo_nd_data->get_static_attributes_table( IMPORTING table = lt_data ).
ls_data-matnr = space.
ls_data-kunnr = space.
lo_el_data = lo_nd_data->bind_structure( new_item = ls_data index = 1
set_initial_elements = abap_false ).
Cheers,
Kris.
Hi Arun,
If you always want to put the new element at first row and move the existing records in subsequent rows, try with the following code
data lo_nd_customer type ref to if_wd_context_node.
data lo_el_customer type ref to if_wd_context_element.
data ls_customer type wd_this->element_customer.
lo_nd_customer = wd_context->get_child_node( name = wd_this->wdctx_customer ).
lo_el_customer = lo_nd_customer->create_element( ).
lo_el_customer->set_static_attributes(
exporting
static_attributes = ls_customer ).
lo_nd_customer->bind_element( new_item = lo_el_customer
set_initial_elements = abap_false
index = 1
).
lo_nd_customer->SET_LEAD_SELECTION( element = lo_el_customer ).
The last two lines make sure that you will always have new element at first row.
Cheers!
Abhinav
if input field and table are bind with different node let same inputfield with NODE1 abd table with NODE2
.then first all inserted value from input field from node1 using method GET_STATIC_ATTRIBUTES
then append row in table by using method BIND_TABLE or BIND STRUCTURE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.