on 11-28-2008 6:45 AM
Hi Forum,
I have created one database table named ZBOOKINFO. I want to modify the records in it after displaying the table. I could able to display the table on the screen but unable to modify. Kindly help me.
Here is my code.
method wddoinit.
data : node_zbook type if_wd_context_node,
itab type standard table of zbookinfo.
select * from zbookinfo into table itab.
node_zbook = wd_context->get_child_node( name = 'node_zbook' ).
node_zbook->bind_table ( itab ).
endmethod.
regards
mallika
Hi,
you want to modify the database table or data in the table layout.??
regards
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
please see below.....
*NAVIGATE FROM <CONTEXT> TO <TABLENODE> VIA LEAD SELECTION
lo_nd_cn_table = wd_context->get_child_node( name =
wd_this->wdctx_cn_table ).
*GET ELEMENT VIA LEAD SELECTION
lo_el_cn_table = lo_nd_cn_table->get_element( ).
*GET ALL DECLARED ATTRIBUTES
lo_nd_cn_table->get_static_attributes_table(
importing
table = itab_info ).
this will get you complete data in internal table....
i wont recommend use of any select and update query in WD ABAP as it is not Recommended by SAP itself. better get a FM created.....
otherwise you can use this query...
modify target from source....
target is your dbtab...
source is your work area or if you are directly passing internal table use source as "table itab_info"
regards
Pranav
Edited by: Pranav Nagpal on Nov 28, 2008 8:15 AM
Hi Mallika,
As how you said the below snippet does only end in displaying the data for the user.
method wddoinit.
data : node_zbook type if_wd_context_node,
itab type standard table of zbookinfo.
select * from zbookinfo into table itab.
node_zbook = wd_context->get_child_node( name = 'node_zbook' ).
node_zbook->bind_table ( itab ).
endmethod.
If you have already managed to display the table in editable mode as how described in [here|; then you can create a toolbar button for saving the records on to the database. Within the action handler for this method you can try fetch all the data being displayed in the table into an internal table using the get_static_attributes_table method.
DATA: node_flighttab TYPE REF TO if_wd_context_node,
lt_sflight TYPE if_resultview=>elements_node_flighttab.
node_flighttab = wd_context->get_child_node( name = `NODE_FLIGHTTAB` ). " NODE_FLIGHTTAB is the node that you have bound to your table
node_flighttab->get_static_attributes_table( IMPORTING table = lt_sflight ). " Get all tables data into your internal table lt_sflight
You can then just say modify <database table> from <internal table> However note that this is not suggested in real time. This is only for your practice purpose.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.