Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if data has been changed in a table control?

Former Member
0 Kudos
1,994

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
386

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.

4 REPLIES 4

Former Member
0 Kudos
386

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

Former Member
0 Kudos
386

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.

Former Member
0 Kudos
387

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.

0 Kudos
386

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