cancel
Showing results for 
Search instead for 
Did you mean: 

What is the error in this JS shell plugin?

Hey, I'm trying to set up SAP Web Analytics in my Launchpad Service via Shell Plugin.
Therefore I used this two guides:

Developing a Shell Plugin for SAP Fiori Launchpad Service on SAP BTP (Multi-Cloud Environment) with ...
Tracking Portal site & App usage via SAP Web Analytics in SAP Cloud Platform | SAP Blog

After adding the Shell Script to my "Everyone" Group in the Content Manager I open the Launchpad but nothing is happening. When viewing the browser console it shows this error:

"Mandatory init() not called for UIComponent: 'fin.central.user.defaultparameter'. This is likely caused by a missing super call in the component's init implementation."

I can't spot an error in my "Component.js" so maybe the error is somewhere else? Anyway this is my code:

sap.ui.define([
    "sap/ui/core/UIComponent",
    "sap/ui/Device",
    "fss/fioriscript/model/models"
], function (UIComponent, Device, models) {
    "use strict";

    return UIComponent.extend("fss.fioriscript.Component", {

        metadata: {
            manifest: "json"
        },

        /**
         * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
         * @public
         * @override
         */
        init: function () {
            
            //set new ui component
            sap.ui.component( {name: "fss.fioriscript.Component" } )

            var rendererPromise = this._getRenderer();

            window.swa = {
                pubToken: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
                baseUrl: "https://events.web-analytics.cfapps.eu10.hana.ondemand.com/tracker/",
                loggingEnabled: true
            };
            this.loadTracker();
        },

        loadTracker: function () {
            (
                function () {
                    var d = document,
                        g = d.createElement('script'),
                        s = d.getElementsByTagName('script')[0];
                    g.type = 'text/javascript';
                    g.defer = true;
                    g.async = true;
                    g.src = window.swa.baseUrl + 'js/track.js';

                    s.parentNode.insertBefore(g, s);
                    if ((typeof sap !== "undefined" || typeof sap.ui !== "undefined") && sap.ui.version >= "1.65.0") {
                        //no need to track Hash change, as Router event is listened
                    } else {
                        window.onhashchange = function () {
                            window.swa.trackLoad();
                        };
                    }
                })();
        },
    });
});


Accepted Solutions (1)

Accepted Solutions (1)

Hey all,
I just recreated the project and added an empty getRenderer function:

_getRenderer: function() {}

Now it is working fine!

Abhi9
Explorer
0 Kudos

Hi Simon,

Is there a reason why these lines are initialized.

//setnew ui componentsap.ui.component({name:"fss.fioriscript.Component" } )
 

var rendererPromise = this._getRenderer();

I am still getting the same error.

Regards,

Abhi

0 Kudos

Hi Abhi,
in the process of debugging I received an other 404 for this UI Component. So I initialized it. If you do not get this error I think you can delete this line. Hope this helps.


Regards,
Simon

Answers (1)

Answers (1)

Abhi9
Explorer

Hi Simon,

Did you find the solution on why you are getting that error ?

Regards,

Abhinay

0 Kudos

I just added an answer.