Skip to Content
author's profile photo Former Member
Former Member

View controller reference

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Apr 09, 2008 at 05:40 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 04:57 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.