on 09-25-2008 12:54 PM
hi ,
i have created a button (save) and onaction event i have writen the code but when iam going tho edit the data or inserting the new data , it showing on the brouser but it is not sving into the data base
method onactionsave.
data:
lo_element type ref to if_wd_context_element,
lo_node type ref to if_wd_context_node.
lo_node = wd_context->get_child_node( name = 'your node name here' ).
lo_element = lo_node->create_element( ).
lo_node->bind_element( new_item = lo_element set_initial_elements = abap_false ).
endmethod.
suggest me the aswer or the code to update or save it into the database
thanks & regards...
sarfaraz
Hi,
When you say not saving in the database are you trying to update a Data Dictionary Table? could you explain a bit more what you are tring to achieve
Regards
Carl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarfraz,
do in this way....
when you click buton save it will trigger the action event.In that method retrieve the data from table.
Check this code how to retrieve the data from table.
here i am giving my code. I am showing SFLIGHT details in my table check the below code.
data:
node_sflight type ref to if_wd_context_node,
elem_sflight type ref to if_wd_context_element,
lt_elements type WDR_CONTEXT_ELEMENT_SET,
stru_sflight type if_main=>element_sflight_node,
it_flights type if_main=>elements_sflight_node.
* navigate from <CONTEXT> to <SFLIGHT_NODE> via lead selection
node_sflight_node = wd_context->get_child_node( name =
if_main=>wdctx_sflight_node ).
* get element via lead selection
* elem_sflight_node = node_sflight_node->get_element( ).
lt_elements = node_sflight->get_elements( ).
* get all declared attributes
loop at lt_elements into elem_sflight.
elem_sflight->get_static_attributes(
importing
static_attributes = stru_sflight ).
append stru_sflight to it_flights.
endloop.
modify ZSFLIGHT99 from table it_flights.
if sy-subrc eq 0.
endif.
Hope this will help you.
Thanks
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
This occurs because you only updated the context, not the transparent table.
Try to recover the data from the context and then save it to the table.
DATA:
lr_context TYPE REF TO if_wd_context_node,
lt_table TYPE <THE TABLE TYPE>.
lr_context = wd_context->get_child_node( name = <NODE_NAME> ).
lr_context->get_attributes_table( IMPORTING table = lt_table ).
MODIFY <TRANSPARENT TABLE> FROM TABLE lt_table.
Regards
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.