cancel
Showing results for 
Search instead for 
Did you mean: 

Type Error:sap.m is undefined

Former Member
0 Kudos

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>

Accepted Solutions (1)

Accepted Solutions (1)

iftah_peretz
Active Contributor
0 Kudos

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"

Answers (0)