How to extend a SAPUI5 Fiori application (both view and controller)
PART I. Create a New Extension Project in WebIDE
PART II. Extend The View (to replace one of the existing control to add more information to it)
PART III. Extend The Controller (to add more event triggering and handling logic to the existing controller)
PART I. Create a New Extension Project in WebIDE
Go to https://rde-fiori.dispatcher.neo.ondemand.com/
Create a new Extension Project.
Select Remote -> SAPUI5 ABAP Repository.
Select application from SAPUI5 ABAP repository (GM6_https would be our target system, and CRM_OPPRTNTY would be our application to create extension upon).
Finish up.
Update the Component.js (Jerry Wang had a post on why this is needed), then run it.
Here’s our familiar Opportunity application.
The idea is to put all the custom extension code in this extension project, and leave the standard product code untouched. Once the extension project is completed, user shall update their Fiori launchpad, to make the extension project as the entry point of the target application.
PART II. Extend The View
Locate the ExtensionPoint in the view where you would like to extend, take opportunityItemExtension in the S2.view.xml for example.
Update the extension project Component.js, add the extension information into the customizing property.
Create our extension view.
Write our extension code, we’re essentially replacing the origin list item, in order to add a new object attribute.
Run the extension project again, you will see the extended view 🙂
PART III. Extend The Controller
Same as the view extension, we’ll first locate the hook in the controller, take extHookExtendProductEntryOnAdd in the S5.controller.js for example.
Then, update the extension project Component.js with the controller extensions property.
Lastly, create and write our controller extension code.
Run it, bingo, when the product added, we’ll get the product name and alert it out.
From where you are calling "b.ProductName"? how would I know this?