I am badly stuck , I have a form that contain 2 button, one is edit and the other is exit, when I press edit button and input apartment no (its akey field) then system read data and fill the screen and if i change some data and press exit button then system show me a dialog box data has been changed by using ask_save builten function and when i press yes then system leave the screen and cannot save my current data means updated data, please advice
MODULE exit_0100 INPUT. CASE ok_code. WHEN 'EXIT'. IF sy-datar IS INITIAL AND flag IS INITIAL. * no changes on screen 100 LEAVE PROGRAM. * MOVE-CORRESPONDING ZUT_APARTMENT TO ls_newapartment. ELSE. * ls_newapartment = ZUT_APARTMENT. * MOVE-CORRESPONDING ZUT_APARTMENT TO ls_newapartment. * IF ls_newapartment NE ls_oldapartment. * PERFORM check_for_updation_100. MOVE-CORRESPONDING zut_apartment TO ls_newapartment. IF ls_newapartment NE ls_oldapartment. PERFORM ask_save_0100 USING answer. CASE answer. WHEN 'J'. ok_code = 'SAVE&EXIT'. WHEN 'N'. LEAVE PROGRAM. WHEN 'A'. CLEAR ok_code. SET SCREEN 100. ENDCASE. ENDIF. LEAVE PROGRAM. ENDIF.