The much-awaited offline feature for SAP Cloud Applications Studio in SAP Cloud for Customer is here!
The main idea behind this is to enable client applications to access back-end data without needing a persistent connection to the back end. If the solution uses the offline supported features, then you can now enable an existing solution for offline use. Isn’t that cool?
You might want to run applications offline to:
- Enable users to continue to use applications when there is intermittent network coverage, or the application is offline
- Improve performance by only sending requests to SAP Cloud on demand rather than for every transaction
Note: An important aspect to remember here is that if the extensions to business features are not enabled for use in offline by standard, will also be not available for offline use.
**This is the introductory blog for the series of blogs on the topic of Offline Feature in Cloud Application Studio. Stay tuned for the upcoming blogs which explains each functionality of offline topic in detail!
- Creating an Offline Custom Business Object
- Creating an Offline Extension BO(To be added)
- Creating an Offline UI(To be added)
- Creating an Offline ABSL script(To be added)
- More scenarios to be added…
Currently following features are available in the offline mode from studio:
1. Custom and extension business objects
You can enable a custom business object offline by adding the following annotations and below functionalities are available.
You can enable a business object offline by adding the [OfflineEnabled] annotation. This annotation creates the offline model of the custom object that is used for synching the meta data and object data with the user device. The annotation is allowed if the standard business object is offline enabled.
Note: The repository explorer has been enhanced for offline where you can find the objects that are offline enabled(e.g. standard BO, fields, and nodes)
2. Display and Edit of fields in custom and extension objects
- XBO Fields and fields created by administrators in the enhanced TI screens
- Work center views and TI screens for custom objects
- Embedded components in standard screens
3. Secondary synchronization (Custom object record related to Standard object record)
Idea is to have a mechanism which will update the metadata of business object with offline secondary sync details (whether a given business object has to be sync or not).
This has been achieved by introducing an annotation ‘OfflineSecondary’ which in turn will update the metadata that will be used during sync time. SDK developer will use the annotation to define, that instances of this Custom BO shall be synched on sync of the Source BO. This annotation provides the source BO (name and namespace) as well as the data element in the source ROOT BO node. The value of the data element in the Source BO is used as selection parameter on the data element of the Target BO to determine the instances to be synched.
4. Offline script files for an offline enabled extension object.
This is a two file concept. Offline ABSL script is a different file than the online ABSL. Only offline relevant artefacts are supported in offline BO’s, Offline Custom Libraries, Offline enabled SAP Libraries etc.
Note: If you want to include standard fields that are not available in offline mode, you may raise an incident or add an entry in the influence portal.
Now let’s see how to enable, test and debug in offline mode in detail:-
Enabling Offline Development Tools:-
The following steps have to be performed so that the menu entry “(Offline) development tools” is displayed:
- Assignment of work center OFFLINE_DEV_TOOLS_WOC (“Developer Tools”) and work center view OFFLINE_DEV_TOOLS_WOCV (“Offline Analysis”) to a business user. The assignment can be done in the usual way in the administration work center:
2. Open the user menu where the offline tools will be available.
3. Perform an offline sync. After the sync, the user menu will contain an entry “Offline development tools”, which is inactive in online mode:
4. Click on Go Offline and then the button Offline Development Tools will be active.
5. After pressing the “Offline development tools” button, the tools menu is displayed in the side panel:
To work with work centers enabled for offline use, click your user profile on the top right hand of your screen and select Go Offline. The data is synced with the browser cache.
Testing in Offline mode:
You can test the offline use case in Chrome browser using the following URL:
This client must not be used productively and must only be used to test and debug PDI enhancements. The client mimics the hybrid app and exposes a similar look and feel. Please sign up with your test user, sync and switch to offline.
Now to test your scenarios just follow the steps you perform in online.
Debug in Offline Mode:-
Please note that currently you cannot debug from SDK for offline features as this is currently not integrated. To debug from your end you can follow the below mentioned steps: –
1. You have to open the DevTools(as mentioned in the Enabling section).
2. Search for your enhancement code.
3. The resource name start with the solution namespace but due to the fuzzy search you can directly search for your object with -<Event|Validation>-.json.
4. Place a breakpoint and start the scenario from UI.
Please refer to the help document PDI Offline Help Document where you can find detailed information about PDI offline.
Note: This feature is currently enabled only for the product SAP Cloud for Customer.