Call a component controller methods from a view

Hi,
I have created a view v1 with context node c1and binded the context node c1 of it with the component controller so that the values entered in the view v1 are available.
now can i know how to access this values from component controller context node which i binded in a other view......
Thanks,
Prem

Hi Sayan,
component : BP_HEAD
View: BP_HEAD/BPHeadOverview
I have called event EH_ONPOPUP_CLOSED when popup is closed in view BP_HEAD/BPHeadOverview and i get all the values entered in the popup here using below code.
       lr_context_node = gr_popup->get_context_node( iv_cnode_name = 'ZPOPUPCN' ).
       lr_col_wrapper = lr_context_node->collection_wrapper.
       lr_entity = lr_col_wrapper->get_current( ).
       IF lr_entity IS BOUND.
         lr_entity->get_properties( IMPORTING es_attributes = ls_data ).
       ENDIF.
now ls_data contains all the data entered in the popup ie. - firstname, lastname, house_no, street, city, postal code, country.....
now it have tried the below code to map/set the entries with the Account management - individual account creation screen.
data : ls_header         TYPE crmst_header_object_buil,        " BuilHeader
          ls_header1        TYPE crmst_address_buil,                 " BuilStandardAddress
       ls_header-firstname     = ls_data-zfirstname.
       ls_header-lastname      = ls_data-zlastname.   
       ls_header1-house_no     = ls_data-zhouseno.  
       ls_header1-street       = ls_data-zstreet.      
       ls_header1-city         = ls_data-zcity.        
       ls_header1-postl_cod1   = ls_data-zpostcode.    
       ls_header1-country      = ls_data-zcountry.   
       ls_header1-telephonetel = ls_data-ztelno.        
       ls_header1-e_mailsmt    = ls_data-zemail.
       entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
       IF entity IS BOUND.
         entity->set_properties( EXPORTING is_attributes = ls_header ).
       ENDIF.
       entity1 ?= me->typed_context-> BuilStandardAddress->collection_wrapper->get_current( ).
       IF entity IS BOUND.
         entity1->set_properties( EXPORTING is_attributes = ls_header1 ).
       ENDIF.
but the problem is both the entity is INITIAL.

