on 01-07-2008 11:22 AM
Hi,
Give me sample coding to add a row to the table control when add row button is pressed.
Regards,
Charumathi.B
Hi Charumathi Balachandran ,
On the event of the button, read the node thats binded to the table ctrl, using wizard.
lets say the itab be itab1
append a blank row to the itab.
now bind the itab1 back to the node.
OR
create a new element of the same type of the node which i mapped to tablectrl.
insert blank values to the new element.
add the element to the node.
Regards
Sarath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarath,
In my scenario a table has to be displayed initially with 5 editable rows. When the user presses the add row button the sixth row has to be appended to the table.
I have done the following things
In the WDDOINIT method I have written the following code.
data: itab like standard table of wa_tab,
wa_itab like line of itab.
Do 5 times.
wa_tab-slno = " " .
wa_tab-kostl = " " .
wa_tab-PS_POSNR = " " .
wa_tab-saknr = " " .
wa_tab-txt20 = " " .
wa_tab-netwr = space .
append wa_tab to itab.
enddo.
lo_node_items = wd_context->get_child_node( name = 'TAB1' ).
lo_node_items->bind_elements( itab ).
CALL METHOD LO_NODE_ITEMS->BIND_TABLE
EXPORTING
NEW_ITEMS = itab.
So initially 5 rows are editable .
In the onaddrow button I have written the following code.
wa_tab-slno = space.
wa_tab-kostl = space.
wa_tab-PS_POSNR = space.
wa_tab-saknr = space.
wa_tab-txt20 = space.
wa_tab-netwr = space.
append wa_tab to itab.
lo_node_items = wd_context->get_child_node( name = 'TAB1' ).
lo_node_items->bind_elements( itab ).
Then all the five rows are disappearing and only one row is displayed and editable .
Please help me to get the solution.
Regards,
Charumathi.B
yes Charumathi Balachandran ,
read the node thats binded to the table control to the itab , inside the onaddrow button.. then
wa_tab-slno = space.
wa_tab-kostl = space.
wa_tab-PS_POSNR = space.
wa_tab-saknr = space.
wa_tab-txt20 = space.
wa_tab-netwr = space.
append wa_tab to itab.
lo_node_items = wd_context->get_child_node( name = 'TAB1' ).
lo_node_items->bind_elements( itab ).
Thats all
Regards
Sarath
Hi,
I am new to webdynpro Abap, I have a table control with a button in one of the column, rest of the columns are empty.
Once the button is clicked a new row should add up to the table and those columns will have buttons in it.
Can you guys let me know how to do this ? I am not very familiar with Objects.
Tus
Firstly, no need to call BIND_ELEMENTS and BIND_TABLE both the methods. One is enough.
Everything you are doing is correct.
Just, in the method call BIND_ELEMENTS, there is a parameter SET_INITIAL_ELEMENTS which is ABAP_TRUE by default. Pass it also and set it to ABAP_FALSE when you are appending a new row to the table.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.