How to Read Attribute Value of a Context Element in WebDynpro ABAP
Reading Attribute Value of a Context Element in ABAP WebDynpro
In this post,we will learn how to read attribute value of context element in WebDynpro ABAP.It is important that after learning reference variables in webdynpro ,the next important step to learn what is node and element and attribute which are basic elements in webdynpro .So now let us know the get access the element of 'wd' component .
Every webdynpro component contains the root node and child nodes.Child nodes contains the Attributes and attributes are elements of node and every element contains set of values that are string values.So in webdynpro we have to access the final value of node.For this ,we have to create reference variables for nodes ,elements and storing values.
The easiest way to read attribute value of 'lead selection of the element of a node.
Method abaptutor. Data:I_node type refer to IF_WD_CONTEXT_NODE, I_element type refer to IF_WD_CONTEXT_ELEMENT, I_string type string. I_node = wd_context->get_child_node(wd_this->wdctx_node_1) . I_element = I_node->get_element(). I_element->get_attribute(exporting name = 'atr_1' importing value = I_string) Endmethod.
If want to read other than the lead selection element ,the get_element method must be passed a value for the index parameter.
Method abaptutor1. Data:I_node type refer to IF_WD_CONTEXT_NODE, I_element type refer to IF_WD_CONTEXT_ELEMENT, I_string type string. I_node = wd_context->get_child_node(wd_this->wdctx_node_1) . I_element = I_node->get_element(2). I_element->get_attribute(exporting name = 'atr_1' importing value = I_string) Endmethod.
From this post,we have learnt the reading the attribute value from the context element ,In the next tutorial ,we will learn another lesson.
Comments
Post a Comment