Skip to Content
0
Jun 24, 2021 at 08:52 AM

how to register event in Fiori element extension app in Business Application Studio

561 Views Last edit Jun 24, 2021 at 08:53 AM 2 rev

Dear SAP Community,

I am extending the Manage Purchase Order Fiori App using the Business Application Studio. i have created a fragment and added a button with it in the list report. i have also coded a controller for the same, but on press of the button no event is being triggered.

i read in a blog that i should maintain the event in the manifest.json file but that does exist in this adaptation project.

how do i add this event and trigger the code in the controller

fragment:

<!-- Use stable and unique id's!-->
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
    <Button id="btnAttachment" text="Attachment" press="onAttachment"></Button>
</core:FragmentDefinition>

controller:

/***
@controller Name:sap.suite.ui.generic.template.ListReport.view.ListReport,
*@viewId:mdm.cmd.product.maintain::sap.suite.ui.generic.template.ListReport.view.ListReport::C_Product
*/
sap.ui.define([
        'sap/ui/core/mvc/ControllerExtension'
        // ,'sap/ui/core/mvc/OverrideExecution'
    ],
    function (
        ControllerExtension
        // ,OverrideExecution
    ) {
        "use strict";
        return ControllerExtension.extend("zproductmaster.fragAttachment", {
                onInit: function() {
                    alert("onInit");
                },
                onAttachment:function(){
                    alert("onAttachment");
                }
        });
    });

regards

Siddharth Shaligram

Attachments

adaption-proj.png (36.5 kB)