Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Dec 22, 2008 at 11:28 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

      How to populate the context nodes based on an event

      regards

      Pranav

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

  • Posted on Dec 23, 2008 at 05:47 AM

    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|update the data base table by web-dynpro abap; 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|modify the data base table which is comming dynamiclly;.

    Regards,

    Uday

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.