Wednesday, June 19, 2013

Using Composite operations in SAP Mobile Platform to improve performance

SAP Mobile Platform is SAP’s mobile application development platform. With SMP you are able to build complex mobile applications quickly for multiple devices. SMP provides out of the box synchronisation capabilities and security features. 

With the release of SUP 2.2 PL3 there was a new feature called “Composite operation”. This nice new feature can be used to get better performance in your SUP MBO application. With this feature you are able to split a large MBO in multiple smaller MBO’s, but still use the larger (webservice) operations.

With the composite operation you can create a kind of lazy loading if you have MBO’s with a lot of data or have large attributes that are only needed for detail views. One advantage that you will create with this approach is that the page size of your package will be smaller and improve synchronisation performance. On the device, for example an iOS application, most of the time there will be a list view, when splitting an MBO into smaller MBO’s and only keep the attributes for showing, sorting, grouping and searching in the “Main” MBO will speed up your application.

The composite operation is designed to be used for one-to-many relationship. Like a sales order with order items. When you update your sales order in the same request you can also update your order items with that same operation. This way you will keep you data consistence.

The “Composite operation” is a nice new feature and we are going to show how to use it while building your business model in de SMP mobile SDK. For this example I used the sample database provided with SMP and created a small webservice for the customer table for the operations.

Let’s create a model in the SMP mobile SDK. Create a new Mobile Application project and drop the customer table from the sample database to the diagram and only map the id, fname & lname attributes to the main MBO. Drop another customer in your diagram and map the primary key and all other fields to the second MBO. Create a relationship between these MBO’s on the primary key.

For this example I created a one-to-one relationship and checked the 'Composite' box.


After adding the relationship we define a new operation. The trick here is to add an XSLT for each MBO. For this example I only checked the used attributes for each MBO by the creation of the XSLT.

After adding the XSLT’s we can map the input and output parameters to the MBO’s.

When the mapping is done this will result in the following model. We only have to create an operation on the “Main” MBO.


As I mentioned the composite operation was designed for one-to-many relationships, but this way it can improve performance as well!