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

Similar Messages

  • Calling main controller method from component view

    Hi,
    Because i want to re-use certain views, i've created components of em so i can re-use them in several places within the same view. The problem is that i have 1 main component which has several methods calling webservices. I want the other components to be able to call the methods of the maincomponent. I tried adding the main component to the Used Web Dynpro Components of another component. Then i added the main component in the properties of the view but then it says: Cycle in component usage definitions.
    I can understand this because the main view creates instances of all other components, so the sub components cannot create the maincomponent again...but how do i then give a reference of the maincomponents controller to the sub components?
    Much thanks,
    Hugo Hendriks

    Hi Siarhei,
    The problem of creating a Java class is that there i dont have access to certain classes for example when there is something with a webservice, i want to send a message back like
    IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
         msgMgr.reportSuccess(message);
    In a seperate java class, i dont have access to the wdComponentAPI! The only thing i want is kinda like a ServiceLocator to call different webservices. I do check roles of the user logged in the portal and stuff like that....How do you normally implement something like this? I have several views which have to make use of the locator....
    I hope i dont need to create a seperate DC when i want to re-use a screen and want to call a service method of another class or so.........Sounds like much overkill for a screen with 2 inputfields and a button!
    Anoop, i tried adding the mainController to the searchComponent by adding it to Used WebDynpro Components and then I added the mainController in the properties of the searchView so i can make use of it. In the searchcode i now can use the maincontroller but i still get the compiling message: Cycle in component usage definition!
    best regards,
    Hugo

  • 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

  • Windows 8.1 background task Javascript - Call angular controller function from task js

    Hi,
    The Ionic Side menu starter template for windows 8.1 is a very good option to run the ionic apps on Windows  8.1 phones.
    I am not sure whether this is related to Ionic/angular or VS2013 CTP 3.1 but if anyone can give some tips ,that would be great. I registered a background task as per the VS tutorial (Run JS task in background) and i tested it with windows toast notifications.However
    my requirement is to access webservice in background which I am not able to implement.
    The setup for background task is path to the js file but my requirement is to call a function defined within a controller.Is there any way i can access the controller function from an outside js file.I am new to Ionic,Angular and VS 2013.Any help would be great
    The structure of background task js file is as below
    (function() {
       --- I need to call my controller/service  function here---
        var notifications = Windows.UI.Notifications;
        var template = notifications.ToastTemplateType.toastImageAndText01;
        var toastXml = notifications.ToastNotificationManager.getTemplateContent(template);
        var toast = new notifications.ToastNotification(toastXml);
        var toastTextElements = toastXml.getElementsByTagName("text");
        toastTextElements[0].appendChild(toastXml.createTextNode("From Background!"));
        var toastNotifier = notifications.ToastNotificationManager.createToastNotifier();
        toastNotifier.show(toast);
        close();
     

    Are there any updates on this issue? I'm currently seeing this on a Lumia 822 with WP8.1, and the app has never been published to the store. I've only ever deployed the app from Visual Studio to my device. It worked when deploying the Debug build, then I
    tried a Release build, and it crashed immediately upon launch when trying to register the background task, but then I was able to go back to deploying/debugging the Debug build on the device for awhile. I made more changes, and now neither Debug nor Release
    builds work--both fail on the BackgroundTaskBuilder.Register() call with the error described in the original question:
    "The drive cannot locate a specific area or track on the disk. (Exception from HRESULT: 0x80070019)"
    I've tried changing the Task name during registration, rev-ing the version number of the application, adding the call to BackgroundExecutionManager.RemoveAccess() before BackgroundExecutionManager.RequestAccessAsync(), changing the name of the IBackgroundTask
    concrete implementation and changing the corresponding EntryPoint in the package.appxmanifest (as well as in the BackgroundTaskBuilder instance), and changing the package DisplayName to a new reserved name, all to no avail. The only thing I didn't try
    was associating with an entirely new app in the app store or paving my phone, as these are both fairly undesirable "workarounds."
    Even if this won't affect clients downloading the app from the store, this is a major roadblock during development, as we can essentially only use the emulator to test an app specifically designed to help solve problems involving moving around physically
    in the real world.
    Any more information would be greatly appreciated. If there's any information I can provide, please let me know.

  • How to call a private attribute from a funcion module?

    Guys,
    I am trying to call a private attribute but of course it does not recognize the attribute. I am not very familiar with ABAP Objects, so i need some help on this. What is the solution as i need to get values from the fields which are inside the private attribute of the class CL_HRPA_INFOTYPE_CONTAINER. The private attribute name is a_primary_record.
    Any help will be appreciated.
    Thanks
    Nahman

    Hi Sushanth,
    We save the text not as fields in a ztable directly but as a text.Please check the format below since it is based on a working code....
    first you need to create a text in s010 transaction...
    there should be some key based on which you plan to save the text..imagine it is Purchase order then..PO+item numner is always unique.eg:0090010(900PO/item10).so in the code you can append these two and they will be unique..so you can always retrieve them,overwrite,save them anytime you need
    **************data declarations
    TYPES: BEGIN OF TY_EDITOR,
    EDIT(254) TYPE C,
    END OF TY_EDITOR.
    data: int_line type table of tline with header line.
    data: gw_thead like thead.
    data: int_table type standard table of ty_editor.
    ****************fill header..from SO10 t-code..when you save you need the unique key..youfill it here and pass it in save_text function module
    GW_THEAD-TDNAME = loc_nam. " unique key for the text -> our unique key to identify the text
    GW_THEAD-TDID = 'ST'. " Text ID from SO10
    GW_THEAD-TDSPRAS = SY-LANGU. "current language
    GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created in SO10
    *To Read from Container and get data to int_table
    CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
    IMPORTING
    TABLE = int_table
    EXCEPTIONS
    ERROR_DP = 1
    ERROR_CNTL_CALL_METHOD = 2
    ERROR_DP_CREATE = 3
    POTENTIAL_DATA_LOSS = 4
    others = 5.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop data from int_table and save to int_line-tdline appending it.
    *save the text
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    HEADER = GW_THEAD
    TABLES
    LINES = InT_LINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 4
    OTHERS = 5.
    IF SY-SUBRC 0.
    ENDIF.
    *To pass to Container
    CALL METHOD EDITOR ->SET_TEXT
    hope that the above sample with helps you solve the problem
    Please check and revert,
    Reward if helpful
    Regards
    Byju

  • Check specific attributes from common  views

    Is there a was to only checkout certain attributes from a common view?
    For example if I am only interested in checking out the lastLogon , userAccountControl and Description (AD) attributes from the "user" view. How would I do so with out checking out the entire "user" view?
    During a workflow I wish to check out the specific attributes and then make my changes and then check the object back in.
    Please let me know if this is possible.
    Another example)
    Currently if i wanted to unlock all acount from a workflow I would use the following code. But I am really only using the "account locked" attribute so if there were a way to limit the view checkout to the "accountlocked" attribute then I could probably streamline the process.
    <Activity id='3' name='UnlockAD'>
            <Comments>&#xA;          On Success do a global unlock .&#xA;        </Comments>
            <Action id='0' application='com.waveset.session.WorkflowServices'>
              <Argument name='op' value='checkoutView'/>
              <Argument name='type' value='Unlock'/>
              <Argument name='id' value='$(accountId)'/>
              <Argument name='subject' value='admin_user'/>
              <Argument name='authorized' value='true'/>
              <Return from='view' to='uview'/>
            </Action>
            <Action id='1'>
              <expression>
                <block>
                  <set>
                    <ref>uview.global.accountLocked</ref>
                    <s>false</s>
                  </set>
                </block>
              </expression>
            </Action>
            <Action id='2' application='com.waveset.session.WorkflowServices'>
              <Argument name='op' value='checkinView'/>
              <Argument name='subject' value='admin_user'/>
              <Argument name='authorized' value='true'/>
              <Argument name='view' value='$(myview)'/>
            </Action>
            <Transition to='Notify User'/>
          </Activity>

    sec_tk wrote:
    Checking out a user view will always get you the whole view, you cannot get a partial view. What would be possible is coding your own view, but that requires a lot of hacking and I don't think it's worth the effort.Sorry to jump in late but just for clarification of others who happen to stumble on this by a search you most definitely can checkout a view with only partial data returned. It's one of the optimization techniques recommended to speed up workflows.
    See [http://docs.sun.com/app/docs/doc/820-5823/ahyci?l=en&a=view&q=TargetResources] and use the TargetResources argument when checking out a view.So your checkout view action would look like this:
    <Action application='com.waveset.session.WorkflowServices'>
        <Variable name='view'/>
        <Argument name='op' value='checkoutView'/>
        <Argument name='type' value='User'/>
        <Argument name='id' value='$(WF_CASE_OWNER)'/>
        <Argument name='Form' value='Empty Form'/>
        <Argument name='TargetResources'>
            <list>
                <String>Resource 1</String>
                <String>Resource 2</String>
            </list>
        </Argument>
        <Return from='view' to='user'/>
    </Action>

  • Dataflow to one attribute from multiple views doesn't work

    I have an oracle database, of which I use two tables. Each table has its own view in the meta directory.
    The first view contains a table which consists of a uid generated by another system and three other non-important columns. This uid is the only column I need, this should be the naming (rdn) for use with my directory entries.
    The second view contains almost all the other data, such as adresses, (full) names, mail etc.
    I've configured the first view with a join rule, dn mapping rule and attribute flow rule to sync a new entry from my oracle database view 1 to the metaview.
    Point is that at that time I'm missing information such as givenName, sn, cn etc. As those are required by the objectClass, I configured my attribute flow rule to also flow het uid from database into them.
    So that's that. I've got my new entry with the uid I want.
    The second view is configured with an attribute flow rule and a join rule so it matches the entry created by the rules above.
    Here's the thing: any attribute (such as mail facsimiletelephonenumber, etc) configured in my attribute flow rule from view 2 is synched to the metaview entry, except for those attributes that already are flown from view1.
    No matter what attribute I try, for instance givenName, no attribute is never overwritten with a suitable value from my oracle database view 2. It still has the value of uid from my view 1.
    Is there a way to fix this or am I missing some settings here? I've fiddled around a bit with the options in the capabilities and configuration tabs with very little success.

    AFter some experimentation, discovered the following:
    Go to Quiz > Quiz Preferences. Under Settings, there is a
    "Allow user to review quiz" check box. Under Pass or Fail, there is
    an "Infinite attempts" check box. I had both of these unselected.
    Here's what happens when you select or deselect one or both:
    Review + 1 attempt: User starts to answer questions, and then
    backs up. User can go forward again. Answered questions still
    display the answers. Once reaches unanswered questions, they are
    now locked.
    Review + Infinite: User starts to answer questions, and then
    backs up. User can go forward again. All answers to questions
    erased and user can answer all questions.
    No Review + 1 attempt: User starts to answer questions, and
    then backs up. User can't go forward again. (This was the situation
    encountered.)
    No Review + Infinite: Same as Review + Infinite.

  • How to call a window dynamically from a view

    Dear forum experts,
    I am developing an application where i have  4 view controllers and 2 window controllers under one component.Some times on click of a button i have to give a provision to switch to another view from one view, which i did by firing the plug to the corresponding view..
    Now i have a requirement where, on click of a button i have to navigate to the window dynamically which would contain some static views,
    Can some one please suggest me how to go about it.
    Thanks.

    Hi,
      You can raise the window as a pop-up.
    Example.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component  TYPE REF TO if_wd_component.
      DATA lo_window         TYPE REF TO if_wd_window.
      lo_api_component  = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
      lo_window         = lo_window_manager->create_window(
                         window_name            = 'ZWIN2'
                       title                  =
                       close_in_any_case      = abap_true
                         message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                       close_button           = abap_true
                         button_kind            = if_wd_window=>co_buttons_ok
                         message_type           = if_wd_window=>co_msg_type_none
                         default_button         = if_wd_window=>co_button_ok
      lo_window->open( ).
    I am not sure how to navigate to a view in a different window using plugs.
    I raised the view as a pop up in my requirement.
    Cheers,
    Aditya.

  • 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

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

  • 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 ACCESS ATTRIBUTES FROM DIFFERENT VIEW SET

    Hi Experts,
    How i can  access the variables declared in context class from component controller class
    and vice-versa.
    Thanks & Regards
    Ansal

    Hi Ansal
    You can bind your context node of view to component controller context node and then you can access the data.
    You can do this binding by inserting following statements in create_context_node method of your _ctxt class.
    owner->do_context_node_binding( iv_controller_type = cl_bsp_wd_controller=>co_type_component
       iv_target_node_name = 'BUILHEADER'  
       iv_node_2_bind = builheader ).
    Regards,
    Rashmi

  • Capture comp controller event n enhancement view - handler not triggered

    Hi,
    Enhanced a std WDA component through the enhancement framework.  Added a view in the enhancement.  This view will be a popup requesting user supplies more details.
    Ive enhanced a std component controller method to fire off a component controller event.  Ive also created an event handler method in the new view and associated with the component controller event.
    Unfortunately the new view method doesnt trigger.  If I add an event handler method to one of the std views through the enhancement framework it does trigger.
    Grateful for any solution/info, cheers!

    Hey,
    Std view A is the active view when the firing of the event occurs within the component controller.  Enhancement view Z is where the event handler method is defined.Defining an event handler method in active view A will be triggered upon component controller event firing, but not event handler method in view Z.  Handling within event view Z (not active/displayed) beyond the realms of WDA eventing?

  • 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

  • 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

Maybe you are looking for

  • Safari crashes when trying to enter in password field

    Hi Apple Community! My Safari crashes when trying to enter the password to a certain online forum. This is not happening to Google Chrome. I have tried disabling extensions and third-party plugins but it doesn't seem to work. See below for the error

  • How to integrate two controller​s of different vendors to synchronis​e the motion

    We have intended to synchronise the motion of X-Y linear positioning stages with the motion of precision press actuator. These machines supplied by different vendors and came with their stand alone controllers and their platform software controls. Ho

  • Itunes error 3002 when updating

    hi everyone ... im on iphone 4 ( 4.3.3 ) and i cant ride of error 3002 each time i try to update i`ve tried everything in this link :http://support.apple.com/kb/TS3694 i`ve tried another computer , editing host file, DFU mode, recovery mode, restorin

  • Wrong posting PCA

    Hi While sales order there is no A/c entry, after delivery A/c entry effected.  But COGS not posted correct PCA(from Material Master) it was effected to Dummy profit center. as per Client requirement it was post COGS value to correct PCA debit. Reven

  • Missing Codec in iTunes 10.4?

    Greetings, I have several movies that I copied from VHS and converted to Quicktime last winter that played in an older version of iTunes within Snow Leopard. Now that I have upgraded to Lion, they will no longer play in iTunes. I could convert them o