sap.n.Database & AppSync
sap.n.Database & AppSync is a component of the AppSync framework that enables the offline usage of large data sets in frontend applications. It allows for downloading and storing substantial amounts of data from the backend into an SQLite Database on the browser or device. By using Models and bindings, data can be seamlessly synchronized between the frontend and backend. This component is particularly useful when extensive data needs to be available offline for efficient and uninterrupted user experiences.
Supported browsers and OS
On Desktop:
-
Google Chrome
-
Microsoft Edge
On Mobile:
-
Android
-
iOS
-
Windows 10
It is always recommended to check if your specific platform and browser version is supported at: https://caniuse.com/#feat=sql-storage
Procedure
Start Neptune Application Designer (NAD) and create or change an Application.
On the Libraries section, drag a Database object to your application.
Add a nested Table inside the Database and give it a name .In the example below, TableDD02L is the given name.
Your application should have one Database object and as many Tables as needed inside it. |
Bind the Table component to one of your ABAP internal tables.
Internal tables must be declared as public attributes of your ABAP Class |
Select the Key Field for the Table.
Add the statement to trigger the AppSync process. In the example below, it will trigger 4 processes in parallel:
AppSyncStart(4);
Set the logic for the ajaxSuccess and ajaxError events. These will be triggered once the AppSync is completed (or failed).
When AppSync(…) is triggered, HANDLE_ON_SYNC_OUT method is executed on the ABAP Class.
The logic for retrieving the data must be coded there:
Accessing the offline data
AppSync
The AppSync framework, utilized by sap.n.database, offers the capability to employ multiple threads for data retrieval. These threads can operate either in parallel or serial mode, providing flexibility and efficiency.
When initiating the sync process, it is essential to specify the desired number of threads. By default, the framework employs a single thread, but this value can be adjusted to suit the specific requirements of the application.
please keep in mind that each thread will trigger an Ajax call to the backend, and therefore a new session will run in your ABAP stack |