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

How to populate the context nodes based on an event

Hi All,

I am having a basic problem. I have created a new Webdynpro Abap application. Here, in the main view, i have define a text view as well as a table. I have created context nodes A and B in component controller. The attributes under A are A1 and the attributes of B are B1,B2, and B3. I have also created an action button C in the same view. These have been mapped to the context nodes in the main view. A1 is mapped to the text view and B1, B2 and B3 are mapped to the table.

My requirement is as follows. When user Clicks on execute, i want to use the value A1 from the text view in a function module and return the values to B1, B2 and B3. B1, B2 and B3 are multiple values mind you.

I have successfully executed the function module within the WDONACTIONC method. How to i accomplish this Basic Task. Please Help

Best Regards


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 10:02 AM

    Hi Pranav,

    All ok, except, i cannot figure out what element_cn_table is. Is it the name of your context node? or context attribute?

    Please clarify.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 20, 2008 at 05:46 AM

    Hi Mazin,

    What i can understand from your description is that you want to get the value of A1 and pass it in a FM which will return values of B1, B2 and B3. Now if B1,B2 and B3 are getting returned in a internal table what you have to do is just create an internal table with name say B and fields with name B1, B2 and B3 please note fields name must be B1, b2 and b3.... now just bind the internal table with context node...

    lt_cn_node->bind ( B ).

    it will display the data in the table in your view.......

    to get the data from context node A and attribute A1 just use code wizard to get atribute......



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 05:57 AM

    Hi mahmood,

    Here is the solution:

    You have created a view inwhich you have three ui elements

    1: Textview

    2: table(i consided as you want to display multiple values)

    3: button

    Now when you press button , you want that data from context , which is bound to the text view should be passed to your function module and result should get populated in the table.

    Step 1: Get the data from the context attribute , which is bound to text view by using get_attribute (just use wizard for this)

    Step 2: After getting data in a local variable, just pass it to function module (keep the type compatibility)

    Step 3: Get the data from function module, and i consider that data which your FM will return is in table format(internal table) , so just bind the table to the context node by using bind_table method.

    And all this code you are suppose to write in action of your button.

    Hope this helps you.

    If you have any query , feel free to ask.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 08:51 AM

    Thanks PG and Pranav.

    @ PG

    I have done the steps mentioned by you. I was just a bit unclear about step 3. Could you please be a bit more specific? Yes, i am getting an internal table as the output parameter of the function module. How can i use the bind_table method? I clicked on the wizard icon and in the method call in the current and used controllers, i was not able to find this method.

    Please let me know where the bind_method exists.

    Best Regards,


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Mazin,

      Step 3 is as follows...

      Say you have a context node, you have to bind this node with table UI element, now this node must contain some context attribute which you have to bind with your columns of table. now say name of context node is cn_table. now what you have to do is get data from FM in the internal table..........

      now move data by using move corresponding or by looping depending on requirement to an internal table which has fields with the same name as that of name of your attributes... this is imp to display the data...... now you can bind this internal table with context node using 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.
       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 ).

      ca-one, ca_two, ca_three and ca_enable are name of my context attribute......



      Edited by: Pranav Nagpal on Dec 22, 2008 10:08 AM

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 11:36 AM

    Thanks a lot Pranav...... Issue Resolved.

    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.