cancel
Showing results for 
Search instead for 
Did you mean: 

update the record's at run time by WEB-DYNPRO ABAP

Former Member
0 Kudos

Hi friend,

my requriment how i can update the record in run time by WEB-DYNPRO ABAP .

kindly give me sutiable example for this requriment ASAP.

regard's

vikash

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Hi Vikash,

Kindly elaborate your reqm little more.... What do you mean by record?? Are to talking about database table or some thing else?

Regards

Arjun

Former Member
0 Kudos

i take about display table in browser

pranav_nagpal2
Contributor
0 Kudos

Hi Vikash,

to display data in a view you can use code below

data lo_nd_cn_table type ref to if_wd_context_node.
  data lo_el_cn_table type ref to if_wd_context_element.
  data ls_cn_table type wd_this->element_cn_table.
  data it_table type wd_this->elements_cn_table.
  data wa_table type wd_this->element_cn_table.
  data it type standard table of t005t.
  data wa type t005t.
 
**   navigate from <CONTEXT> to <CN_TABLE> via lead selection
 
 
select * from t005t into TABLE it.
 
  loop at it into wa.
    wa_table-ca_one = wa-land1.
    wa_table-ca_two = wa-landx.
    wa_table-ca_three = wa-natio.
    wa_table-ca_enable = abap_true.
   append wa_table to it_table.
    endloop.
 
 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(  ).
 
 
lo_nd_cn_table->bind_table( it_table ).

see the below link as well

regards

Pranav

Edited by: Pranav Nagpal on Dec 22, 2008 6:59 PM

Answers (1)

Answers (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Vikash,

I guess that you want to first display the data in your view & then allow the user to be able to modify & save it on to the database from there. I also see that you had already raised a [thread here|; for exactly the same & even marked it as answered. Anyways for this you need to do as shown below:

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 = 'SFLIGHT_NODE'  ).
 
   lt_elements = node_sflight->get_elements( ).
 
"   Get all the rows from the table for saving on to the database
    loop at lt_elements into elem_sflight.
      elem_sflight->get_static_attributes( importing static_attributes = stru_sflight ).
      append stru_sflight to it_flights.
    endloop.

" Finally save the entries on to the database 
    modify ZSFLIGHT99 from table it_flights.
    if sy-subrc eq 0.
endif.

However a word of caution here.... SAP doesn't ever recommend directly modifying the database through an SQL query. You would preferably make use of a BAPI for the same. Try go through Thomas Jung's comments in [here|;.

Regards,

Uday