Webdynpro abap- navigation to context node

Hello all,
I am a new user for Webdynpro - abap. I was trying to set a default value to a input field. I am using WDDOINIT method for navigation to context node FLIGHTINFO. But i am not getting the exact idea behind the navigation at code level. Also not clear about get element at lead selection for context node FLIGHTINFO.
Please provide inputs in this case.
Thanks,
Yogesh

Hi
There can be many nodes in the context, and many elements in each node. In order to set the default value to one of the attributes, we need to proceed as follows:
1) Get the reference of node, whose attribute needs to be defaulted. Following is the code for the same:
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
wd_context has the reference of context node (root node). It gives the reference of desired node (its child node) using method get_child_node. We pass the name of desired node as parameter of this method.
2) In similar way we proceed to get the reference of desired element using following code:
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
3) This element may have many attributes. We set the default value to attribute of selected node using following code:
set single attribute
lo_el_cn_node->set_attribute(
EXPORTING
name = `CA_TEST` " name of attribute where input field is bound
value = lv_ca_test ). "Value that you want to set as default
Follow the links for more help:
http://help.sap.com/erp2005_ehp_04/helpdata/EN/46/14cf058d484250e10000000a1553f6/content.htm
http://help.sap.com/erp2005_ehp_04/helpdata/EN/46/1b994f0c475a67e10000000a1553f7/content.htm.
Regards,
Saket.

