Create the node and attribute, lets say node name (demo_node) attribute name (name) type 'string'.
Just use the code wizard by "set context" functionality....
Select the attribute and ok.. Following code will come automatically.
DATA lo_nd_demo_node TYPE REF TO if_wd_context_node.
DATA lo_el_demo_node TYPE REF TO if_wd_context_element.
DATA ls_demo_node TYPE wd_this->element_demo_node.
DATA lv_name TYPE wd_this->element_demo_node-name.
lo_nd_demo_node = wd_context->get_child_node( name = wd_this->wdctx_demo_node ).
lo_el_demo_node = lo_nd_demo_node->get_element( ).
lo_el_demo_node->set_attribute(
name = `NAME`
VALUE = lv_name).
" Now you write your own value in the lv_name before calling set_attribute name...
lv_name = 'Murali'. " Provide the compatible value..
lo_el_demo_node->set_attribute(
name = `NAME`
VALUE = lv_name).