cancel
Showing results for 
Search instead for 
Did you mean: 

diffeence between context element and context attribute

Former Member
0 Kudos

Hi,

what is diffeence between context element and context attribute or element and attribute ?

Regards

ertas

For which puposes do you really need those methods. It is grrek to me. I got many anwers

to my questions in my prioir postings but it is not clear to me yet.

get_attribute ( )

get_element( )

Friendly Regards

ertas

Accepted Solutions (1)

Accepted Solutions (1)

former_member230839
Participant
0 Kudos

Hi Ertas,

In simple terms for you to understand treat the CONTEXT NODE as a table and CONTEXT ATTRIBUTE as a field then

get_element means getting the selected record or row in the table

get_attribute means getting the particular field value in that selected record.

You can check the following code

DATA lo_nd_search_crit TYPE REF TO if_wd_context_node.

DATA lo_el_search_crit TYPE REF TO if_wd_context_element.

DATA ls_search_crit TYPE wd_this->Element_search_crit.

lo_nd_search_crit = wd_context->get_child_node( name = wd_this->wdctx_search_crit ).

    • get element via lead selection*

lo_el_search_crit = lo_nd_search_crit->get_element( ).

    • get single attribute*

lo_el_search_crit->get_attribute(

EXPORTING

name = `DATA_DIRECTION`

IMPORTING

value = lv_data_direction ).

The above is the piece of code generated by webdynpro code wizard for a particular CONTEXT ATTRIBUTE DATA_DIRECTION in a CONTEXT NODE for example SEARCH_CRIT in this case.

if you observe the comment **get element via lead selection** following code

it will get the element of the node means selected record of the table

and the next comment **get single attribute* following code

it will get the attribute value for that particular element selected ( record selected )

Regards,

Anil kumar G

Answers (2)

Answers (2)

Former Member
0 Kudos

what is ment with lead selection ?? I am hearing this expression many times

Regards

ertas

Former Member
0 Kudos

check this [http://help.sap.com/saphelp_nwce10/helpdata/en/f1/94384162316532e10000000a1550b0/content.htm]

but to be more simpler, for eg when you select a row of your table that row is your lead selection element.

Regards,

Radhika.

uday_gubbala2
Active Contributor
0 Kudos

Hi Ertas,

A node's element collection can be accessed using a 1-based index value. Exactly one element of the node collection can be marked as the element at lead selection. The lead selection of a context node points to either a single selected node element (value of the lead selection = number of the selected node element) or, if no element is selected, it has the value of the constant IF_WD_CONTEXT_NODE=>NO_SELECTION. The lead selection can be set automatically by the Web Dynpro framework if the context node property

Initialize Lead Selection is set to true. In this case, the first element in a collection will automatically be marked as the element at lead selection. The lead selection can also be set by program source code or it can be set by user actions related to UI elements for example, mark line in table view element, which is bound

to the node).

As how said above the Lead Selection can be used for selecting 1 element from the nodes collection at a time. If you intend to be able to select multiple elements in your components table ui element then you need to go for the "Selection" property instead.

Regards,

Uday

Former Member
0 Kudos

get_element retrieves the reference to an element, either with a special index or the lead selection element.

get_attribute fetches the value of the attribute under the node.

Check this online help

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

Regards,

Radhika.