cancel
Showing results for 
Search instead for 
Did you mean: 

Kapsel - Can't find variable: sap

Former Member
0 Kudos

I'm trying to create a Kapsel application for iOS and I'm running into some issues.  I am getting the error "Can't find variable: sap" whenever I make a call to any of the plugins.  I have confirmed that all of the plugins have been added and I've also include a reference to cordova.js in my index.html file.  Can you think of anything else I may be doing wrong?  I've tried calling the Kapsel functionality from the index.html file directly and from a separate JS file.

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

Could you give information on the steps you followed.

Hope you are trying to develop cordova app for ios on mac machine (mac is need for cordova based ios apps).  Make sure you added the kapsel plugins to your project using cordova command successfully as mentioned in this blog

Midhun VP

Former Member
0 Kudos

I am developing everything on a Mac.  I've determined that the issue isn't specific to the Kapsel plugins.  It also occurs when I try to use the built in Device plugin for Cordova.  I'm researching it more now but it appears to be a Cordova issue and not a Kapsel issue.  I will post the solution here once I find it.

Former Member
0 Kudos

By the way, I am using Cordova 3.4.0-0.1.3 and SMP SDK 3.0 SP03.

Former Member
0 Kudos

I was able to figure out the issue.  I was trying to use the Kapsel plugins in the jQuery $(document).ready function.  Based on what I've seen online, you should not try to use plugins until the deviceready event has fired.  I moved my code to the device ready event.  Here's some more information on that event:

http://cordova.apache.org/docs/en/2.5.0/cordova_events_events.md.html

Once I put my code in the device ready event, I had an issue where the event was not firing on iOS.  This appeared to be a bug with the version of Cordova that was recommended in the "Getting Started with Kapsel Part 1" document for SP03.  I upgraded to the latest version of Cordova and the issue was resolved.

Former Member
0 Kudos

This message was moderated.

Answers (4)

Answers (4)

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

Nothing to do with version, just try to deploy it on simulator first and no such error. Especially after you have re-built the application.

agentry_src
Active Contributor
0 Kudos

Thread is now locked against necromancy posts.

Regards, Mike (Moderator)

SAP Technology RIG

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

I faced similar problem sometime back and after following all the steps mentioned here i was able to resolve it.

If you still face the same, please share a screenshot of that error.

Rgrds,

JK

Former Member
0 Kudos

I had installed a newer version of Cordova so I uninstalled it and installed the correct version.  I am still having the same issue though.  I have inserted a screenshot of the error below.  It seems like the SAP Javascript references are just not being added correctly.  Do those get added automatically through the cordova.js file? 

Here is the line of code on line 93:

sap.Logon.init(logonSuccessCallback, logonErrorCallback, appId);

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you tell about SMP Mobile SDK version along with cordova version you have installed?

e.g. SMP Mobile SDK 3.0 SP04

you can find cordova version by running

cordova -v command

Rgrds,

JK