cancel
Showing results for 
Search instead for 
Did you mean: 

View controller reference

IanStubbings
Active Participant
0 Kudos

Hi

How do I obtain the view controller reference of a different view to the one I'm in?

For example, My window is made of of two views, MAIN and DETAILS. I wish to check the mandatory fields in MAIN and DETAILS from a method on the component controller.

Therefore, how would I obtain the references? Do I need to set up attributes on the component controller and then populate them in the WDDOINIT of each view?

Cheers

Ian

Accepted Solutions (1)

Accepted Solutions (1)

former_member515618
Active Participant
0 Kudos

Hi Ian,

Create a component controller method check_mandatory_fields

The following should the parameter interface of the method.

I_VIEW_CONTROLLER Importing Type ref to IF_WD_VIEW_CONTROLLER

In this method, call cl_wd_dynamic_tool=>check_mandatory_attr_on_view to do the validation.

In main view, when you want to validate the records, do the following.

DATA: lo_view_controller TYPE REF TO if_wd_view_controller.

lo_view_controller ?= wd_this->wd_get_api( ).

wd_comp_controller->check_mandatory_fields(

EXPORTING

i_view_controller = lo_view_controller ).

These validation can be done at view level. So in detaild view, when you want to validate do the same as mentioned above.

Regards,

Sravan varagani

IanStubbings
Active Participant
0 Kudos

Thanks David, Sravan. That's perfect.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

I think that you need to set up attributes in the component controller and populate them in the WDDOINIT.

But I suggest you to validate the mandatory fields in each view, so you can reuse them if necessary without changing the code, just create an method in the component controller to validate the mandatory fields passing attributes and call it in each view.

Regards.