DOE to Device - Windows Mobile App Development using DOE and SUP
Applies to:
SAP Netweaver Mobile 7.31 SP 14, Mobile Gateway 1.10 SP 06 & Sybase Unwired Platform 2.0. For more information, visit the Mobile homepage
Summary
This document details the design and development of data retrieving, determination, transit, and publishing in the device using DOE and SUP. A sample application has been used in this document to explain the flow of data. This document could help for the development of enterprise mobile applications.
Author: Senthil Basuva Raj A S Company: SAP Labs India Pvt Ltd Created on: 27 November, 2011
Author Bio
Senthil Basuva Raj A S works in SAP for more than 4 years and an expert in UI and Mobile Technologies.
Table of Contents
Sample Business Scenario ... 3
Writing Backend Function Modules ... 3
Precautions ... 3
Modeling Mobile Data ... 3
Design Model and Rules ... 3
Receiver Generation Data Object ... 3
RMM - Receiver Meta Model ... 6
Standard Data Objects ... 7
Subscription Generator Data Object ... 7
Data Loading ... 8
Create, Test & Manage Rules ... 8
Technical Info about distribution models... 10
Know Parameters ... 10
Preparing Mobile Gateway ... 10
ESDMA (Entity Set Definition for Mobile Applications) Modeling ... 10
Projections ... 11
Know SUP Server ... 12
ESDMA Deployment ... 13
SUP Package Deployment ... 13
Design and Develop your App ... 14
Know about DEM & WMDC ... 15
Test the Application ... 16
Useful Transaction Codes ... 16
Related Content ... 17
Copyright... 18
Sample Business Scenario
Manager has to approve the Purchase Order created by his colleagues. In this application, he shall view the list of purchase orders created and approve/reject the purchase orders. He shall be able to view the Sales Orders for the Purchase Orders listed. Although this is a workflow scenario, it is designed as a functional application.
Writing Backend Function Modules
We shall have two backend function modules importantly to send data to DOE from backend viz GET_LIST and GET_DETAIL.
For CUD (Create/Update/Delete) actions, we shall have three more backend function modules to update the data in the backend.
For example - CREATE, MODIFY, and DELETE.
Note: Child nodes in DOE shall be loaded with data by additionally adding table parameters in function module.
Maintain mandatory Return parameter to reply the errors Precautions
Create function modules compliant with DOE Grammar. DOE shall throw error if the grammar is violated.
Test your function module for data correctness.
Modeling Mobile Data
Design Model and Rules
For any mobile application to receive data, model obviously will have receiver data (who receives the data), application data and subscriber data (who subscribes for the data). Subscriber data could be optional (based on the subscription needs). Hereafter model is referred as Data Object.
Receiver Generation Data Object
Receiver Generation is a type of data object category which facilitates the following:
Automatic Creation of device definitions
Extraction is done from the backend system, data stored in Consolidated Data Store (CDS) and Device Inventory
Mapping of DO Node attributes to Receiver Meta Model (RMM) attributes.
We need to define the structure of the receiver details as node attributes. Following is the same Receiver Gen DO node attributes.
Now we could define the backend adapter to connect to the backend via function modules as shown below.
Here we define the backend system and the function modules. If backend system is the same system, we could define it as NONE.
Once we define the backend adapter for the DO and saved, we have to Map the DO node attributes with backend function module structure using Mapping tool.
To create device definitions like DMSWCV, ESDMA Info and User associated with the device, child node could be used. Mapping with the backend shall be done similar to the parent node.
RMM - Receiver Meta Model
Once the Data Object and the Backend Adapter is activated, we need to perform steps in the RMM. Here we will map the standard device attributes with the receiver generation DO node attributes, such that device definitions will be assigned when the device is created.
Create a Customizing Group in the RMM
Single Valued Attribute Mapping in the Association entry.
Refer Receiver Generation DO here for more details: Receiver Generation DO
Standard Data Objects
Standard Data Objects are data models holding business data. Data in the Data Objects are stored in the CDS (Consolidated Data Store) tables. These tables are copy of backend tables along with unique keys for each instance. Later the data in the tables are forwarded to the device based on the rules and subscription data.
Sample Standard DO Node attributes is shown here.
Subscription Generator Data Object
Subscription Generator Data object shortly called as Sub Gen DO. This is similar to receiver generation data object which helps to maintain the subscribers list. This can be used in distribution model to determine which device shall receive what data. This DO also receives the data from the backend.
Sample Subscription Generation DO is shown below.
Data Loading
Use SDOE_LOAD transaction to perform initial load and delta load.
Once data load is triggered, set of queues will be triggered based on the volume of the data. These queues will process the data and store data in the CDS tables. The processing here will be comparing the data instance with CDS tables and inserting/updating the tables accordingly. You could check the below mentioned data load queues in the transaction SMQ2.
DOEBWA*
DOEBWA*FL
Data load is differentiated as initial load and delta load. Initial load shall be performed for the first time and thereafter delta load will be triggered.
After the queue run is complete, verify the CDS tables of all the data objects for the data from the backend.
Create, Test & Manage Rules
Rules are used to distribute data to devices based on certain conditions. Multiple rules can be created for a distributing the data. One distribution model should be created for a data object to apply the rules for the distribution of data. If multiple rules are applied for a DO, they are operated "AND" for the distribution. The
"OR" operation shall be possible with in a rule itself by specifying accordingly in the criteria fields.
It shall be possible to use different types of rules.
Bulk Rule, which shall send all the data to the subscribed devices
Normal Rule, which shall send the data based on the rule and the subscription. Data shall be sent to all the devices or subscribed devices. To send data to subscribed devices, you shall be able to specify the
subscription mapping for the determination of the subscribed devices. A normal rule screen shot has been shown below. In this rule, if processor attribute in the Purchase Order node satisfies the subscriber ID attribute of the Subscription Generation DO header node, the data will be pushed.
Node Level Filter, which helps to filter the records based on any conditions. Node Level Filter Rules provide a mechanism by which the data to be sent to the subscribed devices can be filtered at the node level of a Data Object. Sample NLF Rule is shown here.
Here in this rule, Purchase Order is filtered based on the region of the approver.
If NLF rule criteria on a particular node of a Data Object are not satisfied at runtime, then all the data corresponding to that node and its subsequent child nodes will not be sent to the subscribed devices.
Also, if there is a dependency defined with another data object as following object such that the dependency link is from the same node where NLF rule is defined, then the corresponding dependant data will also be
Technical Info about distribution models
For all the DO’s, there will be a *AT table where instance device pair combination will be stored based on the rule evaluation. You shall be able to check whether particular instance has been calculated for the device.
You shall also be able to check the status of the particular instance device pair. There are statuses maintained as said below.
I - There is a new record available for the device, but not yet extracted (sent) to the device.
0 - There was a new record available for the device and that record was extracted to the device.
D - Rule evaluation implies a delete of records which was already sent to the devices. Once the instance has been deleted from the device, this record will not be maintained in the *AT table.
*AT table will only maintain the status of the inserts, deletes and extracts but not the updates.
Update for any records is maintained in the *RT table. After extraction, instance device pair from the *RT table will be removed.
For the NLF applied nodes, there will be a *Z table where again the instance device pair combination will be stored based on the NLF evaluation.
Refer Distribution Modeling here for details
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/17024 Know Parameters
There are parameters that shall be configured for automating and to maintain performance.
In admin portal, go to Configuration->DOE Configuration
DO_SYNC_EXTRACT - To send the data to the device automatically once the data load has happen. You shall insert the DO and mark it as X.
CLIENT_PACKAGE_SIZE - To specify the package size used in extract to determine number of instances to be put in a single message.
CDS_READ_PACK_SIZE_FOR_EXT - To specify the package size to read CDS during extract MMW_RR_PERFORMANCE - To specify the package size for rule calculations
Preparing Mobile Gateway
ESDMA (Entity Set Definition for Mobile Applications) Modeling
Once DOE is designed and generated successfully, you shall be able to further redefine your model to suit your application needs. ESDMA design tool will help you to design your application. In the ESMDA design tool you can choose SWCV for the application. Further you can choose data objects from the chosen SWCV.
If any data object is not required for the application then you may not include that data object in the ESDMA.
After redefining data object, you shall be able to define the projections for the data flow. While defining the projection you have the flexibility to choose or discard data object fields. For one SWCV there could be multiple DMSWCVs for the data flow so in the ESDMA design tool you can assign the right DMSWCV for the data flow. In the ESDMA design time you can give authorization objects for client application data. After completing the definition, you shall generate the ESDMA.
Now from the generated ESDMA, we can download the bundles which shall be used for application development. Bundles are database software components which shall be integration layer for the device application and the DOE. In this case study example, all the data objects are added for data transmission.
Similarly the corresponding distribution models are assigned to the ESDMA bundle.
Projections
Projections help to select fields from the list of attributes of the data object. Projections are provided to balance with the bandwidth of data travel across DOE and Device. Bundles which are downloaded at the end of the ESDMA design shall define the database structures based on these projections.
Note: Release ESDMA action will release the ESDMA for usage and thereafter not possible to change the ESDMA.
Backend Search tab helps to define the function modules which shall directly hit the backend and do the functions defined. These are not validated through DOE. This feature has been provided with respect to device needs.
Download the ESDMA bundles to deploy the package.
Know SUP Server
Sybase Unwired Platform acts as an access platform to pass on the data to the device from DOE. Also it manages the devices, connections and security. In a SUP server, it shall be possible to deploy multiple applications connected to parent node called domain.
SUP Server can be controlled from Sybase Control Center. SCC lists the devices that are connected to the SUP Server and displays the status of each device connectivity. For example, if device is connected to the server, status will be displayed as ONLINE.
All the application logs and server logs can be accessed in Sybase Control Center.
ESDMA Deployment
Now we shall be able to deploy the ESDMA bundle in the SUP server. Prior to this, we have to enhance the ESDMA bundle to deploy in the SUP server. This is a generic process having no implications on application.
Create a subfolder META-INF under <ESDMA directory>.
Create a file sup-db.xml within this newly created folder. The contents of the file will look like:
<package name="EXAMPLE" short-name="EXAMPLE" sup-name="EXAMPLE" version="1.0"
cs-namespace="Sybase.Example.db" /* For Windows Mobile Application */
<!-- Update with new host and port, listener.url must end with /doe/publish. -->
<property name="listener.url" value="http://10.22.118.96:8000/doe/publish" />
<database name="example-database" />
<database-class name="ExampleDatabase" />
<personalization-parameter name="language" type="string" owner="client" />
<include file="afx-esdma.xml" />
</package>
Note: The ESDMA directory name shall not contain any spaces.
SUP Package Deployment
Execute the deploy command that is available in the CLU program. To do this, navigate to <SUP install directory>\UnwiredPlatform\Servers\UnwiredServer\doe-c_clu\bin, and run the program clu. After running the program CLU.bat command prompt will open and in the command prompt follow the steps below:
1. Doec_admin > deploy
2. Provide user: supAdmin; Password: s3pAdmin 3. Press Enter
4. Provide the path for bundle.
5. In this step provide the technical details (user name password) for DOE user.
Now you have to generate the files to use in the application development.
1. Execute the ESDMA Converter, located in <SUP install directory>\UnwiredPlatform\Servers\UnwiredServer\bin:
esdma_converter <ESDMA directory>
This should create an AFX file in the META-INF directory underneath the <ESDMA Directory>.
NB: this step should have already happened as a result of deploying the package. But if this step is carried out on a different machine, then it is necessary to execute it separately.
After the above steps two files get generated in the ESDMA directory. These two files are:
Code generation uses these two files for the platform specific DB queries.
2. Now execute the code generator utility:
codegen <ESDMA directory>\META-INF\sup-db.xml –cs -sqlite -mbs -client -log:co -output <ESDMA directory>
NB: the above command should be entered on a single line, with no breaks. Also, ignore these warnings log4j:WARN No appenders could be found for logger (com.sybase.djc.log.ComponentLog).
log4j:WARN Please initialize the log4j system properly.
3. Copy the generated files into the target VS project location.
Design and Develop your App
Now we create a windows mobile app project in Microsoft Visual Studio. It will create solution and the project package which can be viewed in the explorer.
Copy the following application extension .dll files to the folder app/bin/debug ABO.dll
log4net.dll MAPIdotnet.dll sup-client.dll
System.Data.SQLite.dll
Copy the following application extension .dll files to the folder app/
SQLite.Interop.065.DLL
Create forms with required UI elements. Write the function for the actions required. See the following app for a sample UI.
Know about DEM & WMDC
Now we can go to Visual Studio tools section to access Device Emulator Manager. We use the Device Emulator Manager (DEM) to start, connect to, and manage device emulators on our development computer.
It also does
Organizing emulators that are displayed in DEM Performing actions on device emulators from DEM Controlling DEM programmatically
Supporting Active Sync or Windows Mobile Device Center Communication
Using device emulator manager, we connect the device first and then cradle the device to deploy applications.
Windows Mobile Device Center (WMDC) used to synchronize devices with Windows OS. This was previously referred as Active Sync for older Windows OS versions (before Vista). This helps us to connect the device to OS to deploy applications. This has to configure as show below.
Once the device is connected, we make sure that, it is network connected. Install SUP Messaging Connector in the device. Now we can verify the device connected to the server in the SCC or in the device itself. Now we deploy the application and we have to make sure that, there is no failed message.
Test the Application
Now we are ready to test the application and the data flow.
Administration portal helps to administer device, monitor the data flow, configure optimization and scenario parameters and inbox to alert about the errors.
As designed in the mobile application, on click of LOGIN button, we are creating the subscription request to the DOE via SUP server. DOE shall get the subscription request and shall be viewable in the subscription monitor and session monitor. This can be ensured in the device administration where device status will be Registered.
Series of transactions will happen to ensure the handshake. All the transaction between DOE and SUP can be viewed in session monitor. All the communication between DOE and SUP is thru XML protocol.
The instances pushed to the device (outbound flow) are displayed in the session monitor along with the message details. One single message instance shall have multiple instance records for the device. The number of instance records per message instance can be configured in DOE configuration in Admin portal.
Error in message transaction from DOE can be viewed in the DOE logs and traces.
Useful Transaction Codes
SDOE_WB - DOE Work Bench
SDOE_RMM01 - To perform RMM customization SDOE_LOAD - To perform initial load & delta load
SDOE_ESDMA_DESIGN - To model ESDMA and download ESDMA Bundles SMQ2 – To look after queues created.
Related Content
SUP Example Projects, Tutorials, and Articles Mobile Articles
SAP Mobile
Copyright
© Copyright 2012 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Oracle Corporation.
JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.