cancel
Showing results for 
Search instead for 
Did you mean: 

modify table

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

pranav_nagpal2
Contributor
0 Kudos

Hi,

you want to modify the database table or data in the table layout.??

regards

Pranav

Former Member
0 Kudos

i want to modify in the database table..

pranav_nagpal2
Contributor
0 Kudos

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

uday_gubbala2
Active Contributor
0 Kudos

Hi Mallika,

You have already raised a [thread |;earlier for the same issue and I have already replied for the same in that one. You have now re-created 2 new threads for the same issue. Check the earlier [thread |;for the solution.

Uday

Answers (1)

Answers (1)

uday_gubbala2
Active Contributor
0 Kudos

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