Skip to Content
0

Type Error:sap.m is undefined

Aug 19, 2017 at 02:37 AM

87

avatar image
Former Member

Hi Gurus,

getting error as sap.m is undefined when running below index.html file in eclipse.

Any help will be really appreciated.

<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
   <title>Stock Overview App</title>
   <script
    src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"
    id="sap-ui-bootstrap"
    data-sap-ui-libs="sap.m,sap.ui.commons"
	data-sap-ui-theme="sap_belize" 
	data-sap-ui-compatVersion="edge"
	data-sap-ui-preload="async"	
	data-sap-ui-resourceroots='{
	   "view":"./"
	    }'>
  </script>


<script>


sap.ui.localResources("view");
var app = new sap.m.App({initialPage:"idView1"});
var page = sap.ui.view({id:"idView1", viewName:"view.main", type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);
app.placeAt("content");
 </script>
</head>


<body class="sapUiBody" role="application">
	<div id="content"></div>
</body>
</html>
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Iftah Peretz
Aug 19, 2017 at 11:56 AM
-1

Could be that by the time you run your script you don't have sap.m loaded.

Try changing to this:

data-sap-ui-preload="sync"
Share
10 |10000 characters needed characters left characters exceeded