cancel
Showing results for 
Search instead for 
Did you mean: 

Set Values to Attribute in COMPONENTCONTROLLER

swapnil_rane
Explorer
0 Kudos

Hi experts,

I am beginner in Web DynPro ABAP. I have declared Attribute ELEM in 'Attributes' tab of COMPONENTCONTROLLER. I have declared ELEM type as IF_WD_CONTEXT_ELEMENT as I want to save Lead_Selection() in it. Now I want to SET value to ELEM from method of some view.

How it can be done?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi SwapnilR

look at the below sample senario to get attribute from the component controller

Example :

create a attribute in component controller .

CC_ATTRIBUTE type STRING ( public check box shoul be checked so that the scope of attribute will be in entire component )

assign value to the attributr in component controller ( do init method )

wd_this->CC_ATTRIBUTE = ' HAI'.

Now get this value in any view

*getting component controller attribute value in view

data :COMP_CONTROLLER type  string .
COMP_CONTROLLER = wd_comp_controller->CC_ATTRIBUTE  . " to get HAI

Regards

chinnaiya P

Former Member
0 Kudos

Hi,

You have a code Generator in webdynpro . you use it to get the reference of the leadselect element and assign this reference to your comp_controller attribute.

for example. DATA is my node name.

DATA lo_nd_data TYPE REF TO if_wd_context_node.

DATA lo_el_data TYPE REF TO if_wd_context_element.

DATA ls_data TYPE wd_this->element_data.

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

lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_data ).

  • get element via lead selection

wd_comp_controller->ELEM = lo_nd_data->get_element( ).