cancel
Showing results for 
Search instead for 
Did you mean: 

Walkthrough in WebIDE: sap is not defined

EkanshCapgemini
Active Contributor
0 Kudos

Hi All,

I was going through the walkthrough tutorial and creating this in eclipse. I reached till step 8 and it was working fine in eclipse. Now I copied all my folders and files to WebIDE and when I tried to run the index.html file as web application, it shows error that "sap is not defined". PFB the screenshots and code of index file.


<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>

        <meta charset="UTF-8">

        <title>Walkthrough</title>

  <script

  id="sap-ui-bootstrap"

  src="resources/sap-ui-core.js"

  data-sap-ui-theme="sap_bluecrystal"

  data-sap-ui-libs="sap.m"

  data-sap-ui-bindingSyntax="complex"

  data-sap-ui-compatVersion="edge"

  data-sa-ui-preload="async"

  data-sap-ui-resourceroots='{

  "sap.ui.demo.wt": "./"

  }'>

  </script>

  <script>

  sap.ui.getCore().attachInit(function () {

       sap.ui.xmlview({

       viewName : "sap.ui.demo.wt.view.App"

       }).placeAt("content");

     });

  </script>

  </head>

  <body class="sapUiBody" id="content">

  </body>

</html>

Please help me in resolving this.

Regards,

Ekansh

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
EkanshCapgemini
Active Contributor
0 Kudos

Hi Santhosh,

It worked. I'll close the thread but may I know the reason for this while other apps which were deployed earlier in my WebIDE work fine with the src="resources/sap-ui-core.js" .

Private_Member_15166
Active Contributor
0 Kudos

See these links for reference.

santhu_gowdaz
Active Contributor
0 Kudos

src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js" it will look "sap-ui-core.js"

in that path(it will gives updated API). and "resources/sap-ui-core.js" it will looks the sap.ui.core.js in your local dictionary means in your case webide.some times for some reason It's failed to get that.

so after some time try it. same your src="resources/sap-ui-core.js" will work.

EkanshCapgemini
Active Contributor
0 Kudos

Hi Dhananjay,

I just went through all those links. It raised one more question now . In eclipse we are able to load the resources/sap-ui-core.js file as there is mapping done in web.xml file which routes this request to the ui5 runtime. But how this is done in WebIDE as there is no such explicit routing which would be redirecting this request to load this file.

Regards,

Ekansh

EkanshCapgemini
Active Contributor
0 Kudos

Hi Santhosh,

I agree with your point. But why resouces/sap-ui-core.js is not working in one application(the current one which I am discussing) while it works absolutely fine in the other app at the same time?

If there would have been any network issue, it would have affected both the apps in the same manner.

Regards,

Ekansh

former_member182372
Active Contributor
0 Kudos

does you project's neo-app.json has

"routes": [

  {

   "path": "/resources",

   "target": {

   "type": "service",

   "name": "sapui5",

   "entryPath": "/resources"
   },

   "description": " SAPUI5 Resources"
  },

EkanshCapgemini
Active Contributor
0 Kudos

Hi Maksim,

Since I had not created the project from template, I realize that I do not have neo-app.json file in my folders. I just created the file and pasted the above code, set the src="resources/sap-ui-core.js". Still I am facing the same issue.

Where am I doing wrong?

Regards,

Ekansh

EkanshCapgemini
Active Contributor
0 Kudos

Hi Maksim, Dhananjay & Santhosh,

I got it working when I placed all my files in the root 'Walkthrough' folder including the newly created neo-app.json . So finally my project structure in WebIDE is

.user.project.json & sap-ui-cachebuster-info.json files are auto created by WebIDE when you try to run as Web Application. The 'webapp' folder is empty now.

@: neo-app.json is the file which has routes for requests of resources/sap-ui-core.js to the sapui5 services provided by webide. Am I right? Please clarify.

Regards,

Ekansh

former_member182372
Active Contributor
0 Kudos

yes, that`s the place where you can describe usage of services, destinations etc.like in one of the project it looks  like this

"routes": [

{

  "path": "/resources",

  "target": {

  "type": "service",

  "name": "sapui5",

  "entryPath": "/resources"

  },

  "description": " SAPUI5 Resources"

},

{

  "path": "/test-resources",

  "target": {

  "type": "service",

  "name": "sapui5",

  "entryPath": "/test-resources"

  },

  "description": " SAPUI5 Test Resources"

},

{

  "path": "/services/userapi",

  "target": {

  "type": "service",

  "name": "userapi"

  }

},

{

  "path": "/sap/opu/odata",

  "target": {

  "type": "destination",

  "name": "xxx_GW",

  "entryPath": "/sap/opu/odata"

  },

  "description": "Target OData system"

},

{

  "path": "/sap/bc/xxx/file_upload",

  "target": {

  "type": "destination",

  "name": "xxx_GW",

  "entryPath": "/sap/bc/xxx/file_upload"

  },

  "description": "Attachment upload"

},

{

  "path": "/cs1",

  "target": {

  "type": "destination",

  "name": "xxx_CS1",

  "entryPath": "/"

  },

  "description": "Target Content Server system"

}

],

Former Member
0 Kudos

Hi Ekash,

Even I am facing the same issue.I manually added the eno-app.jscon file.

Still facing the same issue.

Please can you send me the exact code.

I am not able to display the view when i execute from WEB IDE

Subhashini

EkanshCapgemini
Active Contributor

Hi Subhashini,

The code for neo-app.json is:

{

  "routes": [

    {

      "path": "/resources",

      "target": {

        "type": "service",

        "name": "sapui5",

        "entryPath": "/resources"

      },

      "description": "SAPUI5 Resources"

    }

  ]

}

You need to make sure that the folder structure is as I mentioned in below response. All the files should be in the root folder.

Regards,

Ekansh

Answers (2)

Answers (2)

agentry_src
Active Contributor
0 Kudos

Thread is locked due to necromancy.  Please read the Rules of Engagement in the Getting Started link at the top right of each page.  Create your own Discussion if the solution to an already marked Answered thread does not work for you.

Regards, Mike (Moderator)

SAP Technology RIG

Private_Member_15166
Active Contributor
0 Kudos

That looks like your path to SAPUI5 (src="resources/sap-ui-core.js") is not correct. Check where you deployed it and modify that.

EkanshCapgemini
Active Contributor
0 Kudos

Hi Dhananjay,

I have deployed it on webide. It worked with Santhosh's reply but I am curious for the reason because in all other apps that are already deployed on my webide account use the same src.

Regards,

Ekansh