Draft in SAP Fiori Elements
Projection of Draft-Handling
RAP draft handling can be reused with the syntax element use draft. As a prerequisite, the underlying RAP BO must be draft-enabled. The draft tables and the total ETag field are implementation details that are automatically reused and do not have to be explicitly specified.
Draft actions are reused implicitly, but it is recommended that they are listed explicitly, using the syntax element use action.
Editing a Draft Instance
When you edit data in a draft enabled SAP Fiori elements application, the framework will save the user entries in a draft instance - even if the data is inconsistent or incomplete.
The application indicates this at the bottom of the Object Page, next to the Save and Cancel buttons.
When the user chooses Save, the framework checks if the draft is consistent (determine action PREPARE) and, if it is, copy the draft to the active data (action ACTIVATE).
When the user chooses Cancel, the framework will discard the draft instance (action DISCARD).
When the user navigates back, closes the application, or in the case of any failure, the draft will remain and the user can pick up editing any time.
Visualization of Existing Drafts
On the list, a Draft link below the text field of a node indicates that this entry is a draft instance. Choosing the link displays a dialog window with administrative data of the draft.
Draft-specific Filter Field
A draft enabled SAP Fiori app displays an additional filter field, Editing Status, by which the user can select draft instances or active, unchanged instances, only.
Validations During Prepare
Draft Determine Action PREPARE
All validations, and the determinations defined as on save, are automatically evaluated during the save phase. This means that, just before the active data from the application buffer is written to the persistent database table, those validations and determinations are executed, for which the trigger conditions are fulfilled.
A developer can allow the RAP BO consumer to execute determinations and validations on request by defining a determine action and assigning determinations and validations to it.
Then, the validations and determinations assigned to the determine action are already evaluated whenever the determine action is executed.
The purpose of the implicitly defined draft determine action PREPARE is to validate draft data not only when they are persisted on the database but already before the transition to active data. It is implicitly executed by draft action ACTIVATE.
Like all other draft actions, PREPARE is implicitly enabled as soon as the business object is draft enabled, but, in this case, no determinations and validations are assigned to it. The assignment of determinations and validations must be done explicitly in the behavior definition. To assign validations and determinations, add a pair of curly brackets after the action name and list the validations and determinations there.
The following restrictions apply:
Transition Messages and State Messages
State Messages and Transition Messages
RAP distinguishes Transition Messages and State Messages. While transition messages refer to a triggered request, state messages refer to a business object instance and its values.