OSBCore SDK Overview
OSBCore SDK Overview
OSBCore SDK Overview
©
Copyright 2014 PROLOGA GmbH. 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 PROLOGA GmbH. The information contained herein may be changed without
prior notice.
Some software products marketed by PROLOGA GmbH and its distributors may contain proprietary
software components of other software vendors.
Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks
of Microsoft Corporation.
IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®,
OS/390®, OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere ®,
Netfinity®, Tivoli®, Informix and Informix® Dynamic ServerTM are trademarks of IBM Corporation in USA
and/or other countries.
UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.
Citrix®, ICA®, Program Neighbourhood®, Meta frame®, WinFrame®, Video Frame®, and MultiWin® are
trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of the W3C®, World Wide Web
Consortium, Massachusetts Institutes of Technology.
Javascript® is a registered trademark of Sun Microsystems, Inc., used under license for technology
invented and implemented by Netscape.
SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com, 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 in
several other countries all over the world.
All other products and service names mentioned are the trademarks of their respective companies.
These materials are provided by PROLOGA GmbH for informational purposes only, without representation
or warranty of any kind and PROLOGA GmbH shall not be liable for errors or omissions with respect to
the materials. These materials are subject to change without notice. The only warranties for PROLOGA
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.
National product specifications may vary.
The original text of this document has been written in German. An English language translation has been
provided as courtesy. In case of any conflict, it is agreed that the German version is the official original
version and text and shall prevail in all respects and that no translated language shall be offered as
evidence of the meaning of the German original.
Before you start the implementation, make sure you have the
latest version of this document.
The following table provides an overview of the most important document changes.
1 Created
2 Added Document upload
Table 1: Most important document changes
Table of Content
1 Introduction ................................................................................................................... 5
2 Login .............................................................................................................................. 6
3 Business Objects ............................................................................................................ 7
3.1 Meter Reader .................................................................................................................... 7
3.2 Tour................................................................................................................................. 7
3.3 Order ............................................................................................................................... 8
3.3.1 Online Billing..................................................................................................................... 9
3.3.2 Offline Billing .................................................................................................................... 9
3.4 Order Item ....................................................................................................................... 9
3.5 Invoice ........................................................................................................................... 10
3.6 Document ....................................................................................................................... 10
3.7 Inheritance ..................................................................................................................... 10
4 Workflow ...................................................................................................................... 11
5 Communication ............................................................................................................. 12
5.1 RequestData ................................................................................................................... 12
5.2 SendData ....................................................................................................................... 12
5.3 Gateway Data Classes ...................................................................................................... 12
5.3.1 Receiving Classes ............................................................................................................ 13
5.3.2 Result Classes ................................................................................................................. 13
5.3.3 Online Invoicing Process Data Classes ................................................................................ 13
6 Configuration ................................................................................................................ 15
6.1 Configuration Process ....................................................................................................... 15
6.2 Configuration Setting Format ............................................................................................ 15
6.3 Configuration Settings for OSBCore ................................................................................... 15
Table of Tables
Attention
Note
This document describes basic concepts and objects used in OSBCore SDK. It contains an overview of
the following topics:
Login process
The different business objects of OSBCore
The general workflow of an OSBCore application
The communication with the SAP system
The configuration
For more in-depth information please refer to the different How-to documents or the interface
description.
A login on the SAP system is mandatory; otherwise the OSBCore cannot be used. Without a login, there
is no communication and also no current meter reader available.
An offline login is possible if the meter reader was previously logged on on the client. The password is
stored in the memory to allow the communication. However, the password is not persistent, only a hash
(to check the password against) is stored. An offline login will only be processed after an online login was
not successful (because of connection issues).
If the login is not valid anymore the communication methods will throw an OSBException with ID
LOGIN_FORBIDDEN (see chapter 5).
A logoff functionality is also available (e.g. for switching to another user). For both processes see the
class BLMeterReader.
Before the meter reader can do a login the OSBCore must be initialized.
Business objects contain data of an entity and also define the logic applied to manipulate those data. All
business objects have the prefix BO. The following business objects are defined within the OSBCore:
All business classes have BOBase as a parent class. BOBase implements the data store logic (like
Load/Get, Save etc.) and has the property ID, which is the primary key for all business objects. SQLite is
the underlying database. There is no need to directly access the database; all necessary data can be
received via its business object.
Persistent properties are marked with the Field attribute. All other properties are not stored in the
database. In order to create an instance for a business object, use the class BOFactory. BOFactory has a
single instance, which is accessible via the static property Current. The method to create an instance is
called CreateBO.
All business objects can be inherited to change the logic or to add new properties. To enable the OSBCore
to use the derived class you need to register the class in the BOFactory before initializing the OSBCore.
The meter reader business object represents the current user. The current logged in meter reader is
accessible via the CurrentMeterReader property of OSBCore. Meter readers are versioned (see document
Object Versions Documentation.docx).
3.2 Tour
A tour is the collection of associated orders. Tours are versioned (see document Object Versions
Documentation.docx).
Event Description
3.3 Order
Event Description
If the method finish is called, the order and its dependent results (e.g. order item or invoice results) are
sent back to SAP and the order is deleted from the data store.
An order can contain:
One or more order items
One or more invoices
One or more notes
An address object.
Online/offline orders have a special status to represent the online billing process:
None: There was no online billing started
Request: The order was marked for online billing
Delivered: The reading results are sent to the SAP
Activated The billing/invoicing was triggered in SAP
Finished: The online process is finished (successful or not)
For the online billing process it is necessary to have a connection to the SAP and to call RequestData/
SendData regularly (see chapter 5 for more details).
Since the online billing process is asynchronous, you can register two events to get informed about the
result of this process:
Event Description
OnOnlineInvoiceResult The invoice was created by the SAP and sent to the mobile client, the order has the
status ReadyToPrint
OnOnlineInvoiceFailed The online billing/invoicing was not successful, if Rejected is true the billing process
was not started on SAP side
Table 5: Results of Online Billing
On order level you can subscribe to those events, which belong to exactly this order. On class BLImport
you can subscribe to the same events for all orders.
If you want to cancel the online billing process (e.g. because the maximal waiting time is over) call the
method CancelBillOnline.
You can subscribe to the following events for detailed information about the process:
Event Description
OnBillingEngineAfterSetValue Get results of assigning the meter reading result of every billing relevant
register
OnBillingEngineAfterValidateValue Get results of the validation of every billing relevant register
Table 6: Detailed Information for Offline Billing
If the process was successful the orders status switches to ReadyToPrint and some properties of the
invoice are updated (NetAmount, TaxAmount, Currency and Hash). The OrderKindResult is also set to
offline.
Although the order item represents the meter register and therefore is a central component of the OSB
the BOOrderItem has no events or status. Moreover, the order items have no version (see document
Object Versions Documentation.docx). The order item is managed via its order.
An order can contain one or more invoices. Invoices have different types:
Simulation: It is necessary to do offline billing/invoicing.
Online: Result of the online billing/invoicing
Delivery: Invoice was created on order creation, only printing and delivery necessary
Information: Invoice stub, used to print an notification if the online billing failed
Each offline order needs exactly one simulation invoice and only offline orders should have a simulation
invoice. The simulation contains all reading independent information of the invoice (e.g. address) and
also the order specific data to process the offline billing/invoicing.
A delivery invoice can be part of an online or offline order. PrintOnly orders always have at least one
delivery invoice.
An information invoice can be part of an online order. It contains basic data to print a notification for the
customer if the online invoice creation failed/was not possible.
3.6 Document
BODocument and BODocumentLink allow to link files with business objects and send them to the SAP
system.
BODocument has a Type property which controls the processing of a document in SAP (see transaction
/WATP/MOB_CONFIG -> configuration master data -> DMS).
The document (file) content can be saved to the data store via the property Content or as a file system
link (via property ContentFileReference). The linked file will be deleted after sending the document to SAP
system. For larger documents it is recommended to use external files instead of including the content in
the data store.
BODocument publishes one event for notifications:
Event Description
OnSendDocumentFailed is raised when the document can't be send. e.g. when the file reference isn't
available.
Table 7: BODocument
A BODocument should have at least one connected BODocumentLink. You can create Link by using the
helper methods on BODocument (Add*Link).
The BODocumentLinks property ObjectType definies the type of business object this Link is connected to.
For standard OSB objects the correct ObjectType is “/WATP/OBJ”.
3.7 Inheritance
Of course it will be necessary to adjust the standard data model of OSBCore to the customers’
requirements. This can be easily done by deriving the standard business objects and the Gateway data
objects to add new properties to them.
To replace the original business object/data object, it is necessary to register the new types on the
BOFactory. The registration needs to be done before initializing the OSBCore. For more details refer to
How-to Use PROLOGA OSBCore SDK.docx.
The communication is processed using two methods: RequestData and SendData. Both methods should
be called periodically after the login is done.
5.1 RequestData
5.2 SendData
This method sends the result data to SAP and also retrieves the results of the online billing/invoicing
process:
In order to transfer data from and to SAP simple data classes are used. The classes contain simple
properties only and are not persistent. Objects of those classes are serialized/deserialized to the JSON
format. There are two types of data classes
For sending data
For retrieving data
All data objects with a direct corresponding business object apply their data to a BO by using its method
AssignFrom.
The three data classes with the postfix version are used to confirm the version of meter reader, tours and
orders after receiving them.
Class Description
The OSBCore provides a configuration mechanism. This process is implemented in the OSBConfig. An
instance of that class is available at the Config property of the OSBCore. This property is filled during the
initialization of OSBCore.
This configuration is used by the OSBCore itself and can also be used to retrieve application settings.
OSBConfig does not support the writing of settings to the config-ini file, it is for reading only.
The configuration is text file based. In the OSBCore a property ConfigFileLocation can be filled by the
application. In this location a config.ini file is expected. It allows changing the configuration of the
application without creating a new version (especially for Android apps). If ConfigFileLocation is filled and
a config.ini file is found at this location, the configuration will be read from this file. Otherwise the
config.ini from the application asset (Android app) or from the application folder (Windows) is used.
Name Description
In order to read a setting use the get*-methods of the OSBConfig class. Every method has three
parameters: the section, the name and a default value.