on 12-03-2008 11:01 AM
Hi Friends,
i habe a table and a button called Insert Row. If I click on this button, one row will be added to the table after the last row. I didn't find a way to jump to the added row after clicking on the Insert Row button.
I habe read in one thread here in WD Forum that as a work around I can add the new row to the top of the table using BIND_ELEMENT method.
So I tried to use BIND_ELEMENT instead of BIND_TABLE like this:
* lo_nd_table->bind_table( new_items = lt_table
* index = 0 ).
* to add the new line on the top
lo_nd_table->bind_element(
new_item = lt_table
set_initial_elements = abap_false
index = 0 ).
but now i get this error message:
Dynamic type conflict when assigning references
Does anyone has an Idea?
Thank you
Regards
Haleh
Hi Haleh,
Give it a try with the below code snippet. I have just given it a try and it works fine:
METHOD onactioninsert .
DATA: lr_node TYPE REF TO if_wd_context_node,
lr_element TYPE REF TO if_wd_context_element.
lr_node = wd_context->get_child_node( name = if_main=>wdctx_sflight ).
lr_element = lr_node->bind_element( set_initial_elements = abap_false
new_item = ls_data
index = 1 ).
ENDMETHOD.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Uday, hi Chitrali,
thank you both for the answers. It works now with the index = 1.
I don't know why! Actually The first line has the index 0.
have a nice day
Kind regards
Haleh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Haleh,
BIND_TABLE is used to add multiple rows to a context node with cardinality o-n or 1-n..
Whereas BIND_ELEMENT is used to add one row at a time to a context node...hence you need to populate a structure ls_table that you pass as an input to BIND_ELEMENT, and not lt_table .
* lo_nd_table->bind_table( new_items = lt_table
* index = 0 ).
* to add the new line on the top
lo_nd_table->bind_element(
new_item = ls_table
set_initial_elements = abap_false
index = 0 ).
This should resolve the error you are getting.
Thanks.
Chitrali
Edited by: Chitrali Shah on Dec 3, 2008 12:31 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chitrali,
thank you very much for your answer. This is good I corrected the lt_table to ls_table and I don't get the error message anymore.
But i don't know why, the added row is still after the last row of the table. How can i add the new row as the first row in the table, that it could be visible immediately.
thank you
regards
Haleh
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
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.