Working With Offline Stores¶
End users can securely upload local database files from a supported device to the server for analysis.
Send Decrypted Offline Stores to the Server¶
A device’s offline store may be useful for troubleshooting issues in some cases. This feature provides the ability to send the decrypted offline store to the server.
This means that users can open the offline store files without an encryption key and the encryption key being used on the devices remains undisclosed.
Use the following API to send a decrypted offline store to the server:
public void sendStore(OfflineODataProvider provider) throws ODataException {
provider.add(this, new OfflineODataDefiningQuery("req1", "Customers", false));
provider.open(this);
provider.sendStore(this);
}
func SendStore(provider: OfflineODataProvider) -> Void {
provider.sendStore(completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
printError(error, &errorMessage)
okay = false
} else {
printMessage("The Offline store has been sent successfully.")
}
})
}
When an Application Is Connecting to an SAP Business Technology Platform (NEO) Back End¶
Before consuming the sendStore function, the offline store upload policy feature needs to be enabled.
For information on enabling the offline store upload policy feature, see Defining Client Offline Store Upload Policy.
Downloading an Uploaded Store on an SAP Mobile Services (NEO) Back End¶
Before consuming the sendStore function, the offline store upload policy feature needs to be enabled.
For information on enabling the offline store upload policy feature, see Managing Client Database Uploads.
When an application is connecting to an SAP Mobile Services (Cloud Foundry) back end
Before consuming the sendStore function, the offline store upload policy feature needs to be enabled.
For information on enabling the offline store upload policy feature, see Defining Offline Settings for Applications.
Once the sendStore function is successfully consumed, the offline store files will be uploaded to the server.
See Procedure 8 on the following help page for information on how to download uploaded files for later investigation: Defining Offline Settings for Applications.
Send Encrypted Offline Stores to the Server¶
A device’s offline store may be useful for troubleshooting issues in some cases. This feature provides the functionality to upload the offline store and a temporary encryption key to the server.
This means that only users who get the temporary key can open the offline store files and the encryption key being used on devices remains undisclosed.
You must have sufficient disk space on the server to ensure that the offline store can be successfully uploaded.
public void sendEncryptedStore(OfflineODataProvider provider) throws ODataException {
provider.add(this, new OfflineODataDefiningQuery("req1", "Customers", false));
provider.open(this);
String newEncryptedKey = "default";
provider.sendEncryptedStore(this, newEncryptedKey);
}
func SendEncyptedStore(_ newEncryptionKey: String, _ provider: OfflineODataProvider) -> Void {
provider.sendEncryptedStore(newEncryptionKey:newEncryptionKey, completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
printError(error, &errorMessage)
} else {
printMessage("The Offline store has been sent successfully.")
}
})
}
Note
The newEncryptionKey parameter is case sensitive, and cannot contain leading or trailing spaces or semicolons.
When the application is connecting to an SAP Business Technology Platform (Neo) server
Before consuming the sendEncryptedStore function, the offline store upload policy feature needs to be enabled.
For information on enabling the offline store upload policy feature, see Defining Client Offline Store Upload Policy.
Download an uploaded store from an SAP Business Technology Platform (Neo) server
Once the sendEncryptedStore function is successfully consumed, the offline store files will be uploaded to the server.
For information on downloading uploaded files for later investigation, see Managing Client Database Uploads.
When an application is connecting to an SAP Business Technology Platform (Cloud Foundry) server
Before consuming the sendEncryptedStore function, the offline store upload policy feature needs to be enabled.
For information on enabling the offline store upload policy feature, see Defining Offline Settings for Applications.
Downloading an uploaded offline store from an SAP Business Technology Platform (Cloud Foundry) server
Once the sendEncryptedStore function has been successfully consumed, the offline store files will be uploaded to the server.
See Procedure 8 on the following help page for information on how to download uploaded files for later investigation: Defining Offline Settings for Applications.
Send Offline Stores with Note to the Server¶
The note parameter allows you to add a note to the offline store when sending it to the server. Using this parameter, you can add a description. For example, the note can be a symptom description, like "local update lost after download". You can use note in the sendEncryptedStore and sendStore APIs. The string cannot exceed 120 characters.
Send Decrypted Offline Stores with Note to the Server¶
public void sendStore(String note, OfflineODataProvider provider) throws ODataException {
provider.add(new OfflineODataDefiningQuery("req1", "Customers", false));
provider.open();
provider.sendStore(note);
}
func SendStore(note: String? = nil, provider: OfflineODataProvider) -> Void {
provider.sendStore(note, completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
printError(error, &errorMessage)
okay = false
} else {
printMessage("The Offline store has been sent successfully.")
}
})
}
Send Encrypted Offline Stores with Note to the Server¶
public void sendEncryptedStore(String newEncryptedKey, String note, OfflineODataProvider provider) throws ODataException {
provider.add(new OfflineODataDefiningQuery("req1", "Customers", false));
provider.open();
provider.sendEncryptedStore(newEncryptedKey, note);
}
func sendEncryptedStore(_ newEncryptionKey: String, _ note: String? = nil, provider: OfflineODataProvider) -> Void {
provider.sendEncryptedStore(newEncryptionKey, note, completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
printError(error, &errorMessage)
okay = false
} else {
printMessage("The Offline store has been sent successfully.")
}
})
}
Send Decrypted Request Store to the Server¶
In certain scenarios, like a multi-user switch, you may need to upload only the pending request queue to the server without sending the full entity store. Use sendRequestStore() to upload the request queue database (.rq.udb) file only. The note parameter is optional. You can use it to find the uploaded store among other uploads in the SAP mobile service cockpit. The note string cannot exceed 120 characters.
Note
You can open the uploaded request queue database with the ILOData command-line utility using open_request_queue_db_only=yes. In this mode:
- Use
printRequestQueueto display all pending requests in the queue. - Use
get RequestQueue,get ErrorArchive,get EventLog, orget CustomHeadersto query the built-in entity sets in the request queue database. - You cannot upload requests to the back end because the entity store, which holds the entity metadata, is not available.
func sendRequestStore(note: String? = nil, provider: OfflineODataProvider) {
provider.sendRequestStore(note: note, completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
// Handle the error
} else {
// Request store sent successfully
}
})
}
suspend fun sendRequestStore(note: String? = null, provider: OfflineODataProvider) {
provider.sendRequestStore(note = note)
}
public void sendRequestStore(String note, OfflineODataProvider provider) {
provider.sendRequestStore(
note,
() -> {
// Request store sent successfully
},
(error) -> {
// Handle the error
}
);
}
Send Encrypted Request Store to the Server¶
Use sendEncryptedRequestStore() to upload only the request queue database with a new encryption key. Using a new encryption key allows the server to open the uploaded file without revealing the device encryption key. The note parameter is optional. You can use it to find the uploaded store among other uploads in the SAP mobile service cockpit. The note string cannot exceed 120 characters.
Note
The newEncryptionKey parameter cannot contain spaces or semicolons.
You can open the uploaded request queue database with the ILOData command-line utility using open_request_queue_db_only=yes and store_key=<newEncryptionKey>. In this mode:
- Use
printRequestQueueto display all pending requests in the queue. - Use
get RequestQueue,get ErrorArchive,get EventLog, orget CustomHeadersto query the built-in entity sets in the request queue database. - You cannot upload requests to the back end because the entity store, which holds the entity metadata, is not available.
func sendEncryptedRequestStore(newEncryptionKey: String, note: String? = nil, provider: OfflineODataProvider) {
provider.sendEncryptedRequestStore(newEncryptionKey: newEncryptionKey, note: note, completionHandler: { (_ error: OfflineODataError?) -> Void in
if let error = error {
// Handle the error
} else {
// Encrypted request store sent successfully
}
})
}
suspend fun sendEncryptedRequestStore(newEncryptionKey: String, note: String? = null, provider: OfflineODataProvider) {
provider.sendEncryptedRequestStore(newEncryptionKey = newEncryptionKey, note = note)
}
public void sendEncryptedRequestStore(String newEncryptionKey, String note, OfflineODataProvider provider) {
provider.sendEncryptedRequestStore(
newEncryptionKey,
note,
() -> {
// Encrypted request store sent successfully
},
(error) -> {
// Handle the error
}
);
}