Similar Messages

  • Webdynpro ABAP: data binding for node having  subnodes and attributes

    Hello,
    Problem description:
    There is parent node (cardinality 0..n), which has some attributes and also a sub node.
    This parent node has to be bound to an internal table. The fields of internal table correspond to the attributes of the parent node. Now if a "bind_table()" method is used to bind this parent node to the internal table, will it work? If there is any other way to do it let me know!
    Regards
    Sagar

    Hi Sagar,
       If you use the bind_table() method on the parent node, only the attributes( and not the subnode) of the parent node will get set with the values from the internal table. To set the values for the subnode, u have to use bind_table() method on the subnode seperately.
    Hope this helps.
    Thanks and Regards,
    Sharadha.

  • Default Values for Select-options In Webdynpro-ABAP

    Hi Freinds,
    Kindly,Help me in setting the Default values for the Select-options in Webdynpro ABAP.
    Here the Node and the Attributes are Created Dynamically, and then Displayed Select-options Component View.
    Regards,
    Xavier.P

    Xavier Reddy Penta sent me this question via email and I answered it directly yesterday. Here is the solution that I provided to him, so that it is stored with the original question:
    I believe your problem is that you are not setting the value into the range correctly.  You are setting it directly into the field symbol of the range like such:
    <FS> = L_STRING2.
    But ranges are deep objects. They have four fields: Sign, Option, High, and Low. This is from the online help:
    1.     sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.
    2.     option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and special rules apply for entries on the selection screen.
    3.     low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.
    4.     high of the data type defined after FOR. This column is designated for the upper interval limitation.
    So when you are moving the value into the field symbol you are setting it into the sign column.
    Here is an example of how you can access the components of the range:
    * create a range table that consists of this new data element
        lt_range_table =
          wd_this->lv_sel_handler->create_range_table(
               i_typename = l_typename ).
        IF l_fieldname = 'CARRID'.
          FIELD-SYMBOLS: <tab>         TYPE INDEX TABLE,
                             <struct>      TYPE ANY,
                             <wa>          TYPE ANY,
                             <option>      TYPE char2,
                             <sign>        TYPE char1,
                             <high>        TYPE ANY,
                             <low>         TYPE ANY,
                             <wa_values>   TYPE ANY.
          ASSIGN lt_range_table->* TO <tab>.
          APPEND INITIAL LINE TO <tab> ASSIGNING <wa>.
          ASSIGN COMPONENT 'OPTION' OF STRUCTURE <wa> TO <option>.
          ASSIGN COMPONENT 'HIGH' OF STRUCTURE <wa> TO <high>.
          ASSIGN COMPONENT 'LOW' OF STRUCTURE <wa> TO <low>.
          ASSIGN COMPONENT 'SIGN' OF STRUCTURE <wa> TO <sign>.
          <sign> = 'I'.
          <option> =  'EQ'.
          <low> = 'AA'.
        ENDIF.

  • Error creating dynamic context node in Webdynpro for ABAP. Plesae help!

    Hi
       I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
    Note
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    My code is like the following:
    TYPES: BEGIN OF t_type,
                CARRID TYPE sflight-carrid,
                CONNID TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
      dyn_node   type ref to if_wd_context_node,
      rootnode_info   type ref to if_wd_context_node_info,
      i_node_att type wdr_context_attr_info_map,
      wa_node_att type line of wdr_context_attr_info_map.
          wa_node_att-name = 'CARRID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
          insert wa_node_att into table i_node_att.
          wa_node_att-name = 'CONNID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
          insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
                                       attributes = i_node_att
                                       is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition

    Ok, I think I found a bug... It seems for adobe forms in WD4A, the root context node must be 1-1 and you must nest the 1-n node within that... Not sure why, but it worked. So in my case my context would look like this:
    FOO_NODE (1-1)
         Widget (1-N)
              -Widget_info (1-1)
                   *Name
                   *Sku
                   *Description
              -Widget_plant (1-M)
                   *Plant_Code
                   *Plant_State
                   *Plant_City
              -Widget_pic (1-1)
                   *Picture

  • Read Context  Node/Attribute option in webdynpro code wizard not available

    Hi Expets,
    I am new to webdynpro Abap, i have developed a small application to set default values for two fields. i want to use code wizard to implement the code. When i click on code wizard icon  in application tool bar, i have found lot of option like Method call in current controller, method call in used controller, Instantiate used component ... etc. But i didn't find the option Read Context Node/Attribute. Do i need to do any settings to get that. Kindly suggest. Your help will be greatly appreciated.
    Venkat

    Hi,
    Check the NW release,
    I checked with NW 7.02 - 2 tabs were available.
    with NW 7 - only 1 tab was available which you mentioned.
    Additional tab (Context ) might have been added after NW release 7.0.
    Regards
    Manas Dua

  • Webdynpro ABAP. read context TABLE

    Hi,
    i am trying to read a context in an webdynpro for ABAP where the context is an table. if I try to read a single attribute there is no problem:
    get single attribute
      elem_ex_mat_data->get_attribute(
        EXPORTING
          name =  `MATNR`
        IMPORTING
          value = item_matnr ).
    Now I see my value in the variable item_matnr.
    But how can I get the whole context table EX_MAT_DATA into a internal table. I tried the the wizard with reading the context of this table EX_MAT_DATA and I get the following coding:
      DATA:
        node_changing                       TYPE REF TO if_wd_context_node,
        node_ex_mat_data                    TYPE REF TO if_wd_context_node,
        elem_ex_mat_data                    TYPE REF TO if_wd_context_element,
        stru_ex_mat_data                    TYPE if_tree=>element_ex_mat_data .
    navigate from <CONTEXT> to <CHANGING> via lead selection
      node_changing = wd_context->get_child_node( name = if_tree=>wdctx_changing ).
    navigate from <CHANGING> to <EX_MAT_DATA> via lead selection
      node_ex_mat_data = node_changing->get_child_node( name = if_tree=>wdctx_ex_mat_data ).
    @TODO handle not set lead selection
      IF ( node_ex_mat_data IS INITIAL ).
      ENDIF.
    get element via lead selection
      elem_ex_mat_data = node_ex_mat_data->get_element(  ).
    @TODO handle not set lead selection
      IF ( elem_ex_mat_data IS INITIAL ).
      ENDIF.
    alternative access  via index
    Elem_Ex_Mat_Data = Node_Ex_Mat_Data->get_Element( Index = 1 ).
    @TODO handle non existant child
    if ( Elem_Ex_Mat_Data is initial ).
    endif.
    get all declared attributes
      elem_ex_mat_data->get_static_attributes(
        IMPORTING
          static_attributes = stru_ex_mat_data ).
    While debugging I find in node_ex_mat_data (CLASS=CL_WDR_CONTEXT_NODE_VAL) a attribute collection with 55 values (thats the number of values the context table should have) but I have no idea how to get the values for my internal table.
    Please help.
    regards
    stefan

    Hi Stefan,
    You could call method get_static_attributes_table(). It returns the content of a node as an internal table. Only static attributes are considered of course.
    Best regards,
    Thomas

  • How to update a webdynpro context node from flex ?

    Hi
    I have an table in webdynpro and a datagrid in flex, both getting the value from the same context node. My requirement is to make the table fields editable and when I make changes in the datagrid, it should get reflected back in the webdynpro table.
    So how can I access the internal table's context node from flex ?
    Can anyone help me with this.

    Hi,
    As you are using a datasource, i assume you have set method in flex to read the datasource(context node). What you need to do is store the reference to this datasource in a local flex variable. Have a look at the below code:
    private var refreshFlexUINode:ArrayCollection;
    public function set refreshFlexUI(datasource:ArrayCollection):void
        refreshFlexUINode=datasource;
    and say you want to edit one row of the table, get that row from ArrayCollection and assign the new value.
    it would be like, if you want to save second row of the datagrid
    Object obj = refreshFlexUI.getItemAt(1)
    obj[<CONTEXT_ATTR_NAME>]=<new value>
    Hope this helps!
    Best Regards,
    Srilatha
    Edited by: Srilatha M on Jun 28, 2011 6:34 AM
    Edited by: Srilatha M on Jun 28, 2011 6:35 AM

  • ABAP: dynamic context node + attribute for DROP_DOWN_BY_KEY

    Hello,
    I need to create a Node with attributes dynamically and than assign it to a DROP_DOW_BY_KEY element in ABAP.
    I create drop down this way:
    drop_down_figure = cl_wd_dropdown_by_key=>new_dropdown_by_key( bind_selected_key = 'REPOSITORY.FIGURES' on_select = 'GET_OPERATOR' ).
      cl_wd_grid_data=>new_grid_data( element = drop_down_figure ).
      ui_container->add_child( drop_down_figure ).
    However, here I bind to REPOSITORY.FIGURES. Instead of doing this I need to bind it to an attribute that I create.
    I can access wd_context but I am not sure how to create a node in wd_context, then attribute for that node that will contain items for drop down.
    bind_selected_key is type of String. If I create a node with attribute how do I cast it to a String so I can pass it to a constructor of a drop down?
    Thank you.

    Hi Georgy,
    There is a 3 - series weblog for this.
    The first one is:
    /people/thomas.szcs/blog/2005/12/28/dynamic-programming-in-web-dynpro-abap--introduction-and-part-i-understanding-ui-elements
    The following are the the general steps for creating a node and table where table name is input by the user:
    DATA:
      UI Elements
        group_1       TYPE REF TO cl_wd_uielement_container,
        new_tab       TYPE REF TO cl_wd_table,
      Context Nodes
        dyn_node      TYPE REF TO if_wd_context_node,
        tabname_node  TYPE REF TO if_wd_context_node,
      Node Info
        rootnode_info TYPE REF TO if_wd_context_node_info,
      Data Reference (for internal table)
        stru_tab      TYPE REF TO data,
      String (for table name)
        tablename     TYPE string.
      FIELD-SYMBOLS:
        <tab> TYPE table.
    1) * get node info of context root node
      rootnode_info = wd_context->get_node_info( ).
    2) * create sub node named TEST1 of structure (tablename)
      cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
        parent_info = rootnode_info
        node_name = tablename
        structure_name = tablename
        is_multiple = abap_true ).
    3) * get instance of new node
      dyn_node = wd_context->get_child_node( name = tablename ).
    4) ***** create new UI element table *******************************************************
      new_tab = cl_wd_dynamic_tool=>create_table_from_node(
    ui_parent = group_1
    table_id  = 'TESTTAB'
    node      = dyn_node ).
    5) ***** fill context node with data *******************************************************
    create internal table of (tabletype)
      CREATE DATA stru_tab TYPE TABLE OF (tablename).
      ASSIGN stru_tab->* TO <tab>.
    Get table content
      SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.
    Bind internal table to context node.
      dyn_node->bind_table( <tab> ).
    Regards,
    Srini.

  • Context system menu (Webdynpro Abap)

    Hi Guru,
    Help me!!! How can I disable/hide the context menu in webdynpro Abap for system user parameter, when I run a web application?
    E.g.
    - Setting 
    - Quick help On/Off
    - More Field Help
    Thanks

    Hi,
    please watch this [Thread|https://forums.sdn.sap.com/click.jspa?searchID=9590724&messageID=4706614]
    grtz,
    Koen
    Edited by: Koen Labie on Mar 10, 2008 4:00 PM
    corrected link

  • How to bind webdynpro abap context attributes with interactive form table

    hi,
    I was created table in interactive form and add the all context attributues to each column of the table.
    And add the table into the subform.
    i want to bind the table using bapi values form Webdynpro abap.
    please give the detailed explanation.
    by
    Parthasarathi

    Hey Lingam,
    Check out this link...
    [Inserting a Table or Loop|http://help.sap.com/erp2005_ehp_04/helpdata/EN/4c/9cc19e5c874091a99790e540b06f3a/frameset.htm]
    It's for EhP4, so I'm not sure if it would apply.
    Hope this helps...
    Cheers,
    Kevin

  • Export  WebDynpro context node  to CSV format?

    I have successfully implemented exporting the context node to xml format then open through the Excel following the tutorial : Exporting Context Data into Excel Using the Web Dynpro Binary Cache.
    But now, I need to implement another version that export to CSV format, then open through Excel.
    I remembered I read a blog and some forum posts that mentioned about this solution, but I just could not locate where they are now through SDN search now.
    I will appreciate if someone can point me to those links again.
    Thanks.
    Kent

    Hi Kent,
    I am also developing the application wherein Table data needs to be exported to Excel.
    I am trying to download the WDExcelExport.zip from the foll. link
    https://wwwn.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/bad3e990-0201-0010-3985-fa0936d901b4 [original link is broken]
    But I am getting the error
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    The exception was logged. Inform your system administrator..
    See the details for the exception ID in the log file
    Can you please send me the Sample Application WDExcelExport.zip. My mail id is  [email protected]
    Regards
    Nikhil Bansal

  • How to deal with the dynamic nodes ...in webdynpro abap

    Hi Guys,
    How to insert the dynamic nodes in the context controller...
    Thanks
    Chandra

    You can use node_info to create a dynamic node or use CL_WD_DYNAMIC_TOOL to create dynamic nodes under a node
    For Eg Struc_Node
    fields A type char20,
    fields B type char 20
    For Eg : To Create Node under Context Node( Root Node).
    data lv_node_info type ref to if_wd_context_node_info.
    lv_node_info = wd_context->get_node_info( ).
    CALL METHOD lv_node_info->add_new_child_node
    EXPORTING
    static_element_type = 'Struc_node
    name = lv_node_name
    is_static = abap_false
    is_multiple_selection = abap_true
    RECEIVING
    child_node_info = lv_child_node_info.
    or
    CL_WD_DYNAMIC_TOOL=>CREATE_NODEINFO_FROM_STRUCT

  • (ABAP) Internal table of type context node (Urgent)

    Hi All,
           I created a internal table in a view say ABC_VIEW using a context node say ABC_NODE. This is did using following statement:
    it_abc type table of if_abc_view=>element_abc_node.
    Now I would like to pass this as a exporting parameter to a method in component controller. Kindly suggest how i can achieve this. I tried the following:
    it_abc exporting element_abc_node.
    But this does not work.
    Kindly reply soon.
    Regards,
    Anoop
    Message was edited by: Anoop Singh Saini

    Hi Anoop,
    Web Dynpro generates an internal table (and structure) for each context node in a controller's context. Such a definition is local to the controller where the node is defined, since a different controller could have a node of the same name with different attributes. Nonetheless, it is possible to transfer the data of a node to another controller by:
    (a) Using a DDIC structure for a context node. The generated structure and the DDIC structure are the same then. The generated internal table is a standard table. If you define one in DDIC or somewhere else, you can use it for typing the parameter.
    (b) Transfer the pointer to the node! You can still access it from any other place.
    Best regards,
    Thomas

  • Read the name of a parent node of a (static) Tree UI in WebDynPro Abap

    hi Experts,
    I have a tree control UI that has two levels of nodes from the Root node. Year & Month. Inside the Month Node there is always only one leaf that is called Current Schedule. User clicks on Current Schedule to view the Current Schedule. This could be any month's Current Schedule of the User's choice.
    Thus, I need to know which month's current schedule is chosen by the user. My tree UI is an adaptation from WDT_TREE example from Std SAP example programs. For the chosen month to be known, I have to go up in the context node hierarchy by one level? (something like, get_parent of) from the current leaf. I am not sure how would i do it. Any pointers would be greatly helpful. I tried to pick up ideas from couple of tutorials and bunch of forum posts but I did not get anywhere.
    The key to my requirement is just going up one level in the tree and get to know the 'name' of that node. That will tell me the Month of the User's choice.
    Thanks in advance for your helpful answers/pointers

    Thanks Bala Duvvuri,
    Could you please elaborate a bit more on your tip. I am a fledgling OO abapper not 'really' knowing as much OO as I should ..!!
    By the way,I found out, I could apply the same OnAction method in the WDT_TREE example shown at the final leaf level to the node level as well to read the text of Month Node. It worked out and it meets my purpose with a rider..!
    In order to get this Month node text for the selected 'Current Schedule' leaf, User have to click on the Month Node that opens the Current Schedule Leaf. If they clicked on the triangle beside the node, it still opens the Month Node to reveal the Current Schedule leaf, but the Month name wont be captured until User expressly clicked on Month Node first or the Folder Icon associated with it..!!
    In other words, User cannot click on the left side triangle;  if they did to reach the Current Schdule, the program wont work properly. This is no good, though i could talk my way through with the User to accept this. But technically i know it is possible to know the month name from a given Current Schedule leaf in the tree,though dont know how ..!!
    Your bit more detailed reply would help me implement the more elegant solution than pushing the user to accept what i did.
    As I await your reply i shall try to pick up from your tip.
    In the meanwhile my tree has grown ..!! to have two more nodes, in which the contents need to be dynamically populated. Guess I am in for a long haul with the Tree UI
    Looking to hear more. Thanks heaps again.

  • FPM Navigation - asking for Log on when calling WebDynpro ABAP Application

    Hi Experts,
    I want to call a Non FPM based WebDynpro ABAP Application from a FPM Component.
    I have followed the method showed in the following thread by Rajkumar to call WebDynpro Application using URL.
    [Launch transaction without launchpad|Re: Launch transaction without launchpad]
    I could successfully call my WebDynpro ABAP application using this approach,
    However when the application opens in new Browser , it asks for log on again.
    Can anyone help me to avoid this log in screen.
    P.S. --> Both the applications are in the same server.
    Regards,
    Ashish Shah

    Hi Ashish ,
    I am also facing the same problem , did you find any solution ?
    Thank You,
    Aman

Maybe you are looking for