Reference error when bootrapping with data-sap-ui-oninit="module:..."

Viewed 1185

I wrote a simple SAPUI5 application and deployed it on our ABAP server with help of this blog entry.

It's working fine when the application is running on Tomcat. When I try to launch the application from the ABAP server, however, I get the following error:

Uncaught ReferenceError: hendrik is not defined

I guess it has something to do with the name for the resources but I don't really understand it. The debugger points to the line where I call the index.js file:

data-sap-ui-oninit="module:hendrik/odatabench/index"

Here is the code of my index.html:

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

        <script src="resources/sap-ui-core.js"
                id="sap-ui-bootstrap"
                data-sap-ui-libs="sap.m"
                data-sap-ui-theme="sap_bluecrystal"
                data-sap-ui-compatVersion="edge"
                data-sap-ui-async="true"
                data-sap-ui-resourceroots='{
                    "hendrik.odatabench" : "./"
                }'
                data-sap-ui-oninit="module:hendrik/odatabench/index">
        </script>
    </head>
    <body class="sapUiBody" role="application">
        <div id="content"></div>
    </body>
</html>
1 Answers

Bootstrapping with the attribute sap-ui-oninit='module:...' is supported only as of UI5 1.54 (commit).

UI5 1.28 is quite an ancient version which is out of maintenance. Either update SAPUI5 library in your ABAP system or bootstrap the application by getting the UI5 resources from the CDN:

<script id="sap-ui-bootstrap"
  src="https://ui5.sap.com/<version>/resources/sap-ui-core.js"
  data-...
></script>

List of currently supported versions can be found here: https://ui5.sap.com/versionoverview.html

Related