2008 Mar 19 3:39 AM
Hi,
I have a table control populated with data .
Suppose the user clicks on the back button at the top of the screen after changing some data in the table control , he should get a pop up message asking him whether he wants to cancel the data without saving.
If the user does not change any data in the table control , he should not get this pop-up message .
Please could someone help me out with this.
Regards,
Sushanth H.S.
2008 Mar 19 11:20 AM
Hi Arjun,
The problem with SY-DATAR is if we hit the enter key on the screen, SY-DATAR is getting cleared .
Please can you help me with this .
Regards,
Sushanth H.S.
2008 Mar 19 4:23 AM
Hi Sushant,
There is a better way of achieving this functionality.There is a system variable SY-DATAR.
If any value is changed in the screen it will have 'X'.Otherwise it will be initial.
Another option is copying the internal table for table control into another internal table in PBO.
Then at EXIT command compare ther two internal tables.
Thanks Arjun
Edited by: Arjun Puthuruthy on Mar 19, 2008 9:54 AM
2008 Mar 19 4:58 AM
Hi sushant,
check for the variable Sy-datar = 'X'.
then
case sy-ucomm.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
CALL FUNCTION 'POPUP_TO_DECIDE'
EXPORTING
defaultoption = '1'
textline1 = text-s05
TEXTLINE2 = ' '
TEXTLINE3 = ' '
text_option1 = text-s01
text_option2 = text-s02
ICON_TEXT_OPTION1 = ' '
ICON_TEXT_OPTION2 = ' '
titel = text-s06
start_column = 25
start_row = 6
cancel_display = 'X'
IMPORTING
answer = gv_answer
.
IF gv_answer = '1'.
PERFORM save_data.
ELSEIF
gv_answer = '2'.
PERFORM clear_screen.
LEAVE TO SCREEN 0.
ELSE.
SET SCREEN 200.
ENDIF.
endcase.
2008 Mar 19 11:20 AM
Hi Arjun,
The problem with SY-DATAR is if we hit the enter key on the screen, SY-DATAR is getting cleared .
Please can you help me with this .
Regards,
Sushanth H.S.
2008 Mar 19 12:10 PM
Sushanth,
SY-DATAR is to be used along with a flag.
In PAI set flag using SY-DATAR.
ie
if sy-datar is not initial.
flag = 1.
endif.
Now in
Module exit_command..
if sy-datar is initial and flag is initial.
...
else.
.....
endif
endmodule
Thanks Arjun