Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
brenton_ocallaghan
Active Participant

There are numerous blogs and how-to videos for the Sybase Unwired Platform however if you work a lot with SAP you might become a little frustrated when you struggle to find SAP specific examples.

In this 3 part tutorial I am going to run through creating a simple read and write SAP based mobile application using the Sybase Unwired Platform and consumed on an iOS device. The three parts will consist of:

  1. Creating two simple remote enabled function modules in SAP (read and write)
  2. Creating our SUP model, which will use the function modules from part 1.
  3. Creating a simple iOS app, which will communicate with our SAP system through SUP.

Our Scenario

First, lets set the scene. In SAP I have a table of business data, very simple data that is. It consists of a primary key provided by SAP and some text, which will be provided by our users.

Our users will want to view all of this data and add to that data if necessary all through their iOS device. So lets begin.

Getting Started

On my ERP system I have a table called ZSUP101DATA, which contains our business key (which is just an incrementing number) and some corresponding text.

We will need two ways of interfacing with this data a read function and a write function. Lets start with reading. We create a remote enabled function module called Z_SUPTUT_DATA_GET.

We will not be needing any importing parameters in this case however we will be returning two tables, one for our data and one standard BAPIRET2 table for any warnings or errors.

In this case ZSUP101_T is a table type of the same structure used in our table we mentioned earlier.

In terms of the code in the function it could not be simpler – just a “select *” from our table and placing the returned data into our exporting table “ET_DATA”.

And that is our read function. Next we need a write or create function.  So we need to create another remote enabled function module called Z_SUPTUT_DATA_CREATE.

We will have a single importing parameter taking the text to be inserted into our data table. We don’t provide a key here as SAP creates our keys for us.

Our exporting parameters will be a structure containing our new record including the key and a standard return BAPIRET2 table.

Our code for this function simply detects the highest key number currently in the table and increments it by 1. Then our new record with this key is inserted into the table. Finally this new record is returned in our exporting structure ET_DATA.

For the sake of this example I have not implemented any error checking however if you were writing this correctly, sufficient error checking would be added.

You should now be able to activate both of these function modules and unit test them to ensure they work.

Next

And that is it – step 1 is complete. Next we are going to move onto Part 2 of this series in which we are going to create our Sybase Unwired Platform model using the Sybase SDK.

Labels in this area