Updated: December 20, 2016

Locking

Intro

When multiple users work on the same work list, there is always a chance that more than one user tries to edit the same object at the same time. This can lead to the loss of important edits due to miscommunication when multiple users submit their changes without knowing from one another.

There are different concepts currently used in SAP Fiori how to handle these situations, such as locking with exclusive editing.

The concept of locking enforces a sequential change of information for objects. This behavior prevents users from updating information simultaneously while working unknowingly on the same objects at the same time. In order to overcome this gap, the concept of locking foresees that users are informed about when someone else is already processing an object. In that case, the object remains locked until the user leaves the editing process or until the lock time expired.

The following guidelines provide detailed information about the interaction of the locking behavior.

Interaction flow and messages - User 1
Interaction flow and messages - User 1

Usage

Use locking if multiple users need to work on the same work list and need to be informed about who is working on which object. If the information is only of secondary importance because users work rarely on the same objects simultaneously, consider to show the locking info only in the object view.

Information
Please be aware that you have to build some of the required logic by yourself as the draft infrastructure does not fully cover the complete logic yet. Check out the implementation details as well.

Layout

Locking information in a split-screen app, object view, list report, full-screen app:

Types

There are several ways to display the locking information:

Icon Only (1)

Display the icon without text when information on who is locking an entity is not available to you or you need to provide the locking information in the master list of a split-screen app.

The object list item provides a property (set markLocked to ‘true’) to show the locking icon.

Icon and Text – Not clickable (2)

Display the extended version in the object header. For example, in the detail list of a split-screen app or object view.

Icon and Text – Clickable (3)

Use an icon plus link in a responsive table or in the table toolbar when a section is locked.

In a non-responsive table (such as an analytical or hierachical table), display the information in the column Editing Status.

Clicking the link opens a popover with additional data.

Text Only – Clickable (5)

If the lock expired but the draft of another user is still available, display the status Unsaved Changes. 

Clicking the link opens a popover with additional data.

(1) Icon only; (2) Icon and text (not clickable); (3) Icon and text (clickable); (4) Table Column (clickable); (5) Text Only (clickable)
(1) Icon only; (2) Icon and text (not clickable); (3) Icon and text (clickable); (4) Table Column (clickable); (5) Text Only (clickable)
Information
If expanding the user name is too performance intensive, it is okay to show the following indicator in tables and object header: “(Icon) + Locked” or “Unsaved Changes”
Information
In case the name is not available, replace it with Another User.

Behavior & Interaction

Display

The locking information should be displayed as long as a user is editing an object. In some use cases it makes sense that the lock automatically expires (for example, when the user who is blocking the object has been idle for a certain time). If that is the case, the status Unsaved Changes is displayed instead of Locked.

Edit

Locked

Interaction flow and messages - Locked entity
Interaction flow and messages - Locked entity

(1) If another user has started editing an object, all other users see that the object is locked by that user.

Please be aware there is no push mechanism – a refresh has to be triggered by the user to get the information. The user can do this by:

  • Refreshing the list;
  • Triggering roundtrip.

(2) If a user tries to edit the entity, an error message is displayed when clicking the Edit button. Other buttons that would update the object also trigger error messages.

Clicking the name in the error dialog opens the quick view of the user.

Expired Lock

Interaction flow and messages - Expired Lock
Interaction flow and messages - Expired Lock

(1) If case another user has started editing an object and the lock expires, all other users see that the object has been modified by someone else.

Please be aware there is no push mechanism – a refresh has to be triggered by the user to get the information, The user can do this by:

  • Refreshing the list;
  • Triggering roundtrip.

(2) If a user nevertheless tries to edit the entity, a warning message is displayed when clicking on the Edit button. Other buttons that would update the object also trigger warning messages.

Clicking the name in the error dialog opens the quick view of the user.

User 1 Tries to Save: Lock Expired

Interaction flow and messages II - Expired Lock
Interaction flow and messages II - Expired Lock

(1) When the lock time expired due to inactivity of the user and the object in work is not up to date anymore when the user tries to save it, an error message (2) is displayed informing the user that his or her changes have been lost. If no other user has started working on the entity in the meantime, the user can continue to work and the lock time is extended again.

Dialogs and Popovers

Locking - Dialogs
Locking - Dialogs
Locking - Popovers
Locking - Popovers

(1) An error message is shown if the lock expired due to user inactivity and the object is not up to date anymore when the user tries to save it.

(2) A warning message is shown when another user tries to access the edit mode of an object if the lock has expired but the draft of another user still exists.

(3) An error message is shown when users try to conduct any action in an entity that is locked.

(4) The quick view for the employee is shown when information on the person who locks an object is available and clickable.

(5) The popover is shown when the user clicks on the locked link.

(5.1) The popover shown when the user name is not clickable, as no user information is available.

(6) The popover is shown when the user clicks on Unsaved Changes.

(6.1) The popover is shown when the user name is not clickable, as no user information is available.

Popover Measures

A popover is displayed when clicking the locking information. Use sap.m.popover to show the relevant administrative information.

Locking - Popover
Locking - Popover
Locking - Popover Measures
Locking - Popover Measures

Guidelines

Tables

If you need to show that an item is locked in a responsive table,  place a transparent button in the first column or next to the key information.  Clicking the user name opens a popover with additional information.

If you need to show that an item is locked in a non-responsive table, provide an extra column for that information. Name the column header Editing Status. The column should be placed after the key information in the table.

Locking - Tables
Locking - Tables

Object List Item and Object Header

In case an object is locked, set the property markLocked of the object list item to ‘true’ and use the status property of the  object header to show by whom the object is locked. Existing status properties should not be overwritten, rather use an additional status line to guarantee that no information gets lost.

Locked state in the object list item (master list - split-screen app) and object header (detail list - split-screen app; object view)
Locked state in the object list item (master list - split-screen app) and object header (detail list - split-screen app; object view)

Object Page Header

If an object is locked, set the MarkLocked property of the object page header to “true”.

Clicking the icon displays the locking information as responsive popover (on desktops).

Locked state of the object page header
Locked state of the object page header

Form Sections

In some cases, only sections of an object might be locked. In order to indicate that a section is locked, use a button in transparent style with the corresponding icon (icon name: private) and the text Locked by [name] next to the Edit button in the section toolbar. Clicking the button displays additional information about the locked status.

Locked state of a form section
Locked state of a form section

Resources

Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.

Elements and Controls

Implementation