cancel
Showing results for 
Search instead for 
Did you mean: 

calling comp controller attribute from iinside view

Former Member
0 Kudos

HI all,

I want to know how to call a component controller attribute from inside a View's method?

any sampe coding..?

Regards,

Shanthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

if u have declared a attribute in ur component controller , thn u can acess it in ur view using


wd_comp_controller->gv_variable

where name of ur context attribute in comp controller is gv_variable

u cn do it thru code wizard as well

Answers (2)

Answers (2)

Former Member
0 Kudos

Well, you can use the wizard. Just call any method from the component controller. The wizard will create you the code including the line how you will get a reference to the component controller, which is the point here.

After you have the reference to the component controller, let's say lo_component_controller, you can access its attributes like this:

lo_component_controller->your_attribute

Then of course delete the unnecessary lines of code.

Regards,

Karri

Former Member
0 Kudos

you can use

lv_var is in comp controller attributes tab.

wd_comp_controller->lv_var

Former Member
0 Kudos

HI,

How to declare this WD_COMP_CONTROLLER?

Former Member
0 Kudos

Hi

WD_COMP_CONTROLLER is reference variable to component controller

By default it was available in view attributes tab.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Older Support Package levels didn't have the built-in attribute for WD_COMP_CONTROLLER. You had to use the following code to access the component controller:

DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

Actually some of the code wizards still generate this even now that we have WD_COMP_CONTROLLER built in.