Instance of IMPL class in custom controller

Hi,
I have a requirement where i need a instance of view controller class(impl) in custom controller class. When i am trying to create an instance attribute of impl class in cuco and trying to use in one of the cuco methods  then it is not getting initialized. Let me know how to do achieve this.
Thanks a lot.
Regards,
Lisha

Hi Lisha,
This would be because the corresponding view is in viewset which in turn is in the window.
In that case you will have to drill down the viewset and then get the view.
Sample code :
DATA:
    lr_window TYPE REF TO cl_bsp_wd_window,
    lr_viewset      TYPE REF TO cl_bsp_wd_view_controller,
    lr_bpexcp_view         TYPE REF TO CL_BP_EXCEP_BPEXCPTNRESUL_IMPL.
lr_window ?= me->get_subcontroller_by_viewname( 'BPExceptionSearch.MainWindow' ).
  if  lr_window IS BOUND.
    lr_viewset ?= lr_window->get_subcontroller_by_viewname( 'BP_EXCEPTION/BPExcptnSearchViewSet' ).
    if lr_viewset IS BOUND.
      lr_bpexcp_view  ?= lr_viewset->get_subcontroller_by_viewname( 'BP_EXCEPTION/BPExcptnResult' ).
      if lr_bpexcp_view  IS BOUND.
        TRY.
            lr_bpexcp_view->GV_IS_NEW_CONTRACT = ABAP_TRUE. "#EC NOTEXT
          CATCH cx_sy_dyn_call_error.
            RETURN.
        ENDTRY.
      endif.
    endif.
  endif.
Regards
Leon
Edited by: Leon Limson on Jan 10, 2012 4:54 PM

