cancel
Showing results for 
Search instead for 
Did you mean: 

creating context element

Former Member
0 Kudos

Hi,

How can we creat an context element and bind it to the parent context node?

Thanks & regards,

Sujit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Please refer to this: [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4345] [original link is broken] [original link is broken] [original link is broken];.

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

on parent context node right click of mouse and create attribute

Sm1tje
Active Contributor
0 Kudos

right mouse click on node for which you want to create attribute (node). This way it belongs to this node.

If you want to create a subnode, do the same.

Former Member
0 Kudos

Hi Micky,

Thanks for the reply!

Actually my query is how can we create a context element dynamically in the code and bind it with the node.

Thanks & regards,

Sujit

Former Member
0 Kudos

Hi Sujit,

plz find the code to add an element dynamically below.

DATA l_node TYPE REF TO if_wd_context_node.

DATA : l_element TYPE REF TO if_wd_context_element

"get the parent node

l_node = wd_context->get_child_node( name = 'parent_node').

" create an element

l_element = l_node->create_element( ).

"set the attributes for the element

l_element->set_attribute(

EXPORTING

value = lv_value " Attribute Value

name = 'attribute_name'" ).

"bind the element to parent node

l_node->bind_element(new_item = l_element ).

with regards,

ajay

Former Member
0 Kudos

Hi,

Thanks for the help!

This issue is solved now.

Thanks & regards,

Sujit