How to extend the sap.ui.core.mvc.Controller ?

We are in the process of building a web application that allows users to "plugin" their own views (pages). When they create there own views there are a number of activities that are common across all pages that occur in the onInit() and onExit() methods, additionally, we may provide additional utility functions that should be available to the controller.
Currently when creating a controller the standard is to use sap.ui.controller("some.name", { controller specific functionality } );  I would like to create a sap.ui.MyController("some.name", { controller specific functionality }); that contains the utility functions and extra functionality in the LifeCycle methods so that these are automatically available to anyone defining this type of controller.
I believe the documentation I need to reference is boilerplate code for typed Controller however I am unsure on how this can be used
I assume that I define the controller abc/xyz/MYController.js
jQuery.sap.declare({modName:"abc.xyz.MYController", type:"controller"}); // declaring a special type of module
abc.xyz.MYController = function () { // the constructor
    sap.ui.core.mvc.Controller.apply(this, arguments);
jQuery.sap.require("sap.ui.core.mvc.Controller"); // this is currently required, as the Controller is not loaded by default
abc.xyz.MYController.prototype = jQuery.sap.newObject(sap.ui.core.mvc.Controller.prototype); // chain the prototypes
/* end of boilerplate code for typed Controller */
abc.xyz.MYController.prototype.onInit = function() {
    // modify control tree - this is the regular lifecycle hook
    console.log("Inside my new controller.");
Then use it in app/pageController.controller.js ...
jQuery.sap.require("abc.xyz.MYController");
abc.xyz.MYController("app.pageController", { ..... });
When I try this I get the Error
Uncaught Error: failed to load 'app/pageController.controller.js' from /mywebapp/js/app/pageController.controller.js: Error: Controller type app.pageController is still undefined after trying to load it. sap-ui-core-all-dbg.js:20313requi
Any help with this would be appreciated.
Regards,
Trevor

Hi Trevor
may this code snippet will help.
    jQuery.sap.declare("example.MyController");
    jQuery.sap.require("sap.ui.core.mvc.Controller");
    "use strict";
    sap.ui.core.mvc.Controller.extend("example.MyController", {
        onInit: function () {
-D

Similar Messages

  • When should the afterInit event fire for sap.ui.core.mvc.View ?

    I am looking to execute a function once only after the onInit() method on a controller has run. I assumed (incorrectly apparently) that the afterInit event that is provided by sap.ui.core.mvc.View would be fired after the onInit() method, however it appears that it actually executes before the onInit method on the controller.
    Is this the expected behavior ?
    Regards,
    Trevor

    Hi Jason,
    Yes, I had looked at that document, however it only covers the lifecycle methods of the controller, it does not mention the events that are fired. If you look at the https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.mvc.View.html documentation you will see that there are four events fired. The one I was questioning was the afterInit event, because I assumed that it was fired after the onInit method of the controller, however that is not the case.
    Regards,
    Trevor

  • Transaction Notofocation Procedure - How to know the SAP user?

    Hi Experts,
    In the transaction notification procedure can we know the name of the SAP user whose transaction is being processed?
    Thanks a lot.
    Regards,
    B.

    hi
    sapgenpse get_my_name -v -n validity
    http://wiki.sdn.sap.com/wiki/display/Basis/HowtorenewtheSAPRouterlicense
    http://www.saptechies.com/how-to-renew-the-sap-router-certificate-validity_1/
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCSTROUT/BCCSTROUT.pdf
    Kiran

  • How to extend the IDoc ORDERS05 and populate values?

    Hi,
    My requirement is to add few fields to the standard IDoc ORDERS05 and populate values to the newly added fields.
    Please let me know how to extend the standard IDoc ORDERS05.
    Regards,
    Balaji. R

    Hi balaji,
    you can try to google for SAP R/3 IDoc Cookbook for EDI and Interfaces by Axel Angeli et.al.
    Although Axel refers primarily to MATMAS Idoc the technique of extending IDOCs is explained very well.
    Also very good is the search function here on SCN, I just found
    [Some Experience on IDoc Enhancement|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3414900%29ID0711317150DB10743789739220747754End?blog=/pub/wlg/8285]
    Blogs and Wikis here are the best source for general questions like yours, usually of much more value than forum answers
    Regards,
    Clemens

  • Hi i would like to know how to extend the range of my time capsule wifi network(500G 802.11n) using an airport express. i have a double storey home and would like to extend range to my upstairs bedrooms.i have a time capsules network setup via a netgear a

    hi i would like to know how to extend the range of my time capsule wifi network(500G 802.11n) using an airport express. i have a double storey home and would like to extend range to my upstairs bedrooms.i have a time capsules network setup via a netgear adsl.i have a second imac upstairs which connects to time capsule wifi network (it is within range as it is directly abobe on 1st floor)
    could you tell me how best to set airport express up to extend my wifi range?

    Greetings,
    This is called an "Extended wireless network".
    Read this article for details and steps on how to extend your TimeCapsule's network:
    http://support.apple.com/kb/HT4259
    Cheers.

  • How to install the SAP Java Connector

    Hi,
    I am unsure how to install the SAP Java Connector on Linux (Suse Linux Enterprise 10). The SAP Integration Kit install and admin guide says:
    ===
    u2022 Copy the librfccm library and the libsapjcorfc library to busines
    sobjects_root/enterprise120/PLATFORM_PATH, where busines
    sobjects_root is the full path to your businessobjects directory,
    and PLATFORM_PATH is your platform. For example, PLATFORM_PATH
    is solaris_sparc for an installation on Solaris.
    u2022 Use symbolic links for the location of the librfccm library and the lib
    sapjcorfc library.
    u2022 Add the location of the librfccm library and the libsapjcorfc library
    to the library path.
    ===
    Do I have to do all 3 steps or is the 1st one (copying of files) enough?
    On the other hand, the SAP Java Connector guide says:
    ===
    Then add {sapjco-install-path} to the LD_LIBRARY_PATH environment variable.
    Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.
    ===
    So, what to do?
    Thanks!

    Thanks for your help. So i copied the 2 files as mentioned in point 1.
    Where do I have to copy the file sapjco.jar to? There is no shared lib folder after installing BO Edge 3.1 on a Linux system.
    I copied the sapjco.jar to /bobje/tomcat/common/lib but still get the message that the Java Connector files are not in the correct directory.
    I already copied the files librfccm.so and libsapjcorfc.so to /bobje/enterprise120/linux_x86 .
    Thanks again!
    Edit: problem solved: Copying the sapjco.so to tomcat/shared/lib is correct, if the directory doesn't exist then just create it (mkdir). The message is just plain information 7 hint.

  • How to test the SAP modules like SD and MM By using Quality Center and QTP

    Hi Experts,
    How to test the SAP modules like SD and MM By using Quality Center and QTP. Can you please provide the documentation regarding this.
    Regards,
    Skumar.

    Hi Sampath,
    First install QTP and SAP Addin with in QTP.
    2nd use QC to develop the test plan and then convert that test plan design to Test Scripts (QTP vesrion using settings)
    3rd record the R/3 GUI screen of SAP for SD, MM like Create order or Create PR.
    Once recording is done QTP will create a script in VB
    SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access  -  User").SAPGuiOKCode("OKCode").Set "/nVA01"
    SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access  -  User").SendKey ENTER
    you can always add a parameter and other customization according to your requirement.
    Let me know if you need more information regarding this.
    Good Luck!

  • How to fetch the SAP Standard Prog. built internal table into my_z_prog.?

    Hi Experts,
    Pls. let me know that,
    How to fetch the SAP Standard Prog. built internal table into my_z_prog.?
    For more explannation, pls. see my other thread with name of yestrday,
    SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
    thanq

    Hi
    Suppose RFGLBALANCE is your standard program and you have an internal table named I_RFGLBALANCE.
    And lets say your Z program name is Z_SRINIVAS.
    First find out the type of the internal table you want in your Z-program in the standard program. And declare an internal table of similar type in your Z-program.
    I hope you can do this much.
    Later wherever you are putting the below mentioned code.
    SUBMIT RFGLBALANCE WITH selection criteria
    Write the code which i have written.Obviously modify it to suit your requirement.
    Please show what is not working fine so that even anyone else can help you with the problem you are facing.
    Regards,
    Mayank

  • How to extend the range with a second Airport Express? Do I need a DSL cable?

    How to extend the range with a second Airport Express? Do I need a DSL cable?

    Thanks, now we need a bit more information, please, in order to provide you with the correct information that you need.
    I assume that you already have one AirPort Express.....either a model A1264 or A1392.....set up and operating OK, is that correct?
    If yes, you can extend the network either by using wireless or an Ethernet cable with a second AirPort Express.....either the A1264 or A1392 model. A wired connection is the way to go, if possible, since it provides better performance.  But, wireless might work OK for you if you want to try that.
    Let us know "how" you want to extend......wireless or wired?

  • How to INSTALL the SAP?

    Can anyone tell me how to INSTALL the SAP ?

    It is easier than Windows 2003 Installation.
    Contact SAP, For more details.....

  • Instructions on how to install the SAP Cryptographic Librabry

    Hi all,
    Earlier today I posted this query under the "Security" Forum but was told it's better posted here... so apologies in advance if you're seeing this thread again.
    What I would like to know is how to install the SAP Cryptographic software?... I have downloaded the SAP Cryptographic Library SAR file, and unpacked it, but am now looking for instructions on how to install and configure the software... anyone know how to do this?
    Thanks
    Sharon

    Hi Sharon,
    First uncar the SAR file in the folder  \usr\sap\<sid>\saprouter
    Just paste the files here once you uncar it.
    Then you have to set the variables as
    'SECUDIR' = \usr\sap\<sid>\saprouter
       SNC_LIB = \usr\sap\<sid>\saprouter\ntadm64\sapcrypto.dll
    ntadm64 or what ever folder you get once you uncar it.
    Reward points if helpfull.
    Regards,
    Vamshi.

  • How to debugg the SAP Script

    Hi to all.....
    How to Debug the SAP Script when it get's triggered with the Transaction.
    And how to Align the Standard Text data ..That is Justifing the statements.
    Advance Thanks to all
    Chinnu

    In se71, Chose from menu:
    Utilities-> Activate Debugger
    From the transaction, In the output message screen, you chose chose your output type, Go to Further options, Chose the dispatch option as Send at periodically scheduled jobs . then save the transaction. And run the prigram RSNAST00 It would stop at the debugging.
    Regards,
    ravi

  • Hi! Anyone know how to extend the intro of the music I want to use in a video in imovie?

    Hi! Anyone know how to extend the intro of the music I want to use in a video in imovie?

    Hi trineram,
    Welcome to the Support Communities!
    The article below may be able to help you understand the parameters for adding music to an iMovie for iOS project.
    iMovie for iOS (iPad): Add background music
    http://support.apple.com/kb/PH3192
    Cheers,
    - Judy

  • How to extend the time line for the premiere on mac pro mavericks

    how to extend the time line for the premiere on mac pro mavericks

    Wrong place.
    Try the Adobe Premiere forum.
    http://forums.adobe.com/community/premiere
    Good luck,
    x

  • How to extend the costing view for a material

    How to extend the costing view for a material

    Use MM01 Trxn code and Select Material and Select Costing Views and Maintain, Save it.
    Else Use MM50 and Select Material and Mainenance Status as G Costing and Execute, Maintain & Save.

Maybe you are looking for

  • Wrong calculation of tax

    Hii The total tax is coming wrong and same is reflected in the pricing.Infact the calculation is proper but the total tax the system is picking is wrong.The system is calculating extra 100 rs.I dont know from where it is picking this 100 rs extra.Inf

  • WSDL 1.1 Binding Extension for SOAP 1.2

    Hi, The WSDL file that is generated in XI 3.0 uses the specification SOAP 1.1 To apply the specification "WSDL 1.1 Binding Extension for SOAP 1.2", is it sufficient with adding the necessary parameters or have I to create the WSDL file again? Paramet

  • Hp Pavillon dv9700 --Windows Vista 32-bit--#10009 replace hard disk

    when i am trying to boot my laptop it say operation system not found.So i have done memory test for hard disk it says #10009 replace hard disk. 1.Are there any ways to solve this issue. 2.If not can i replace with higher memory hard disk . 3.are ther

  • Declare a text query

    If I have a text query in visual studio EXEC DCC_SPP_GetPeopleByDepartment @Department how can i declare the @Department to be varchar (8000) ? I tried declaring it in the stored procedure, but when I deploy the report, the query fails as it's lookin

  • Setting the "CSS Class" field not taking effect

    Hello. I defined my custom.xss as follows: <?xml version="1.0"?> <!-- $Header: custom.xss 115.2 2003/08/13 07:48:42 nigoel noship $ --> <styleSheetDocument xmlns="http://bali.us.oracle.com/cabo/ocelot"> <import href="oa.xss"/> <styleSheet> <!-- Pleas