Access context of Component Controller from Views

Hi,
  In WD Java, I used to set attributes value for Context present in Component controller from the view. I used to write a piece of code at the view level for this.
How do i do this in WD ABAP. I believ I have to get instance of Component controller like this:
lr_compcontroller type REF TO ig_componentcontroller.
lr_compcontroller = wd_this->get_componentcontroller_ctr( ).
Regards,
Murali.

Hi Murali,
yes you can access the comp_controller in the same sort of way in WDA.
You declared component usages on the property tab.
The wizard (ctrl-F7)has various options, check it out.
One is calling methods on declared controller usages.
the result is for example such generated code:
DATA: l_ref_ANOTHER_CONTROLLER TYPE REF TO IG_ANOTHER_CONTROLLER .
      l_ref_ANOTHER_CONTROLLER =   wd_This->Get_Another_Controller_Ctr( ).
data:
      l_Api_Another_Controller type ref to IF_WD_CONTROLLER.
See also local interface code in CTRL-SHIFT F1.
You work directly with this info.  Indeed constants from the interfaces should be used this way.
Work with the wizard. And declare all usages in the properties tab.
Moving outside of the framework is possible but not recommended
regards
Phil

Similar Messages

  • Calling methods in controller from View.

    Hi Experts,
    Can any one let me know or point to the document which explains how to call a userdefined method in component controller from view.
    Thanks,
    James

    You have to define a "controller usage" using the controller editor. Then the code generator will create an accessor "wdGet<ControllerName>Controller()" to the component controller which can be used to call its methods.
    See also this document:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ba2c45-0518-2a10-73be-9b785e10aef1
    Armin

  • Regarding webservice adding to context of component controller

    Hi All,
           I have imported a webservice model and i am creating a data link between
    data model and component controller.why should i link Request Node(i,e Request_CustSessionWSViDocument_CustRetAll) to context of component controller why not response object(Response_CustSessionWSViDocument_CustRetAll).
           I want a clear picture regarding Request Node object and Response Object Node.Actually I want to know what resides in Request Node and in Response Node of a webservice model
    Thanks & Regards,
    saleem

    These classes are simply proxy classes for the web services.
    They reprsent request and response to the web service.
    For each method in web service there will be some parameter and return type. The request represent the paramaters and response represent the return type for the web service (or simply say method exposed as web service)
    Web Dynpro through context allows to you easily map the request,response in form on context nodes. You have to fill the request node.Then execute the web service. The result is stored in response node.
    This is good wiki to learn about AWS Model:
    https://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService
    Regards
    Ashwani Kr Sharma

  • Coupling between component controller and view controller

    Hello,
    I have seen some discussions in this forum regarding the possibilities of calling / triggering a view controllers's method from a component controller's method;  obviously the Web Dynpro framework only provides for the other direction (view ctrl -> comp ctrl) via handle <i>wd_comp_controller</i>.
    Some people proposed raising events in the comp controller and catching these in the view controller, others pointed out that any dependance of a view controller on a component controller would violate MVC principles.
    Now, I can't see why a tighter coupling (in both ways) between controllers within one component would harm MVC in any way. So I suggest to "register" a view controller in the pertaining component controller if necessary:
    this_controller = wd_this->wd_get_api( ).
    wd_comp_controller->register_view_ctrl_XYZ( this_controller ).
    This way the component controller can save the reference and later call any method on it. What do you think, does anything argue against this practice?
    Regards,
    Sebastian

    Hi Sebastian,
    I wouldn't try to explain whether it is violating the MVC principles or not.
    Can you please explain how to call methods of view using the view controller?
    have you tried using an example???
    I want to give a small example which I think is a basic disadvantage of calling View methods from component controller.
    Suppose I have 30 methods in a view and such 7 views in a component (I think this is a very common example).
    Till now one is very clear that if I have a method in view, it will be called at maximum by other methods with in the view. That means at any point of time, my search is limited to 30 methods.
    Now if component controller can also call my search will become horrible and spread to 210 methods, unless otherwise, you are very good at naming attributes and wont make the mistake of assigning attributes wrongly.
    Imagine the effort if the outside components also access these methods through interface.
    Also I dont think that the webdynpro phase model can support this way of calling view methods. You might be successful once, but then you are trying to open a can of worms.
    This is my way of thinking...
    Also, it would be great if you can tell me whether you are successful in calling views methods or not???
    Thanks,
    Anand

  • Reference to Custome Controller from View controller

    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

    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

  • Get controller from view

    Is there an automatic way from within a view to get the controller that is managing that view? Or do I need to setup outlets etc and configure them in the init phase?

    In most cases it would be the File's Owner. NSWindowController has an owner: method, but UIViewController does not. You might be able to get it from NSNib's NSNibOwner constant?
    check out Listing 2-2:
    http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/Cocoa Nibs/chapter3_section_6.html#//apple_ref/doc/uid/10000051i-CH4-DontLinkElementID12

  • Call component controller method from view

    Hi
    I have created an action in view Thus its event handler is "OnActionDoSomething()"
    And, I have a method in component controller "MethodSaySomething()".
    Now, how can I call MethodSaySomething() from OnActionDoSomething().
    OnActionDoSomething()
    // Call  MethodSaySomething() defined in component controller
    Thanks

    Hi,
        To access the methods present in component controller from View , first u need to add the component controller as the required controller.
    open the view controller --> switch to propertues tab --> add the component controller as required controller(click add controller).
    Now in your action handler , write this below code to add the method:
    wdThis.wdGet<COmponent Controller>().MethodSaySomething();
    Hope it helps
    Thanks and Regards,

  • Calling component controller's method

    Hi,
    How can i call component controller's method from a view?
    Thanks.

    Yes, You can call method of component controller from View.
    If you have already mapped any context node/attribute between your view and component controller then it means component controller is already added in your view. If you have not done same then you can add component controller by going into the properties of view.
    To access the method use following code.
    wdThis.wdGet<Your_controllername>Controller().<methodName>();
    Regards,
    Rohit

  • Unable to access Component Controller attributes from Views.

    Hi,
      I am unable to access the attributes in component controller from methods in View even by using WD_COMP_CONTROLLER.
    Say, I want to access the attribute G_FLAG in component controller from a method in the View Controller by the following code :
      WD_COMP_CONTROLLER->G_FLAG = 2.
    Then an error message is showing up saying -  Field G_FLAG is unknown. It is neither in one of the specified tables nor defined by a DATA statement.
    What should I do? Plz suggest..

    Hi,
    Please check the Public check box of the attribute in the component controller.
    Hopefully it will solve your problem.
    Thanks

  • Mapping one node in a view context to many nodes in the component controlle

    Hi guys,
    I need to map an element (attribute) of a node in the View Context to an attribute of multi nodes of the same type:
    Context View:
    customer_no
          |
          | -> KUNNR
    Component Controller Context having two nodes:
      - Node1
         RFC1
            |
            |->KUNNR
      - Node2
          RFC2
             |
             |->KUNNR
    Above I need to map the (KUNNR) in customer_no node to KUNNR in the RFC1 RFC2 before i execute the two RFCs services.
    Note:
    if this is not possible would you mention another solution.
    Thanks,

    Hi,
       As per MVC you cannot map context from view controller to component controller.Mapping can happen from component
    controller to view controller.
    You cannot create mapping for context attributes. You can map nodes if both source node and destination node both has same structure and same number of attributes. If they dont contain same number of attributes the extra attributes from the source node gets copied to the destination node.
    In your case before the RFC execution you can read the value of attribute Kunnr from view and set it the RFC attribute Kunnr before the Function module execution.
    Regards
    Bala Baskaran.S

  • Accessing component controller node

    Hi..Experts,
    How to access component controller node from  WINDOW (please give me a sample code ) .
    I want to set data to component controller node.
    please help me.
    Regards,
    Siva

    Hi siva,
       Its very easy u need not to do any extra coding to share data between window context and component controller context.
    Step 1) u create the node in component controller and map this node with window context.
    step 2) Now in any method of window u write the set_attribute or bind_table statement ,your data will automatically transported to component controller .
    So u dont need to do any extra coding for this.
    Hope this will help your requirement.
    regards
    Pankaj Giri

  • How to pass Model from view to controller in MVC

    Hi All
    The code is written in MVC architecure.
    I am using this script
    <script type="text/javascript">
    $(document).ready(function () {
    $("#btnSubmit").click(function (e) {
    e.preventDefault();
    // var val = Json.Encode(Model);
    $.ajax({
    type: 'POST',
    url: '../Apteka/UpdateParial',
    data: JSON.stringify(@Html.Raw(Json.Encode(Model))),
    contentType: 'application/json; charset=utf-8',
    dataType: "json",
    success: function (data) {
    alert('Success');
    </script>
    My controller is 
    public ActionResult UpdateParial(AptekaReportModel aptekaReportModel)
    aptekaReportModel.YearList = CommonFunctions.GetYear();
    aptekaReportModel.MonthList = CommonFunctions.GetMonth();
    // aptekaReportModel.RepresentativeTypeList = CommonFunctions.GetRepresentativeTypeList();
    aptekaReportModel.IsSearch = true;
    It is passing all everything except selected value in dropdown.
    How to send the selected value of dropdown to controller from view using ajax call
    Prashant Arora

    Hello,
    Since this is an ASP.NET MVC question, I would recommend you to re-post this question to the ASP.NET forum here:
    http://forums.asp.net/1146.aspx/1?MVC.
    Thanks,
    Prashant
    Windows Store Developer Solutions, follow us on Twitter:
    @WSDevSol|| Want more solutions? See our blog

  • Webdynpro - component controller

    Hi Gurus ,
    We designed screen in webdynpro . I created attributes in component controller and i tried to copy that attributes from component controller to view context. But i can't able to drag and drop that attributes.. Is there is any other way to copy that attributes or only option is to create attribute directly in view context

    Hi meena,
    Mapping between the controller is through NODE's. If you want to make you attribute global then you have to define node and create your attribute inside that and go view controller and perform mapping.
    If you define attribute in View Controller then that can be use in same View but you cannot use it in different View controller
    for this we define global attribute and mapped to different view controllers
    As you said you read in the site, it also suggest the same CREATE NODE in CC -> Attribute  -> goto VC and perform Mapping
    Regards
    farooq

  • Calling Component controller method in webdynpro

    Hi All,
    Is it possible to call a method from component controller to view controller?
    Regards,
    Sasikala

    yes it is possible.
    hope this would help you
    http://help.sap.com/saphelp_nw70/helpdata/en/3b/29933f09a5fb47e10000000a114084/content.htm
    Regards,
    nag

  • Problems in component controller

    Hi Experts
    I have a DC named X under ABC Track.I have created another DC named Y under the same track ABC.
    I have copied the component controller from DC X to DC Y.I then renamed the component controller in DC Y and also changed all the dependencies referencing previous controller name to new controller name.I have also added all used DCs and referenced  Bapi structures present in the previous DC.
    After doing so i repaired the classpath file and rebuilt the DC .I have even closed the DC and opened it.
    But i still face errors in component controller like wdThis ,wdcontext cannot be resolved,IPrivate component cannot be resolved.
    Can anyone help me on this

    Dear Chandana,
    If you want to copy component controller from DC x to y. then I think you should copy _Comp folder of DC X.
    then open the DC Y project, remove and paste the _comp folder.
    You can find the _comp folders under C:\document and setting\<users>\.dtc\......
    Best Regards
    Arun Jaiswal

Maybe you are looking for

  • ORA-12519 TNS:No appropriate service handler found!

    Dear All, I am facing a strange problem since yesterday and it happened for 4 times now. My database is 10gR2 and Linux is the operating system. There is not much load on DB but some users while connecting to DB get this error: ORA-12519 TNS : No app

  • Transporting webservices from dev to qa

    I transported our webservices from dev to qa.  I generated all of the nodes necessary in SICF in QA and I activated the web services in qa, but all of the web services still have a WSDL with dev address.  If I try to create the web service in QA, the

  • Some Java 6 quirks (JTable and non-proportional fonts)

    Hi, I just downloaded JDK 6 to check how hard it will be to replace Java 5 on our project. I realized it won't be painless =/ So far, the problems I found were: 1. one of our JTables simply stopped showing its content. It's a two-column table, with p

  • Why all NUMBERs in OO4O are showing up as strings ???

    Hi! Whenever I create a dynaset, all the numeric fields are loaded as Strings ??? For example, I have a field defined as NUMBER(5,0). In my dynaset, the type is set to 4 (LONG) and the OraIDatatype is set to 2 (NUMBER) but the value is a really a str

  • Hardware Improvement with OS X upgrading?

    Hi everyone I have a MacBook Pro (Late 2011) In recent time I have some issues with my Macbook Pro like overheating and trackpad problems. I have OS X Lion (10.7.5) installed. Earlier this month once my trackpad started to acting such weird but event