cancel
Showing results for 
Search instead for 
Did you mean: 

Reference to Custome Controller from View controller

Former Member
0 Kudos

Hi all,

I have created a custom controller and inside that i have a method. i need to execute that method from a view controller, similar to executing a method in the component controller. to execute a method in the component controller i use the WD_COMP_CONTROLLER attribute to refer to the component controller. similarly how to i refer my custom controller from the view, or is there any other way? it would be great if someone can help me with this.

Malinda

Accepted Solutions (0)

Answers (3)

Answers (3)

arjun_thakur
Active Contributor
0 Kudos

Hi Malinda,

Proceed in this manner:

Open your view, then go to the PROPERTIES tab of the view. Click on the create button and add the custom controller you have created. After doing this, go to the Method tab of the view and then simply call the custom controller method with the help of code wizard in any method. The code will look like :

DATA lo_zcustom TYPE REF TO ig_zcustom .

lo_zcustom = wd_this->get_zcustom_ctr( ).

lo_zcustom->test(

).

Here zcustom is the name of my custom controller and test is the name of the method.

I hope it helps.

Regards

Arjun

arjun_thakur
Active Contributor
0 Kudos

If the problem is resolved then close this thread.

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

Former Member
0 Kudos

Dear Malinda,

when ur using the custom controller we need to call the Read context Node/Attribute from the Webdynpro code wizard then call the method .

regards

Jaipal