cancel
Showing results for 
Search instead for 
Did you mean: 

How to get component controller context from a view

Former Member
0 Kudos

Hi Experts

Could you please show me how to get component context from a view. I tried to access node from component context from a view but no success.

Thank you for you kindess

Accepted Solutions (1)

Accepted Solutions (1)

vivekananthan_sellavel
Active Participant
0 Kudos

hi

In coding we can call the comonent controller

1.Component Controller Attributes Define Attribute name

comp_con type ref to IF_WD_CONTEXT_NODE. and make as public

2.Component Controller Init( ) method

wd_this->comp_con = wd_context.

For example i am just printing the message

Comp node name Sample and Attribute A1 type String .

3.In View Init ( ) we can call the context. and prinbting the Attibute

  • get message manager

DATA lo_api_controller TYPE REF TO if_wd_controller.

DATA lo_message_manager TYPE REF TO if_wd_message_manager.

data mes TYPE string.

lo_api_controller ?= wd_this->wd_get_api( ).

DATA lo_nd_sample TYPE REF TO if_wd_context_node.

DATA comp_context TYPE REF TO if_wd_context_node.

lo_nd_sample = wd_comp_controller->COMP_CON->get_child_node( 'SAMPLE' ).

lo_nd_sample->get_attribute( EXPORTING name = 'A1' IMPORTING value = mes ) .

CALL METHOD lo_api_controller->get_message_manager

RECEIVING

message_manager = lo_message_manager

.

  • report message

lo_message_manager->report_success( EXPORTING message_text = mes ) .

regards

Vivekananthan.S

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

If you want to use component controller context. drag component controller context to view controller context

other way: create the same node in view & right click on node & do data binding. between controllers.

Best Regards

Ravi

Former Member
0 Kudos

Hi

For accessing the component controller context,

firstly u have to map the context of component controller and view controller.

For this just go to the view controller context. Now in the right hand side u can see the component controller context.

Just drag and drop the node( which u want to use in view controller ) of component controller in view controller. U will get a pop up, now press yes. the complete node gets mapped to view controller and u can access this node as like the view context node.

Thanks,

Pankaj Aggarwal

Former Member
0 Kudos

Hi

map ur component controller context node to view controller cotext node . Access the attributes using

" WD_COMP_CONTROLLER ".

former_member402443
Contributor
0 Kudos

Hi Dean,

Just goto the View Context ,there you will seen on the right side the component controller context node.

Just drap and drop the node that you want in your view on the lefft hand side .

This will automatically create the mapping between the controller node.

Now you can access the node values in your view.

Hopes this will helps you.

Regards

Manoj Kumar

Former Member
0 Kudos

Hi Kumar

No, there are cirscumstances that i do not want a map. Since i call the function from component several times. First time i want the info returned info mapped to view node but not for the subsequent calls

Thank you

abhimanyu_lagishetti7
Active Contributor
0 Kudos

you cannot directly access the context of componentcontroller in View without mapping..

however there is a workaround, create a public attribute in the comopnent controller with name lr_context of type if_wd_context_node.

and in the WDDOINIT assign lr_context with WD_CONTEXT.

Now you can directly access lr_context from View. i think this is possible.

Abhi