The below post describes how to display a data loss pop up screen, when CANCEL button is pressed without saving the data with the help of form uibb.
Step1- Create a class(feeder class) in Tx- SE24 and implement the shown interfaces.
Step2- Implement al the methods and make all active. Put some code in GET_DEFINITION & GET_DATA method as shown below.
Step3- Now create a configuration for the FORM uibb.
Step4- provide configuration name as – ZCC_FORM_SPFLI & click on new button.
Step5- Provide the feeder class name and continue.
Step6- Add some fields and make some fields as input field.
Step7- Rearranging the fields in preview section. Save the form configuration.
Step8- To create an OVP application. Go to Tx- FPM_WB and select the marked option.
Step9- Provide the application name, choose floor plan as overview Page and then click on Next button.
Step10- Save it.
Step11- Click on Edit Configuration(FLUID) option.
Step12- Provide a title & add a form component.
Step13- Provide the form UIBB configuration name. Now we have to add some buttons on the global toolbar of the application. So go too Toolbar Schema tab.
Step14- Select Global toolbar, click on create toolbar Element. Add Save & Cancel button.
Step15- Again add a Button.
Step16- Provide the button text as- Other & Event Id as- OTHER. Save it.
Step18- Execute the application.
Step19- so here we have the form is displayed. Now the task is if some data are changed in the input field(s) and CANCEL button is clicked before SAVE then a data loss pop up should be displayed.
Go back to the feeder class & add the new interface- IF_FPM_GUIBB_FORM_EXT
Create two attributes as shown.
Go to the flush method.
FLUSH method provides parameters which says if the some field data is changed or not. IT_CHANGE_LOG stores the fields changed value. Put the below code.
So if any field is changed GV_CHANGED is set to true.
Go to the NEEDS_CONFIRMATION method.
Put the below code here. Here we check the data is being changed & also CANCEL button is pressed.
Test the application.
Change the field value[ for test field- depart. City – value being changed] and click on cancel button. So here we have the data loss POP UP.