Calling a method in view from component controller?

Hi,
Is it posible to call a method that is defined in the Component Controller in the View?
If it is posible please give some sample code how to call the method?
Regards,
Padmalatha.K

Padmalatha, all the methods defined in a controller from 'Methods' tab are instance methods. An instance method defined in a component controller is callable from any view controller that holds a reference to the component controller.
Defining methods between the tags
//@@begin others
//@@end
is useful if you want to declare static methods.

Similar Messages

  • Call a method in the view from Component Controller

    Hi Friends,
    I have written the code for calling the RFC in Component Controller.
    My requirement is to change the properties of UI elements in the view, if I get any exception while calling RFC.
    Can Call a method in the view from Component Controller.
    Regards,
    Lakshmi Prasad.

    HI,
    You can get the error message during the exception of calling RFC in view itself.
    Any way you may call the RFC at some action in the view only.
    Can you explain me what you are trying to do?
    Kind Regards,
    Mukesh

  • Call JavaScript method in FXML from java controller

    I have fxml like
       <fx:root type="javafx.scene.Group" xmlns:fx="http://javafx.com/fxml">
        <fx:script>
            function applyState(oldState, newState)
        </fx:script>   
        ....and controller to it.
    The idea is to move some view logic to fxml file.
    So, when I need to change some view state, I want to call applyState from java code.
    The question is how to do it.
    What I have found:
    We can get
    fxmlLoader.getNamespace().get("applyState")and receive sun.org.mozilla.javascript.internal.InterpretedFunction.
    NetBeans see this class. But while building the project i have an error
    error: package sun.org.mozilla.javascript.internal does not exist
    But this class really exists in rt.jar in JRE.
    After that I have stopped digging into this.
    I suspect that using internal API is not a good idea to call this InterpretedFunction.
    Can somebody suggest how can I make such an invocation?
    Edited by: 940811 on Nov 19, 2012 11:21 PM

    Until JavaFX doesn't expose the ScriptEngine instance of FXMLLoader, there's no way to communicate (Java <-> Javascript) with the <fx:script>.
    But, if you want to rely on a hack, you can do this:
        private ScriptEngine extractScriptEngine(FXMLLoader loader) {
            try {
                Field fse = loader.getClass().getDeclaredField("scriptEngine");
                fse.setAccessible(true);
                return (ScriptEngine) fse.get(loader);
            } catch (IllegalAccessException | NoSuchFieldException | SecurityException ex) {
                Logger.getLogger(BrowserFXController.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

  • Call a view's method from Component Controller.

    Hi
    Is it possible to call a view's method from Component Controller.
    Regards
    Nikhil

    Hi Tummuru,
    I have created an event in Component Controller by the name toMenuView. Now I created a method in which this event is getting fired. Foll. is the code of the method.
      public void fireToMenuView( )
       wdComponentAPI.getMessageManager().reportSuccess("fireToMenuView");
       wdThis.wdFireEventToMenuView();
    Now I have created an event handler "handleToMenuView" in the MenuView and subscribed the event handler to the event in Component Controller.
    The control is reaching to the fire event in component controller but not to the Event handler in view controller.
    What am I missing.
    Regards
    Nikhil

  • Calling view controller method from component controller method

    Hi,
    Is there any way to call view controller method from component controller method?
    Thanks,

    Hi Khandal.
    You should not make you component controller dependent from a view controller.
    But what you can do is to define an event in the component controller. The view
    controller can register for this event.
    In the stage where you currently want to call the view controller method just fire
    the event. In the event handler method in the view controller you can call the
    method then.
    Why do you need to call a view controller method? Can you give more details
    about the scenario?
    Cheers,
    Sascha

  • Calling view method from component controller

    Hi Experts,
    How to refer a view method from component controller?

    if you have the view Instance, then you can call using the view instance. But this is not the correct apporach.

  • Mapping from component controller context and view context

    Hi to all experts.
    im trying to create my first webdynpro . Im stuck up here please help me .... How to map the node from component controller context and view context i have searched the forum....got the answers as Drag and Drop...But it is not working ....

    Hi
    Check out this links and check saptechnical site
    WDA in SAP Help
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7c/3545415ea6f523e10000000a155106/frameset.htm
    Web Dynpro for ABAP in SDN
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/512040e1-0901-0010-769c-c238c6ca35d9 [original link is broken]
    Developing ABAP Applications Using Web Dynpro
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/d41b25d2216babe10000000a1553f6/frameset.htm
    Web Dynpro ABAP: Development in Detail
    http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/frameset.htm
    WDA Sample programs & tutorials
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d
    Web Dynpro ABAP Demonstration Videos
    /people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
    Web Dynpro ABAP Wiki's
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/wdabap/main&
    New to Webdynpro
    Thanks,
    Tulasi Palnati

  • Calling a method in another webdynpro component

    Hi,
    I have two webdynpro components say Comp A and Comp B.
    In Comp A I had a view View A and in Comp B I had a View in View B.
    In View A, I had a method X, I want to call this method in View B of Comp B.
    How I can do this?
    I created a public part of Comp A and tried to add in used webdynpro components. But in the list I am not able to find it.
    Please help.
    Regards
    MQ

    Hi,
    If both the components Comp A and Comp B are in the same DC you can use the interface controller to call the method in comp A. Add this comp A interface controller in Comp B controller by going to the properties tab, so that you can access the methods of comp A interface controller.
    If you have the components in different DC's you can follow the below steps:
    Go to public parts in DC meta data section and create a public part by selecting the first radio button option and add the Comp A by selecting the option (Webdynpro Component-->Selected Entities).
    Click on Finish button so that public part for comp A is created.
    Now build the DC and go to Used Webdynpro components of CompB, give some name and browse to select the used webdynpro component, it will show you the Comp A public part select it and try to finish it.
    Once again build the Dc after doing this.
    Now  you can access the method of comp A in Comp B
    wdThis.wdGetCompA.getX()...
    Hope this helps you..
    Regards,
    Saleem

  • Web Dynpro - How to set and get info from Component Controller

    Hi Gurus!!!
    Im having some problems getting and setting info in component controller of my Web Dynpro.
    I can't see the difference between View Context and Global Context.
    How can i create a Global Context Between two views?
    Thanks!
    Regards.
    Polakinho.-

    hii
    difference between view context and global context is we can use the same component controller for all the views in the same application.but when when we create node in view context then it will be available for that view only not for any other view...so if we want to use the same node for all the views we need to create that view in the component controller.so it will become global for that application.
    for using global node you need to map that context in view controller.for that you need to go to that view then click on context tab and drag and drop node from component controller.so it will be available for that view.i hope it helps you.
    regards
    twinkal

  • View raises Component Controller Event

    Hello,
    I defined an even onUpdate in the component controller. A custom controller subscribed to this event. For that I have a method handleOnUpdate in the custom controller. Now I want to raise this event in a view after pressing a submit button of this view.
    How can I raise the event?
    So data flow would be:
    1. Button pressed in view
    2. Raise event in component controller
    3. Handle raised event in custom controller
    Regards
    Rene

    Hi Rene,
    Your scenario is like:
    <b>View: OnSubmit -> Component Controller: OnUpdate -> Custom Controller:</b> <b>handleOnUpdate.</b>
    For this, in the code for <u>OnSubmit</u> in your view, you need to add code as
    wdThis.wdGet<ComponentControllerName>().onUpdate();
    and in the <u>OnUpdate</u> method in Component Controller:
    wdThis.wdGet<CustomContControllerName>().handleOnUpdate();
    Also, you need to <b>add the Component Controller to your View</b>, using Properties Tab
    <b>and Custom Controller in Component Controller</b>, using its properties tab.
    Hope it helps.
    Regards,
    Alka.

  • Getting error while creating Service controller from component controller

    Hi,
    I have added CAF model in used model for DC project.But when i m trying to create service controller from component controller by selecting used model it is giving error like "Context element cannot be bound to model layer".
    Can anybody help me out on this issue.
    Thanks in advance.

    Hello,
    try to check the check box in MS Word - File - Options - General - "Open e-mail attachements and other uneditable files in reading view"
    I am not sure how this option really works, but I think you will find it checked. So try to uncheck it.
    Or wise versa :c)
    Kind regards

  • Calling a PL/SQL Package from a controller

    Hi ,
    I have to add some busines funtionality to the standard existing oco page .
    i have extened the standard controller and add the validation logic there , now if the validation is true i have to call a pl/sql package to do some functions . now i am facing few issues here
    a) can i call a pl/sql package from a controller ?
    b) should i extend the standard AM and call the pl/sql package from the extended am . is extending am allowed ?
    please let me know the best sol to achieve this

    a) can i call a pl/sql package from a controller ?<b>Yes</b> you can call a pl/sql procedure from controller through <b>OracleCallableStatement</b> object.
    <br>
    b) should i extend the standard AM and call the pl/sql package from the extended am . is extending am allowed ?Extending AM is <b>allowed</b>, but as can achieve your goal through the CO extension, why bother to touch AM :)
    --saroj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • WD ABAP: call dialog window from component controller method

    Hi all,
    I need to call a dialog box from a method in the component controller. It would be helpful if u could post the code too.
    Thanks,
    Sravanthi

    Hi Maksim,
    this is the code i wrote:
    DATA: api_component  TYPE REF TO if_wd_component,
          window_manager TYPE REF TO if_wd_window_manager.
    api_component = wd_this->wd_get_api( ).
    window_manager = api_component->get_window_manager( ).
    wd_this->window = window_manager->create_window(
               window_name = 'OPTIONWD'
               close_button = abap_false ).
    wd_this->window->open( ).
    When i test it, this is the error i get.
    "An Instance of the View OPTIONWD Already Exists in the Component"
    how do i correct it?
    Thanks,
    Sravanthi

  • Call method of interface controller from component controller

    hi,
    I have created one method in the interface controller of a component. Now i have this method along with attributes to the component controller. Now from the component controller i want to call the method of the interface controller. How do i do it???

    Hi,
    You dont need to call the method from the interface controller when you are in the same component.
    You can call the method which is in the component controller.
    Interface controller is used to expose some methods to a different component.
    Ex Comp a want to expose a method which will be used by comp b then  you need the interface controller in comp a.
    Comp b will use comp a as used component
    then it will invoke the methods.
    Regards
    Ayyapparaj

  • Read a View Context's node's element and assign from Component controller

    Hello Experts,
    I'm new to JAVA WD.
    Here is my scenario.
    I have to use an Adobe form in a WDJ. The input parameters and the output parameters of the DC are defined in a method in the Interface Controller method.
    The context of the Component Controller has the following structure
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    Then the mapping between the Component controller and the interface controller is done so that the Interface controller also has the context structure as
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    So now the interface controller and the component controller are bounded correctly.
    Now I bind the view also with the Component controller as below.
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    But since i need to use an Adobe interactive form inside this view, the datasource for the form cannot be the root context node but some other node. So I replicated the same structure in the view context so as to make the fields visible in the Adobe form context. Now the context looks as below.
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    ---DATA_NODE
    -----StartDate
    -----EndDate
    -----AbsenceType
    Now my question is, how do i map the result from the Adobe form into the context of the view??
    What code should i write and where should i write to achieve this?
    I need to do the following. But dont know how to write the code for this.
    Context.StartDate = Context.DATA_NODE.StartDate
    Context.EndDate = Context.DATA_NODE.StartDate
    Context.AbsenceType= Context.DATA_NODE.AbsenceType
    Please help!
    Any help will be greatly appreciated.
    Thanks,
    Sam

    Hello Nikhil,
    I'm stuck with another small issue.
    Let me first explain what I'm trying to do.
    I have a view with the context structure as follows
    Context
    ---DATA_NODE (Node)
    ----Data1
    ----Data2
    ---Data1
    ---Data2
    All i need to do is, at the start of the view, i need to move the data from
    Context.Data1=>Context.DATA_NODE.Data1 and
    Context.Data2=>Context.DATA_NODE.Data2
    Also, at the View Submit button click, I need to move the data from
    Context.DATA_NODE.Data1 => Context.Data1 and
    Context.DATA_NODE.Data2 => Context.Data2
    (I managed to do this submit button click by calling an action->method and wrote the code as you gave earlier)
    wdContext.currentContextElement().setData1(wdContext.currentData_NodeElement().getData1());
    wdContext.currentContextElement().setData2(wdContext.currentData_NodeElement().getData2());
    But I wrote at wdInit() for the view the code in the reverse way, but the values are not getting passed to the Data_Node and hence its not defaulting with the values from the elements of the context.
    This is what I wrote.
    wdContext.currentData_NodeElement().setData1(wdContext.currentContextElement().getData1());
    wdContext.currentData_NodeElement().setData2(wdContext.currentContextElement().getData2());
    Please let me know if I'm doing something wrong here.
    Appreciate your help in advance!
    Cheers,
    Sam

Maybe you are looking for

  • How to display custom error message if the Required field is not entered?

    Hi, I have made one input field as required field in a view. I want to display one custom error message ,if the required input field is not entered. Please help me regarding this. Thanks, Deepika

  • 2nd Gen Nano won't connect to PC and has converted the language to Chinese

    My 2nd generation ipod nano will no longer sync with my itunes on my PC. And yesterday when I downloaded the itunes update and tried again it has converted the default language display to Chinese! Any ideas and help would be much appreciated! cheers

  • Labview driver for Analog Device cards RTI 800 series

    Hello, I'm Mathieu Meisser, from EPFL Lausanne - microtechnique. I'm working for a company, that produces laboratory PC-controlled analysers, sold all over the world. we are searching for the Labview drivers for the I/O analog Device cards RTI 815/81

  • How to connect to sql developer

    i have oracle 11g enterprise edition on my laptop i installed sql developer on my laptop how to connect sql developer to databace(oracle 11g enterprise edition) in my laptop

  • Making Changes in Finder

    Everytime I make a change to a file in finder, be it a file name or move location, I have to imput an adminstative password. I am the administator of  this computer, and am logged in as such. This is very annoying. Is anyone else experiencing this is