cancel
Showing results for 
Search instead for 
Did you mean: 

if_wd_context_element

former_member185241
Active Participant
0 Kudos

Hi Experts,

method WDDOINIT .

  data node_context type REF TO if_wd_context_node.

  data node_ele type REF TO if_wd_context_element.

  call METHOD wd_context->get_child_node

   EXPORTING name = 'FLIGHT_INFO'

   RECEIVING child_node = node_context.

  CALL METHOD node_context->get_element

   RECEIVING node_element = node_ele.

  CALL METHOD node_ele->set_attribute

    EXPORTING name = 'CARRID'

              value = 'AA'.

endmethod.

This Method will set the default value for CARRID as 'AA'.

set_attribute is a method of interface if_wd_context_node. OK..

Then how r we able to call this method using a reference of type if_wd_context_element??  (You can see in my Coding Also)

I am not getting the concept so please help me

Accepted Solutions (0)

Answers (2)

Answers (2)

chengalarayulu
Active Contributor
0 Kudos

Hi Abhishek,

FYI,

SET_ATTRIBUTE method is exists under both the interfaces IF_WD_CONTEXT_ELEMENT & IF_WD_CONTEXT_NODE. but the difference between those both is..

if you have already bound elements to the NODE.. and you wanna change some attribute in particular element.. then you can use SET_ATTRIBUTE method under interface IF_WD_CONTEXT_NODE with INDEX number as exporting parameter.

And you wanna set an attribute value irrespective of data existency at node level.. then you must use SET_ATTRIBUTE of interface IF_WD_CONTEXT_ELEMENT.

Former Member
0 Kudos

Hi abhisheik,

set_attribute method is also present in if_wd_context_element. we are not using a reference of type if_wd_context_element to point to if_wd_context_node. The variable node_ele in ur program points to an object of type if_wd_context_element which is received from the node_context object.

Check out the methods of if_wd_context_element. It has set_attribute and get_attribute.

Regards

Fareez.