cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a reference for custom controller

Former Member
0 Kudos

Hi All,

I am working with the custom controller but i dont know how to call the functionality of custom controller into a view controller.For accessing component controller functionality we have a attribute wd_comp_controller in view controller.Like this how to get a refernce for the custom controller.

Thanks in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Hi Srilalitha ,

You need to add custom controller first, only then you can call any method of custom controller in view controller. Just go to the Property tab of your view and click on add controller button, add the custom controller. Now you can call any method of your custom controller in view controller with the help of code wizard.

I hope it helps.

Regards

Arjun

Answers (4)

Answers (4)

yesrajkumar
Active Participant
0 Kudos

hi,

Lets say view1 has the event ONACTIONNAVIGATE and you want to call a method 'start_navigation' in the custom controller named 'navigation'.

Use the following code.

METHOD onactionnavigate .

DATA lo_navigation_controller TYPE REF TO ig_navigation.

lo_navigation_controller = wd_this->get_navigation_ctr( ).

CASE navigation_type.

WHEN 'BACKWARD'.

lo_navigation_controller->start_navigation( if_fitv_fpm_api=>gc_navigate_backward ).

WHEN 'FORWARD'.

lo_navigation_controller->start_navigation( if_fitv_fpm_api=>gc_navigate_forward ).

ENDCASE.

ENDMETHOD.

Thanks,

Rajkumar.S

Pramanan
Active Participant
0 Kudos

Dear srilalitha,

You can use code wizard (CTRL + F7) to call the method in custom controller.

Once you opened the code wizard , it show the option Method call in Used Controller

select the option and select the controller Name and then method name.

Former Member
0 Kudos

Hi,

Please click the magic wand (CTRL+F7).

Choose method call in current controller. Enter the controller name and choose the method.

You can get the reference to your controller like this.

Regards,

Prosenjit.

Former Member
0 Kudos

Hello,

Please see this [document|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f] where you can find how to use a custom component.

Regards.