Skip to Content
Author's profile photo Brenton OCallaghan

How to mobilise your SAP data using the Sybase Unwired Platform & iOS (Part 3)

This is part 3 of my series on creating an iOS application that connects to an SAP system using the Sybase Unwired Platform.

We are going to use our model from part 2 to enable our iOS app to communicate with our back-end SAP system (using the function modules from part 1) through the Sybase Unwired Platform.

First we need to do a little bit of groundwork on our Sybase Unwired Platform server. Go to your Sybase control centre (usually https://supServerURL:8283/scc) and login (default credentials supAdmin and s3pAdmin) and go to the applications area listed along the left side of the console. Under the application connections tab we now need to create a new entry for our device. We do this by selecting “Register”.


The user I am using is “supTut1”. My template should have been automatically created for me and in my case is SupTut1_preConfLogin. The only other setting I am worried about is my activation code (password) which I have specified to be the very secure “123”.

There may be some extra configuration required in your “Application Connection Template” for your app to work correctly and these settings are generally environment specific. For more information on these configurations please visit the Sybase info-center.

Now we are ready to start coding our app. Rather than go through a process that is pretty well documented on the Sybase info-centre, the first step is to setup a new iOS project in Xcode called “SUPTut” by following the instructions for “Developing an iOS application” as can be found here:

Make sure to continue and follow the next section on “Adding source code files, libs and resources” which can be found here:

Next, follow the instructions for “Configure Build Settings” found here:

Finally, you will need a file called a “CallbackHandler” which handles all of the messages received from the Sybase Unwired Platform during communications. Sample files can be found for this here.

Once all these steps are complete, the next step is to add our generated code to our project. This is the code we ended up with at the end of part 2 of this series. This code represents the ability for us to access the data we need via the SUP libraries that you included in your Xcode project.

So we are now ready to start getting our app ready for its first connection. For ease of coding I create a new “NSObject” subclass called “ConnectionController”. This class will take care of all of the connection APIs.

My ConnectionController.h file will have defined a single static method to trigger our connection.


Our ConnectionController.m will contain our static method implementation as well as a single instance method. But first, lets start with our imports:


Next we need to define any properties we will need which in our case is one. This will be our “CallbackHandler”.


As we only reference this class statically we need a static instance to reference as follows:


Next we can implement our static method “beginApplicationSetup”. The method will first check if this class has been instantiated before, if not it will create a new instance to be stored in our static variable. Finally it will call our (yet to be defined) instance method for connecting to the server.


Now we must define our instance method, which we will call “setupApplicationConnection”. The first thing we will do in this method is to setup a “SUPApplication” object and set our callback handler for the app.


Next we setup our connection properties. This is generally over port 5001 on your unwired server and is called “Message Based Synchronisation” or MBS. All SUP connections are initiated using MBS over this port. At this stage of the registration the application is identifying itself to the server and checking if it is able to register using the credentials we created on the SUP server earlier. We also create our local database on our device at this stage.


Our next step is to setup our synchronization profile. This is the profile used for actual data synchronization. The protocol used is called Replication based synchronization and usually takes place over ports 2480/2481 (insecure/secure).

Our final step here just prior to connection is to setup our callback handler on our database and then set our configured “SUPApplication” object on our database class.


So now we are ready for our connection code, which goes at the end of this instance method:


For this tutorial we are going to go for a simple UI on our application and rely on the Xcode debugger for most of the important information. Our application will have 4 buttons.


  • Start connection will simply register our device with the SCC over port 5001.
  • Synchronise will synchronize our data from SAP down to our device
  • Find All – will give us a count indicating how many rows of data we have on the device
  • Create new Entry will create a new entry on SAP using our create operation in our model.

Start Connection:




Find All:


And finally, Create new Entry. Simply taking the class of the MBO in our case “SupTut1BusinessData” and calling the method “getInstance” create new entries.  Once we have set any properties on this new instance of a line of our “BusinessData” MBO we call “save” on it. Once saved, we call “submitPending” which, submits all pending operations on our MBO line. Finally for good measure we call synchronise.


And that is it; once you have added these actions to your view and hooked up your buttons you can give your app a try. On first launch, you will need to register your device for the first time. This can take about 30 seconds.

  • Tap the “Start connection” button, and watch the Xcode console. If you have everything setup correctly you should see various messages scrolling as your SUP server sends various configuration information to your device. Eventually you will see a status of 203, which means successfully registered (for re-connects this would be a 103).
  • Once you are connected you can synchronise.
  • Once synchronised you can check how many lines of data you have on your device, which should now match SAP.
  • Finally you can then create a new entry on SAP by tapping that button. After a few seconds you should be able to see this new line on your SAP system.

If all of this works then congratulations you now have a fully working SUP/SAP sample iOS application, which both receives and sends data.

This tutorial is a small snapshot of how to get an end-to-end Sybase Unwired Platform based SAP mobile app working. There are a lot more options, configurations and options available under the hood and I recommend checking out the Sybase documentation for more information on these.

In the meantime – Happy coding!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Brenton OCallaghan
      Brenton OCallaghan
      Blog Post Author

      Hi Priya,

      Can you confirm which version of SUP you are using?



      Author's profile photo Former Member
      Former Member

      Hi Brenton,

      Thanks for reply. we are using sup2.1.2. we are updating it soon.I think this is for latest one. right?

      Author's profile photo Former Member
      Former Member

      we have followed all the steps mentioned in the blog.
      StartConnection,Synchronise,Findall worked well.
      fourth method i tried was to fetch the details of all the flights having airline id AA.

      We have done the code as below.


        Flight_DetailsPersonalizationParameters *pp = [Flight_DetailsFlightDB getPersonalizationParameters];

          [pp setAirline_PK:@"AA"];

          [pp save];


          while([Flight_DetailsFlightDB hasPendingOperations])


              [NSThread sleepForTimeInterval:1];




          [Flight_DetailsFlightDB beginSynchronize];


          Flight_DetailsFlight_MBO *flight = nil;

          SUPObjectList *cl = nil;

          cl =[Flight_DetailsFlight_MBO findAll];



          if(cl && cl.length > 0)


              int i;



                  flight = [cl item:i];



                       NSLog(@"details are %@",flight.CITYFROM);





         While running the app i am getting the error as follows


      error retriving public key from serversource. code 515.


      error sending request to server Native Error

      please help us to fix it

      Author's profile photo Mark Teichmann
      Mark Teichmann

      Hi Brenton,

      nice blog, strange that I discovered it only today...

      I like the usage of the static ConnectionController. I implemented the connection process following the Sybase help pages but this is very cumbersome.

      Cheers,  Mark

      Author's profile photo Brenton OCallaghan
      Brenton OCallaghan
      Blog Post Author

      Hi Mark,

      Glad to hear it helped you out 🙂 It does make it a lot easier to interact with in the rest of the app I have found.



      Author's profile photo Former Member
      Former Member

      Good concise write-up this. I had to make 2 amendments to make it work for me:

      1) You state to follow some of the iOS app setup steps outlined on the Sybase site. But I found that I should NOT remove the SUP101 folder, and NOT add the demo files from with the exception of the CallbackHandler.h/.m files.

      2) At some point you're calling [properties setFarmId:0]; on the SUPConnectionProperties object. I found that this throws a cryptic error that only disappears when changing the variable from an int to a string like this: [properties setFarmId:@"0"];

      Those two things actually made me search and dig all over the place to figure out what is going on/wrong probably giving me more insight than the tutorial intended, so job well done 😉 Thanks!

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Hi Brenton,

      good set of articles. 🙂 found it today only..

      Illustrates a complete app.

      Author's profile photo Former Member
      Former Member

      Has somebody out there created this demo for the SUP 2.2 SP04 environment

      I would very much like to get my hands on a project export or a detailed guide as I find it very hard to understand exactly how to merge the SUP101 tutorial with this SUPTut tutorial and get it build.

      Kind Regards


      Author's profile photo Brenton OCallaghan
      Brenton OCallaghan
      Blog Post Author

      Hi Carsten,

      Could you share some more information about where it is not working - it would be good to see if there is a common problem that perhaps others have seen before.

      The APIs have most definitely changed since I wrote this piece so it would be good to understand where the gaps are now.



      Author's profile photo Former Member
      Former Member

      As I am not used to this environment and is not an experienced developer I am struggling to understand how to merge this tutorial with the standard Sybase SUP101 tutorial you refer to. Exactly how much of the SUP101 code should I include and do I need to do some modifications to the SUP101 part? Reading one of the previous posts I thought that maybe I should not delete the SUP101 folder and not add the tutorial files from the Sybase SUP101 zip archive. But doing this just gave me a number of other build errors. So in my last attempt I have tried to follow the instructions you refer to on the Sybase site but for the SUP2.2 SP04 version.
      At the moment I get a number of build errors when I try to build the project as described in the "Configure Build Settings" link. I have not even gotten to the part where I have to add the callbackhandler.

      That is why I thought it would be nice if an experienced developer had done the work or a reference to where I could find a similar demo. Because what I really need is to get my hands on a simple demo that can show that it is possible to manipulate data on an SAP system using a SUP / SMP app on a mobile device connected to our new SUP / SMP server (we have both versions 2.2 and 2.3).

      Kind Regards