Similar Messages

  • Cannot locate custom controller class after applying OIE.K  patch.

    Hi,
    I am trying to search all the region level personalizations(on Update Allocations Page in iExpenses while creating Expense Reports) to find out where our custom controller class is being called(it was personalized at site level). But no luck until now.
    Nevertheless, we were able to locate our custom controller class in an instance where the OIE.K oracle patch was not applied. Seems like after applying this patch, the seeded region names are changed too. Our custom code also works but cannot figure out where our CO is being called.
    Any suggestions please?
    Thanks,
    Swati.

    Guys,
    Using "About the Page" link on UpdateExpenseAllocationsPG, I found SplitCriteriaTblCO controller class instead of UpdateKffCO class, that was extended to HumUpdateKffCO custom class.
    Our custom code is still intact even though we do not find our custom CO. Probably we have to look elsewhere to find it, no idea!.
    I just need to know how to remove our iExpense extension. In order to remove the iExpense extensions in the instance where the OIE.K was not applied, we just removed the personalization at site level, where the controller HumUpdateKffCO was called and that took care of it.
    --Swati.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Custom controller v Assistance Class

    Hi
    I have always used the assistance class to place all business logic.  I understand that this replaces the custom controller that is generally used for theis purpose in WDJ. Therefore, is the custom controller used much in WDA or is it largely redundant?
    Cheers
    Ian

    >
    Abhimanyu Lagishetti wrote:
    > Hi Ian,
    >
    >  It is not largely redundant as such, i can see two main reasons
    >
    >  1.  Configuration Controller, entire FPM is based on this. you can control the configuration of the WDA using custom controller
    >
    >  2. Business Logic, which belong to only current WDA can be put in Custom Controller so that it is more readable, where as in Assistance class we can use it in other applications when working in a team
    >
    > in both the cases you are following MVC
    >
    > Abhi
    1.  You are correct that configuration controllers are a useful feature of custom controllers; however FPM is not really based on this.  Custom Controllers/Configuration Controllers in your components are not a requirement of FPM.  In FPM your component implements a special Web Dynpro Component Interface.  The configuration of the FPM is done using component configuration of a standard SAP component.  Once again you can use Configuration Controllers in your FPM components like you would in any other component; but it is in no way a requirement to do so in order to use FPM.
    2.  Technically it is possible to place business logic in the custom controller, but my personal suggestion would be to not do so.  The context and context bindings carry a performance penalty and should only be used data that is needed by the layouts.  You end up creating custom controllers with logic that is locked into the component and only uses the attributes/methods.  What you end up with is a less useful class.  That is why I feel that using a normal ABAP class (possibly an Assistance Class) is the perfered way to go.
    I would add a third use: the service call wizards.  If you are going to use the wizards to generate calls to RFCs or other classes, it is often advisable to place this generated code into a custom controller (one of the wizard options). This is particularly useful if you are going to have more than one wizard call generated.  I guess you could make a case that this is the "business logic" that was being refered to in Item 2 above.  However I want would make the distinction that this is only the call to the business logic.

  • How to call a method in IMPL class from one context node

    Hi, I´ve been only study the posibility to access a method in the IMPL class  from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.

    Hi,
    Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
    To get the custom controller instance in Context node getter/setter method:
    1. Declare Cuco instance reference variable in ctxt class..
    2. Set this cuco ref. in the Create context node method of ctxt class:
    try.
    gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
    catch cx_root.
    endtry.
    you can avoid this step as this is not needed in case of view isntance
    3. Assign this instance to the respective context node Create method using:
    BTStatusH->gr_cuco ?= gr_cucoadminh.  " here assign the view implementation ref. " me" instead of gr_cucoadminh
    Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
    Sample implementation of this can be found in
    ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
    Cheers,
    Sumit Mittal

  • Overriding VO Impl class methods to populate parent-child VO

    Hi All,
    I need to populate parent child VOs by giving webservice calls from respective impl classes.
    Scenario : Lets say suppose i have 2 VOs as DepartmentVO and Employee VO with a viewLink on departmentId. Taking a particular instance, in Department table there are 2 rows and for each parent row we have 2 child rows in Employee.
    Webservice Structure : I have a parent Object and inside that parent object i have list of child objects
    e.g : public class DepartmentDTO{
    private List<EmployeeDTO> employeeList;
    After that i have extended Impl classes for both VOs and overriden method i.e. "executeQueryForCollection" to give a webservice call and get back response of DepartmentDTO[] with List<EmployeeDTO> inside it.
    In DepartmenntVOImpl class i have overriden "createRowFromResultSet" which populates the parent VO with the number of parent records returned from webservice.
    Code for Department impl class is :
    protected ViewRowImpl createRowFromResultSet(Object qc,
    ResultSet resultSet) {
    Iterator deptIter= getPackageClassIterator(qc);
    ViewRowImpl r = createNewRowForCollection(qc);
    DepartmentDTO curDTO = (DepartmentDTO )deptIter.next();
    populateAttributeForRow(r,
    findAttributeDef("DeptId").getIndex(),
    curDTO.geDeptId() );
    populateAttributeForRow(r,
    findAttributeDef("DeptName").getIndex(),
    curDTO.getDeptName() );
    return r;
    Similarly i have overridden "createRowFromResultSet" method in EmployeeVOImpl to populate the child VO(this need to be populated from the list object inside parent object reponse)
    Code as follows :
    protected ViewRowImpl createRowFromResultSet(Object qc,
    ResultSet resultSet) {
    Iterator empItr= getPackageClassIterator(qc);
    ViewRowImpl r = createNewRowForCollection(qc);
    DepartmentDTO curDTO1 = (DepartmentDTO )empItr.next();
    List<EmployeeDTO> list = curDTO1.getEmployeesList();
    for (EmployeeDTO curDTO : list) {
    populateAttributeForRow(r,
    findAttributeDef("EmpId").getIndex(),
    curDTO.getEmpId());
    populateAttributeForRow(r,
    findAttributeDef("EmpName").getIndex(),
    curDTO.getEmpName() );
    populateAttributeForRow(r,
    findAttributeDef("EmpLastName").getIndex(),
    curDTO.getEmpLastName() );
    populateAttributeForRow(r,
    findAttributeDef("DeptId").getIndex(),
    curDTO.getDeptId());
    return r;
    Though the code looks simple and correct but the child records are not getting populated correctly. Am not sure if the code implementation to populate parent child VOs from webservcie is correct or not.
    Would appreciate for Help or valuable Suggestions.
    -Sanjeeb

    Hi Ray,
    Go for custom BADIs in this case. In fact, that is exactly the functionality you are looking for !
    Just go through this excellent five part blog on Enhancement framework by Thomas Weiss.
    What the New Enhancement Framework Is For – Its Basic Structure and Elements For Beginners
    The new Enhancement Framework Part 2 - What Else You Need to Know Before Building an Enhancement
    How To Define a New BAdI Within the Enhancement Framework - Part 3 of the Series
    How to implement a BAdI And How to Use a Filter - Part 4 of the Series on the New Enhancement Framework
    Source Code Enhancements - Part 5 of the Series on the New Enhancement Framework
    Cheers,
    Mahesh

  • Custom Controller in IC Web Client

    I am trying to using the Custom Controller to pass a model between classes. I am not using the BOL context node. I made my own models. Does anyone know what do I need to do or have any example that I can follow? thanks.

    hi,
    For help
    http://help.sap.com/saphelp_crm40sr1/helpdata/en/9d/1ca7f91b76ad4493d62b8ecc7c83db/frameset.htm
    If you are calling controller2 from controller1 then
    subcontroller ?= create_controller(
                              controller_name = 'address.do'
                              controller_id = 'ad'
    set some attributes with standard method
      subcontroller->set_attributes( name = 'model'
                                     value = lv_model ).
    model is the name of the attribute.
    lv_model is the instance of the model.
    The above sets the model to the controller2. You can just get the model in controller2 by me->get('model').
    Regards,
    Abdul raheem S

  • Difference between custom controller and component controller

    Hi All,
    I am a beginner in CRM SAP .
    Please can anyone tell me whats the difference between custom controller and component controller with some scenario.
    I am totally baffled.
    Thanks in advance.
    Regards
    Shilpi

    Hi Shilpi,
    The main difference between custom and component controller is the role which they play during data transfer.
    a) Custom controller is used for data transfer across two views within a component. For that you need to bind view context nodes to custom controller either through wizard or manually by adding the code in CTXT class create_contextnode method:
    initial setting for depandant model node
        coll_wrapper =
          BTADMINH->get_collection_wrapper( ).
        TRY.
            entity ?= coll_wrapper->get_current( ).
          CATCH cx_sy_move_cast_error.
        ENDTRY.
        IF entity IS BOUND.
          BTOpportH->on_new_focus(
                       focus_bo = entity ).
        ENDIF.
    b)Component controller is used for data transfer across two views in two different components. For this, we need to define the component usage first and then bind the context nodes in the method-WD_USAGE_INITIALIZE of the Component Controller impl class.
        WHEN 'ComponentUsageName'.
          iv_usage->bind_context_node(
                      iv_controller_type  = cl_bsp_wd_controller=>co_type_custom
                      iv_target_node_name = 'ContextNodeName'  "#EC NOTEXT
                      iv_node_2_bind      = 'ContextNodeName' ).  "#EC NOTEXT
    Hope this clears some of your doubts!
    Thanks and Regards,
    Rohit
    P.S-This is valid for CRM 2007.Raghu is also right because Interaction Center is made up of different different components combined together.You have put your question in wrong forum.

  • Accessing impl class attribute

    Hi Experts,
    if i declare one variable in controller class of a view and how can access the variable in contex naode .

    Hi srinivas.yangal,
    You can access the View implementation Class Attributes in Context.
    1] Go to Context Node Implementation Class
    2] Create a attribute GV_VIEW_CONTROLLER in Impl class of Context Node.
    DATA : GV_VIEW_CONTROLLER TYPE REF TO CL_BSP_WD_VIEW_CONTROLLER .
    3] Go to INIT method of Context Node.
    4] Assign instance LV_VIEW_CONTROLLER to GV_VIEW_CONTROLLER of Context Node Impl. Class.
    GV_VIEW_CONTROLLER = LV_VIEW_CONTROLLER.
    Then you can access your Instance attributes defined in View Impl. class inside the context node through GV_VIEW_CONTROLLER attribute as follows.
    ABC = GV_VIEW_CONTROLLER->XYZ.
    Reward points if useful.
    Kind Regards,
    Dhananjay.
    Edited by: Dhananjay SAP CRM on Nov 24, 2011 12:56 PM

  • Issue in Binding Custom controller to Component Controller

    Dear All,
    I have enhanced a standard component ERP_H.
    I created a custom controller with context nodes BTSTATUS, BTSTATUSH
    I enhanced the component controller with context node BTSTATUS, BTSTATUSH
    Now when i try to bind the custom controller to component controller using this code in the context class of my custom controller
    bind to component controller
      owner->do_context_node_binding(
               iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_COMPONENT
               iv_target_node_name = 'BTSTATUS'  " component controller context node
               iv_node_2_bind = BTStatus ).
    its not working since this context node in component controller is not the standard one but the custom added one.
    Am i missing something, or is there any way to bind customer context node in custom controller to customer context node in component controller.
    regards,
    pradeep

    Hi pradeep,
        Try the other way round go to the context class in the component controller and paste the following code in the
    create_contextnode( context node = name of the node to be linked).
    *owner->do_context_node_binding(
            iv_controller_type = cl_bsp_wd_controller=>co_type_custom   <-----linking from component to custom
            iv_target_node_name = 'BUILHEADER' "target node: component controller node
            iv_node_2_bind = BUILHEADER ). "source node: current node.
    See if this works.
    Thanks

  • Do I need to use a custom controller & view set

    Good Day,
    Please excuse the long question.
    I am in the process of creating a new BSP application.  In a nut shell, my application is going to accept a bunch of data in the URL and pass the data to an external system.  Depending on what is returned from the external system, it will prompt the user to either supplement the data or to confirm what the external system has sent back. 
    I would like to have all of the business logic that communicates with the external system and decides what type of user interaction to be located in one central class.  I was thinking that I could have a custom controller that is resident for the life of the application.  It would call the external system and navigate to other views depending on what is required.  When the user responds, the response would go to the custom controller and be sent to the external system.  So, my first question is does this sound reasonable?  For my second question, is it possible to have a view associated with the custom controller.  If so, I can use it for the confirmation "screen".
    While looking at the Web IC cookbook, I ran accross the section on view sets.  Are there pros and cons to using a vew set for an application like this?  I expect the browser window to contain one view at a time and it kind of seems like view sets may intended more for where there are several views displayed within the browser and the view set allows you to change only one.  Is that true?
    Thank you very much for any insight you can offer.  I promise to award points for helpful responses.
    Thanks and kind regards,
    John

    Hi John,
    My suggestions would be to use a model class for the business logic and call to the external system.  The controller would only be for eventing and determining what view to call.  I would create a parameter called view_name on the controller and toogle this between your views depending on what returns from your model methods.  As a personal preference I would pass the 'bunch of data' in the form rather than the URL.  Validate it in a model method before sending it to the external system.  I tend to use URL querystrings for small stuff rather than large application data.  Also what would happen to the application if someone saves your URL as a favorite and launchs the app.
    Those are my thoughts hope it was helpful.
    Regards
    Matt

  • Custom controller iue in OOPS ALV

    Hi All,
    I have created a ALV report by OOPS. I have used custom controller. In my sytem the outpout creen are id different and in other system the output screen area is different. How to avoid this issue? I want the report output should be system independent and it should take complete screen area?
    Please help..
    Regards,
    Jeetu

    Hi Jeetu,
    You should not drag-drop & create a container in screen layout.
    Instead you need to declare docking container using class cl_gui_docking_container.
    Sample code below:
      CONSTANTS: lc_height TYPE i VALUE 1200.
      IF sy-batch IS INITIAL.
        CREATE OBJECT go_container
          EXPORTING
            repid                       = sy-repid
            dynnr                       = sy-dynnr
            side                        = 2             " Top
            extension                   = lc_height
            metric                      = 1             " Pixel
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
      ENDIF.
    Regards,
    Nisha Vengal.

  • Accessing Custom Controller from setter and Getter methods

    Hi Gurus
    How can we access the custom controller from setter and getter methods,is there any way to do that.
    Thanks & Regards
    Rajasekhar

    Hi Steve.
    Thanks very much for valuable information,  the main controller class is getting tracked in mo_owner which is declared as  CL_BSP_WD_VIEW_CONTROLLER, and I'm getting the reference through
    mo_owner ?= owner. (since mo_owner = owner is not getting converted of type mo_owner ). After doing this on whatever the contexnode class (say zl_xxxx_xxx_cnxx) the corressponding context node values are getting turned as  <#ERROR IN METADATA.
    I mean when I'm checking the configuration in bsp_wd_cmpwb configuration tab -> Available Fields->Enlarge the contex node->BTSTATUS (say for Example) there the values are showing as <#ERROR IN METADATA , After executing the above procedure
    I cross checked several times before and after redefining the context node method IF_BSP_MODEL~INIT, before redefining this method UI is working fine, after redefintion UI is throwing below error .
    Exception Details
    CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference
    Method: CL_BSP_MODEL=>IF_BSP_MODEL_BINDING~IS_ATTRIBUTE_VALID
    Source Text Row: 13
    Thanks & Regards
    Rajasekhar

  • Custom controller - WEBDYNPRO

    My friends what is the use of custom controller at what situation we should use that.
    And if we declare custom controller will it be considered globally
    Edited by: VENKATESH MADANAGOPAL on Sep 30, 2008 7:33 AM

    Hi Venkatesh,
    Try going through the SAP documentation you will come across the desired information. The below lines are taken from 1 such source.
    Regards,
    Uday
    Custom controllers are optional controllers that must be defined by the developer. These controllers can be used to modularize the component content. For example, custom controllers can act as local controllers for some views, or they can be used to encapsulate the logic related to a certain model class (business logic).
    This allows you to reduce the content of the component controller by populating sub-functions.
    Custom controllers are optional. They have to be defined at design time and can be used to encapsulate sub-functions of the component controller. Multiple custom controllers can be defined in a component. Custom controllers are instantiated automatically by the Web Dynpro framework and the instantiation order is undefined; therefore, the coding in a custom controller should

  • Passing field values from View Controller to Custom Controller

    Hi Experts,
    I am working on a customer requirment in which customer want to see the values of field from one view in another view. The Context node & Context node attribute are the same in both the views.
    I am aware that we need to pass the field values from view controller to custom controller in order to see the field in the subsequent view. I would like to kow how i can achieve that technically?
    Kindly let me your valueable suggesions.
    Best Regards,
    Prabahar

    Hi Carsten,
    Thank you for the detailed feedback.
    I want the fields ID_TYPE & ID_TYPE_DESCRIPTION from IUICMD/SearchAccount to be available in IUICMD/DetailAccount. I have created a context node u201CSEARCHu201D in view IUICMD/DetailAccount. I have created the context node with out choosing u201CCreate with Instanceu201D.  This Context node (SEARCH) is already available in IUICMD/SearchAccount as part of the standard.
    Below given is contents of the Method CREATE_SEARCH of my context class ZL_IUICMD_DETAILACCOUNT_CTXT of view IUICMD/DetailAccount, which is created by the Wizard during enhancement.
    method CREATE_SEARCH.
        DATA:
          model        TYPE REF TO if_bsp_model,
          coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
          entity       TYPE REF TO cl_crm_bol_entity,    "#EC *
          entity_col   TYPE REF TO if_bol_entity_col.    "#EC *
        model = owner->create_model(
            class_name     = 'ZL_IUICMD_DETAILACCOUNT_CN00'
            model_id       = 'SEARCH' ). "#EC NOTEXT
        SEARCH ?= model.
        CLEAR model.
    bind to custom controller
      owner->do_context_node_binding(
               iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM
               iv_name = 'IUICMD/CuCoMD' "#EC NOTEXT
               iv_target_node_name = 'BUILHEADERSEARCH'
               iv_node_2_bind = SEARCH ).
    endmethod.
    I have enhanced the Custom Controller. Now it have new implementation class u201CZL_IUICMD_CUCOMD_IMPLu201D
    Let me know where I am doing mistake
    Thanks in advance
    Best Regards,
    Prabahar
    Edited by: Prabahar Raju on Sep 2, 2009 10:47 AM
    Edited by: Prabahar Raju on Sep 2, 2009 10:52 AM

  • Do you have to Discovery ALL the Properties defined on a Class before an instance of said class will be created

    Hello
    I am learning how to create management packs with VSAE and have a question please.
    When defining a Class based on LocalApplication (which I believe already has a hosting relationship with Windows Computer and therefore no need to create a hosting relationship?)
    let say I define two properties one called Version and the other Vendor both based on registry values, so I include the discovery of these regsitry values in my discovery (along with the regsitry key exists to check the actual app is installed).
    Now if I have a Server with only two of the above three registry items created e.g. the actual Key and Version string value but not vendor string value. Will an instance of the Class be discovered and thereby viewable in the 'discovered inventory' view?
    Or do ALL properties have to be present (as defined on the class definition) for an instance of said class to be created?
    Thank you
    AAnotherUser__
    AAnotherUser__

    Hello Vladimir thanks for taking the time to reply
    So if I have three properties definded on my custom class, none of which are key properties and I only discover two of them (as the registry key or what ever is missing for the last property) the class should still be discovered as there are no key properties
    for the custom class and therefore no key properties missing from the discovery, is that correct please?
    Also I understand I have to Discover any key properties of the classes parent/s
    for example
     <InstanceSettings>
        <Settings>
          <Setting>
            <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
            <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
          </Setting>
         <Setting>
            <Name>$MPElement[Name="System!System.Entity"]/DisplayName$</Name>
            <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</Value>
          </Setting>
        </Settings>
    I have done this, but my Class is not being discovered.
    Then I saw a post which had the following, under the Class Discovery Section (along with the other properties of the class)
     <Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
    Therefore perhaps I need to add this as a property as well as an InstanceSetting?
    I am using SCOM 2007 R2 at the moment
    Thanks very much
    AAnotherUser__
    AAnotherUser__

Maybe you are looking for