on 10-06-2014 1:36 PM
Hi
I found many article about "Reading Component controller’s context node from view without mapping in Web Dynpro for ABAP" etc.http://www.saptechnical.com/Tutorials/WebDynproABAP/views/ContextNode.htm
But I need read only attribute from node with carninality 1..1.
How is it possible?
Thank you
Hi,
Use get_attribute( ) method of context element to read the single attribute.
Try the below code:
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_controller TYPE REF TO if_wd_controller.
data lo_context TYPE REF TO if_wd_context.
DATA lo_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA lv_attr TYPE wd_this->element_node-attr.
* Get Node from Component Controller
lo_controller ?= wd_comp_controller->wd_get_api( ).
lo_context = lo_controller->get_context( ).
lo_node = lo_context->root_node.
lo_nd_node = lo_node->get_child_node( name = 'NODE_NAME' ). " NODE_NAME if the name of content node
lo_el_node = lo_nd_node->get_element( ).
* Get attribute
lo_el_node->get_attribute(
EXPORTING
name = `ATTR_NAME` " ATTR_NAME is the name of Attribute in Context Node
IMPORTING
value = lv_attr ).
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.