cancel
Showing results for 
Search instead for 
Did you mean: 

Diff between if_wd_context_node and if_wd_context_element

Former Member
0 Kudos

Hi Experts,

Im new to WebDynpro. I have one Context node with Structure of mara.

Then using Code wizard i read the node. See the code below :

DATA:
    node_node_wo_att                    TYPE REF TO if_wd_context_node,
    elem_node_wo_att                    TYPE REF TO if_wd_context_element,
    stru_node_wo_att                    TYPE if_testview=>element_node_wo_att .

* navigate from <CONTEXT> to <NODE_WO_ATT> via lead selection
  node_node_wo_att = wd_context->get_child_node( name = if_testview=>wdctx_node_wo_att ).

* @TODO handle not set lead selection
  IF ( node_node_wo_att IS INITIAL ).
  ENDIF.

* get element via lead selection
  elem_node_wo_att = node_node_wo_att->get_element(  ).

* @TODO handle not set lead selection
  IF ( elem_node_wo_att IS INITIAL ).
  ENDIF.

* alternative access  via index
* Elem_Node_Wo_Att = Node_Node_Wo_Att->get_Element( Index = 1 ).
* @TODO handle non existant child
* if ( Elem_Node_Wo_Att is initial ).
* endif.

* get all declared attributes
  elem_node_wo_att->get_static_attributes(
    IMPORTING
      static_attributes = stru_node_wo_att ).

From the above code, three variables are automatically generated(node_node_wo_att, elem_node_wo_att and stru_node_wo_att).

So from the three variables node_node_wo_att is used for access the nodes of the context.

But im not clear about what is the use of elem_node_wo_att and stru_node_wo_att ?

Please anybody help on this issue.

Thanks in advance,

Points assured.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jasmine,

node_node_wo_att is the reference variable, which can have the address of your node. Through this refrerence variable you can access the properties of your node interface if_wd_context_node. Check in SE24, enter the inerface name as if_wd_context_node and you can check for all the methods through which you can access the various properties of your context node.

Now elem_node_wo_att, is the reference variable for one work area of your context node. This is again a reference variable and if now want to access information/values of your node element then you need a structure variable of type your context node which is stru_node_wo_att. Now this structure can have values if you use the method get_static_attributes by your element reference variable elem_node_wo_att. consider the following example:

Node name: Attributes Value in the UI screen element

Name

First name Ashish

Second name Singhal

Now to access the values "Ashish Singhal" you need a reference variable to your context node (n1). Through this N1 you now need a reference to the element(E1) of the context node. This you do through get_element( ) method.

Now to access the actual values of the element E1 you need to have a structure(S1) in which you can have the values of the node. So you use get_static_attributes() method to return the values (First name and Second name) through the E1 variable. you now have the actual value in S1.

Check IF_WD_CONTEXT_ELEMENT in S24 transactions for any further information.

Cheers.

Ashish Singhal.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Experts. I got the point.

Former Member
0 Kudos

Hi Jasmine,

elem_node_wo_att is a Reference Variable whereas stru_node_wo_att is an Internal Table. U can access the Values from the Node thru the elem_node_wo_att.

Regards,

Padmam.