Similar Messages

  • How to call Custom or Component Controller methods from View Controller

    Hy Guys,
    how do I call Custom Controller or Component controller methods from a View or Context Controlller?
    thanks in advance
    Jürgen

    Hi Juergen
    Yes it is possible, pls follow the below approach to access the component controller in context node class
    1) since the standard component controller class is protect variable , declare a variable of type component controller in your controller class.
    say for example the public variable you declared is  g_comp_controller
    2)  now redefine the controller class method WD_CREATE_CONTEXT  and add the below lines of code
       g_comp_controller ?= me->comp_controller.
    3) go to context node class  (CNXX)  there declare the varaible which of type controller class (IMPL)  as public variable, for example g_owner
    4) redefine the method  IF_BSP_MODEL~INIT  and write the below code
         CALL METHOD super->if_bsp_model~init
        EXPORTING
          id    = id
          owner = owner.
      g_owner ?= owner.
    5) now the variable   g_owner  that is declared in  (CNXX)   contains reference to your controller class
    6) in  on_new_focus  method access your component controller in the below manner and access the entities also.
    DATA: lv_owner                    TYPE REF TO xxxxx_impl,  " Implementation class
                 lr_comp_cont                TYPE REF TO xxxx_bspwdcomponen_impl, " component controller class
                 lv_entity type ref to cl_crm_bol_entity.
    lv_owner ?= g_owner.
    lr_comp_cont    ?= lv_owner->g_comp_controller.
    IF lr_comp_cont IS BOUND.
       lv_entity ?= lr_comp_cont->typed_context->mdfcampaign->collection_wrapper->get_current( ).
    now lv_entity contains the value of component controller context node.
    Thanks & Regards
    Raj
    Edited by: bmsraj on Sep 27, 2011 3:28 PM

  • How to call a custom controller method from view

    Hi,
    I ve created a simple web service and consumed it in a model. Mapped the input & output parameters to custom controller context which in turn mapped to component controller's context which in turn to view's contexts.
    How to call a custom controller method from view?
    Please explain the syntax.
    Regards,
    Manoj.

    Hi Patralekha,
    Give some idea for the below scenario:
    I ve created a simple web service and consumed it in a model. What I did was
    1) for the input parameters, mapped the node from view->custom controller->model
    2)for the output parameter, mapping from model->custom controller->view.
    It works fine.
    But I don't want to access model nodes directly, rather I want to set the input param in somewhere else (like custom controller) before calling the appropriate method, same for the response also.
    Share me your thoughts.
    Regards,
    Manoj.

  • 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,

  • How to call a custom controller method in a view

    Hi ,
    I am getting the partner no in the custom controller method . I want  to call that method in the view.How is it possible......?

    Hi Masood,
    now i dont want cross compnent navigation ....
    Requirement : Account Identification number in ZVIEW
    My component is  CRMCMP_BPIDENT
    In the custom controller   CRMCMP_BPIDENT/CuCoBuPa  under context node   SEARCHCUSTOMER
    the attribute struct.partner is available 
    in this component  im navigating from  
    CRMCMP_BPIDENT/ObjectCompVs   to   ZCRMCMP_BPIDENT/ZProducts 
    in the layout of   ZCRMCMP_BPIDENT/ZProducts
    TRY .
    lr_cuco ?= controller->get_custom_controller( 'CRMCMP_BPIDENT/CuCoBuPa' ).
    CATCH cx_sy_move_cast_error.
    RETURN.
    ENDTRY.
    check lr_cuco is bound.
    lr_entity ?= lr_cuco->typed_context->SEARCHCUSTOMER->collection_wrapper->get_current( ).
    check lr_entity is bound.
    lv_account_name = lr_entity->get_property_as_string( iv_attr_name = 'BP_NUMBER' ).
    this code is written to get the account identification number but still the same problem
    lr_entity not getting populated .......
    i checked  IF_BSP_WD_HISTORY_STATE_DESCR~IS_RESTORABLE 
    hr rv_result is set to x.....
    any  suggestions....
    Regards,
    Sijo...

  • 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 comp controller attribute from iinside view

    HI all,
    I want to know how to call a component controller attribute from inside a View's method?
    any sampe coding..?
    Regards,
    Shanthi

    Well, you can use the wizard. Just call any method from the component controller. The wizard will create you the code including the line how you will get a reference to the component controller, which is the point here.
    After you have the reference to the component controller, let's say lo_component_controller, you can access its attributes like this:
    lo_component_controller->your_attribute
    Then of course delete the unnecessary lines of code.
    Regards,
    Karri

  • How to call another view controller's method from a view controller?

    Hi,
    Iam new to webdynpro . so pls clarify my doubt.
    How to call another view controller's method from a view controller in the same Web Dynpro Component?
    Thanks,
    Krishna

    Hi,
         The methods in a view are only accessible inside same view. you cannot call it outside the view or
         in any other view although its in same component.
         If you want to have a method in both views, then create the method in component controller and
         from there you can access the method any where in whole component.

  • How to call jpf controller method from javascript

    Can any one help me how to call pageflow controller method from JavaScript.\
    Thanks.

    Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
    1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
    document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
    document.getElementById("batchForm").submit;
    2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
    document.getElementById("ACTION_NAME").value = "UPDATE";
    document.getElementById("batchForm").submit.
    Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
    3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
    This entire lines of code should do what we want.
    <netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>                    
    <netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
    <c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
    <%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
    <netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
    </c:forEach>               
    </netui:select>
    See if you can build along those above lines of code. Any other simpler approches are highly welcome.
    Thanks
    Ravi Jegga

  • How to call Apps Module Custom Method from Entity Object / View Object ?

    Hi All,
    I create a custom method in AppsModuleImpl.java. How can I call that custom method from a setter method on Entity Object / View Object ?
    (I have tried to use Configuration.createRootApplicationModule(amDef,config); but it is not the correct way, is it? )
    Below is my code :
    The setter on MyEntityImpl.java :
    public void setKodeprd(String value) {
    setAttributeInternal(KODEPRD, value);
    if (getProduct() != null) {
    // CALL the getSalesPrice custom method from here, HOW ??
    The Application Module custom method :
    public Number getSalesPrice(String priceCode, String kodePrd) {
    Number price = new Number(0);
    String [] theKey = {priceCode, kodePrd};
    Key priceKey = new Key(theKey) ;
    ViewObject SalesPrice = getSalespricedView1();
    Row[] salesPriceRow = SalesPrice.findByKey(priceKey, 1);
    price = ((SalespricedViewRowImpl)salesPriceRow[0]).getPrice();
    SalesPrice.remove();
    return price;
    Thank you for your help,
    xtanto

    inside the EntityObjectImpl :
    YourAppModuleImpl am = (YourAppModuleImpl)getDBTransaction().getRootApplicationModule().findApplicationModule("YourAppModuleorServiceName");

  • How to access the controller method from javascript onclick event?

    Hi All,
       I am totally new to development. And I got struck in calling a controller method from javascript function.
       I have no idea about ajax and all those things. Please can anyone help me to solve this issue!
    Thanks in advance.

    Hi,
    As I know, you can use jQuery to do this, here is an example.
    Example of your Controller Method.
    [HttpPost] // can be HttpGet
    public ActionResult Test(string id)
    bool isValid = yourcheckmethod(); //.. check
    var obj = new {
    valid = isValid
    return Json(obj);
    and this would be your javascript function.
    function checkValidId(checkId)
    $.ajax({
    url: 'controllerName/Test',
    type: 'POST',
    contentType: 'application/json;',
    data: JSON.stringify({ id: checkId }),
    success: function (valid)
    if(valid) { //show that id is valid }
    else { //show that id is not valid }
    If you have further issues, I would suggest you move to MVC forum, it is appropriate and more experts will assist you.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I call an Application Module method from a EntityImpl class?

    Guys and Gals,
    Using Studio Edition Version 11.1.1.3.0.
    I've got a price update form, that when submitted, takes the part numbers and prices in the form and updates the corresponding Parts' price in the Parts table. Anytime this Parts view object's ReplacementPrice attribute is changed, an application module method needs to be called which updates a whole slew of related view objects. I know you can modify view objects via associations (How do I call an Application Module method from a ViewObjectImpl class? but that's not what I'm trying to do. These AppModuleImpl methods are the hub for all price updates, as many different operations may affect related pricing (base price lists, price buckets, etc) and hence, call the updatePartPricing(key) method.
    For some reason, the below code does not call / run / activate the application module's method. The AppModuleDataControl exists and recordPartHistory(key) is registered and public. At runtime, the am.<method> code is simply ignored, and as a weird side-effect, I cannot navigate out of my current page flow.
      public void setReplacementPrice(Number value)
        setAttributeInternal(REPLACEMENTPRICE, value);
        AppModuleImpl am = (AppModuleImpl)this.getDBTransaction().findApplicationModule("AppModuleDataControl");
        Key key = new Key(new Object[]
            { getPartNumber() });
        am.recordPartHistory(key);  // AppModuleImpl method which records pricing history
        am.updatePartPricing(key); // AppModuleImpl method which updates a whole slew of related pricing tables
      }Any ideas?

    Thanks Timo.
    Turns out the code provided was correct, but the AppModuleImpl method being called was not. A dependent ViewObject wasn't returning the row I was expecting. I then tried to perform some operations on that row, which in turn ... just stopped everything, but didn't give me an error.
    It was the lack of the error that threw me off. I had never messed with calling an AppModuleImpl method from the EntityImpl so I assumed that's what was messing up.
    You are correct. It is available from the ViewRow, but I thought it better to put it in the EntityImpl. This method will be called every time the replacement cost is modified. If I didn't put it in the EntityImpl, I'd have to remember to call it every time a replacement cost changed.

  • Call Java Class and Methods from ABAP

    Hi
    I install de JCo, But how i can call java class and methods from ABAP?. somebody has an example?
    The tutorial say that's is possible,  but don't explain how do that?
    Thanks.
    Angel G. Hurtado

    If you need only simple java program, you do not need to install JCo. The following codes can call java class.
    DATA: COMMAND TYPE STRING VALUE 'C:\j2sdk1.4.2_08\bin\java',
          DIR TYPE STRING VALUE D:\eclipse\workspace',
          PARAMETER TYPE STRING VALUE 'Helloworld'. "here the name of your java program
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
       EXPORTING
         APPLICATION = COMMAND
         PARAMETER = PARAMETER
         DEFAULT_DIRECTORY = DIR
       MAXIMIZED =
         MINIMIZED = 'X'     "If you need the DOS window to be minimized
      EXCEPTIONS
        CNTL_ERROR = 1
        ERROR_NO_GUI = 2
        BAD_PARAMETER = 3
        FILE_NOT_FOUND = 4
        PATH_NOT_FOUND = 5
        FILE_EXTENSION_UNKNOWN = 6
        ERROR_EXECUTE_FAILED = 7
        OTHERS = 8.
    Tell me if it works.
    Nuno.

  • 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

  • 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

Maybe you are looking for