Offline Feature in Cloud Application Studio
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 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 features in Cloud Application Studio. Stay tuned for the upcoming blogs which explain each functionality of offline topics in detail!
- Creating an Offline Custom Business Object
- Creating an Offline Extension BO
- 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 the 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 syncing the metadata 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 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)
The idea is to have a mechanism that 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 the 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. The offline ABSL script is a different file than the online ABSL. Only offline relevant artifacts 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 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 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 starts 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.
Excellent blog Dhanya
Thanks for the valuable blog.
I've created a new solution with custom BO. When i try to add this [OfflineEnabled] annotation for the custom BO. I'm not able to use this annotation and getting errors.
Thanks in advance.
Apologies for the confusion. Offline feature is currently enabled only for SAP Cloud for Customer product and that is the reason you are seeing that error. This is not enabled for SAP ByD as of now.
Updated the blog as well!
Thanks for the Information.
Very nice insight into offline capabilities. Thanks for the share.
1 question. I have assigned my user with work center OFFLINE_DEV_TOOLS_WOC, however, I cannot see the offline tools or menu under my user name even after multiple re-logins. I tried for both businesses as well as PDI users but the same issue. So do you know if part from WoC assignment any other steps need to be completed before I can see the offline menu?
are you using the mentioned URL from the blog to check the Offline Mode?
There are no other requirements needed other than assigning the work center views to be able to see the tools.
It was my bad that I was checking for this option without Syncing data in
Now I just sync entire data and I can see "Offline Development Tools".
Hi Dhanya and Team,
I see the blog says in point 2, possibility of "Embedded components in standard screens" in offline scenario. But how to enable embedded component information is not available in standard documents. Can you please provide some link or details to that ?
Thanks for the blog, it really helped to get started with offline custom BOs. Would be great to see it finished
However, I have a question regarding the secondary synchronization.
The help page just says use "the annotation [OfflineSecondary] at the element declaration in the BO definition". However, if I add the annotation to the respective element, this case my alternative key with the same if as the standard Promotion BO, I get an error message:
-> Annotation 'OfflineSecondary' is expected to have 1 parameter(s)
If I add a "source" node, such as Promotion, it says that the annotation is not valid.
-> source element 'Promotion' is not valid for a parameter of annotation OfflineSecondary
So what is the correct way to define a secondary synchronization?
'OfflineSecondary' needs to be defined as shown here. This is an example with CustomerQuote standard object having custom object stores related details.
[OfflineSecondary(AP.CRM.Global:CustomerQuote.ID)][AlternativeKey] element ZOrderBOkey : ID;
Hope this helps.
May I know whether “Custom Business Objects which are related to integration process ” can be used in Offline mode？