When navigating from one custom component to other components or documents using Quick links or Navigation bar links we need to restrain user from accidentally deleting the unsaved data, to achieve this we prompt data loss popup, which requires user input to proceed further.
Below are the steps to create a data loss popup:
STEP 1: Create a method with the name ON_BEFORE_WA_CONTENT_CHANGE in window implementation class with following properties:
Level : Instance Method
Visibility: Protected
Visibility: Protected
STEP 2: Click on the method and click on Detail View button which is near
parameters and set the following settings by clicking on Event handler for
checkbox:
Class/Interface: CL_BSP_WD_VIEW_MANAGER
Event: BEFORE_WORKAREA_CONTENT_CHANGE
and save the settings.
Event: BEFORE_WORKAREA_CONTENT_CHANGE
and save the settings.
STEP 3: Set
the following settings for parameters:
Parameter: DATA_LOSS_HANDLER
Type: Importing
Typing Method: Type Ref To
Associated Type: IF_BSP_WD_DATA_LOSS_HANDLER
Parameter: DATA_LOSS_HANDLER
Type: Importing
Typing Method: Type Ref To
Associated Type: IF_BSP_WD_DATA_LOSS_HANDLER
STEP 4: Write the following code into the
above method:
|
SET HANDLER on_before_wa_content_change ACTIVATION abap_true.
STEP 6: Add interface IF_BSP_WD_EVENT_HANDLER in main your window. Implement the method IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT
|
And write
the logic in these cases and when yes or no button is pressed leaves current
component.
No comments:
Post a Comment