Show TOC Start of Content Area

Background documentation Reading the Structure from a Context Element  Locate the document in its SAP Library structure

The attribute set for a context node can be structured in different ways. It is common to use an ABAP Dictionary structure. A list of attributes compiled manually at design time also constitutes a structure. Attributes assigned at design time are called static attributes (in contrast to attributes that are dynamically added to a context node at runtime). In our simple example, the structure consists of the three static attributes Attr1_1, Attr1_2, and Attr1_3.

This graphic is explained in the accompanying text

 

This graphic is explained in the accompanying text

 
Reading the Structure of the Lead Selection Element

A variable of the type of an element of the node is required to read this structure in its entirety. This local variable (l_my_struc in the source code example below), is easiest to declare using the context type definition that is defined for each context node in the IF_WD_MY_CONTROLLER interface.

Note You can view the IF_WD_<controller_name> interface of the controller that you are currently processing in the ABAP Workbench. To do so, click the following icon:

          This graphic is explained in the accompanying text     Display Controller Interface

 

 

method EXAMPLE .  

 

data: l_node                     type ref to IF_WD_CONTEXT_NODE,

      l_my_struc                 type ref to IF_MY_CONTROLLER=>element_node_1.

  

 

l_node = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_node->get_static_attributes( importing static_attributes = l_my_struc ).

. . . . . . . . .

 

endmethod.

   

 

The GET_STATIC_ATTRIBUTES method has the static_attributes formal parameter. Its value is passed to the l_my_struc local variable of the EXAMPLE method.

In principle, it is also possible to declare the type of the local variable in a different way than directly using the type definition of the node being read from. In this case, a MOVE_CORRESPONDING statement is executed automatically at runtime (see ABAP Language Reference). 

Reading from the Structure of Any Element

Analog to reading an attribute value from any node element, it is also possible to read a structure of any element. The GET_STATIC_ATTRIBUTES method also has the INDEX parameter.

 

 

method EXAMPLE .  

 

data: l_node                     type ref to IF_WD_CONTEXT_NODE,

      l_my_struc                 type ref to IF_MY_CONTROLLER=>element_node_1.

  

 

l_node = wd_context->get_child_node( wd_this->wdctx_node_1 ).

 

l_node->get_static_attributes( exporting index = 2 importing static_attributes = l_my_struc ).

. . . . . . . . .

 

endmethod.

   

 

Analog to reading an attribute value, it is possible to navigate to a specific element of the node before reading the structure.

 

method EXAMPLE .  

 

data: l_node                     type ref to IF_WD_CONTEXT_NODE,

      l_element                  type ref to IF_WD_CONTEXT_ELEMENT,

      l_my_struc                 type ref to IF_MY_CONTROLLER=>element_node_1.

 

l_node     = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_element  = l_node->get_element( 2 ).

 

l_element->get_static_attributes( importing static_attributes = l_my_struc ).

. . . . . . . . .

 

endmethod.

   

 

 

End of Content Area