cancel
Showing results for 
Search instead for 
Did you mean: 

get_child_node, get_attribute, get_element

Former Member
0 Kudos

Hi expterts,

pls. can someone try to explain me the difference between these methods

briefly since I do very often mix them up.

get_child_node ( )

get_attribute ( )

get_element( )

Regards

ertas

Edited by: Ilhan Ertas on May 22, 2009 2:40 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member230839
Participant
0 Kudos

Hi Ertas,

The get_element has a different meaning when it comes to context or UI element accessing

if you want to get the reference of the UI element in a view the method will give the reference

for example like the following code will get the container reference to LO_CONT.

data : lo_ui_ovr type ref to if_wd_view_element.

data : lo_cont type ref to cl_wd_uielement_container.

lo_ui_ovr = curr_view->get_element( id = 'OVR_CONT' ).

lo_cont ?= lo_ui_ovr.

on the other way get_element in context node is nothing but getting the reference of the lead selected record. Check the following code for example

DATA lo_nd_result_table TYPE REF TO if_wd_context_node.

DATA lo_el_result_table TYPE REF TO if_wd_context_element.

  • navigate from <CONTEXT> to <RESULT_TABLE> via lead selection

lo_nd_result_table = wd_context->get_child_node( name = wd_this->wdctx_result_table ).

  • get element via lead selection

lo_el_result_table = lo_nd_result_table->get_element( ).

the last statement will get the lead selected record reference to element variable LO_EL_RESULT_TABLE.

Regards,

Anil kumar G

Answers (3)

Answers (3)

Former Member
0 Kudos

Vadher thanky ou

but why do I need a reference of the Ui element I created in the view ?

Anil Kumar said see above :
the method GET_ELEMENT used to get a reference of the any Ui element you created in the view.

Regards

ertas

Former Member
0 Kudos

Hi,

get_child_node : fetches your node

get_attribute : fetches attribute within the node or individual attributes declared in the context

get_element : fetches a specific context element.

[http://help.sap.com/saphelp_erp2005/helpdata/EN/fd/be5b4150b38147e10000000a1550b0/content.htm]

[http://help.sap.com/saphelp_nw70/helpdata/en/32/bf5b4150b38147e10000000a1550b0/content.htm]

Edited by: Radhika Vadher on May 22, 2009 6:14 PM

Former Member
0 Kudos

hi Radhika

you wrote:

get_attribute : fetches attribute within the node or individual attributes declared in the context

What happens if there is no node exitsing. Instead only yattributes. How can you fetch or access

in this case ?

Regards

ertas

Former Member
0 Kudos

Hi Ertas,

In that case, using the element you can acces the attribute as follows,

Data: l_elem type ref to if_wd_context_element.

l_elem = wd_context->get_element( ).
l_elem->get_attribute( exporting name = 'ATTRIBUTE NAME'
                                  importing value = l_value ).

You can use the code wizard too.

Regards,

Radhika.

former_member230839
Participant
0 Kudos

Hi Ertas,

the method GET_CHILD_NODE is used to get a reference of the CONTEXT NODE which was created in the view

the method GET_ATTRIBUTE used to get the value of the attribute of the CONTEXT NODE you created.

the method GET_ELEMENT used to get a reference of the any Ui element you created in the view.

Regards,

Anil kumar G