Application Development and Automation 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: 
Read only

Triggering POPUP to SAVE when user Presses BACK Button

Former Member
0 Likes
1,979

h4.

Hi Friends,

h4.

When the User Presses BACK Button in the PF Status, it should trigger POPUP_TO_CONFIRM whether to SAVE or not.

h4.

Suppose if the user doesn't change any thing in the Screen, it should not ask the User.

h4.

How can i know whether the user changes something in the Screen.

h4.

Screen mean Table Control..

h4.

How can i track this.

h4.

Regards:.

h4.

Sridhar.J

1 ACCEPTED SOLUTION
Read only

aabhas_wilmar
Contributor
0 Likes
1,055

Hi Sridhar.

Two ways to know if data was changed:

1. Before displaying the popup, store the old value (that you are about to display) in a variable

When the user clicks back, check the new value in the screen field is same as old value or not. If not, display your popup to confirm SAVE.

2. Using the variable SY-DATAR which is set to 'X' after any key press. This is not much reliable... you may not want to ask for SAVE if the user changed the data but wrote it back, example: "ABAP" -> "ABA" -> "ABAP" the final value is still the same as previous value but SY-DATAR is set to X.

regards,

Aabhas...

Edited by: Aabhas K Vishnoi on Sep 24, 2009 2:56 PM

h4.

Hi Friends,

h4.

When the User Presses BACK Button in the PF Status, it should trigger POPUP_TO_CONFIRM whether to SAVE or not.

h4.

Suppose if the user doesn't change any thing in the Screen, it should not ask the User.

h4.

How can i know whether the user changes something in the Screen.

h4.

Screen mean Table Control..

h4.

How can i track this.

h4.

Regards:.

h4.

Sridhar.J

3 REPLIES 3
Read only

Former Member
0 Likes
1,055

Hi

If I rember the system variable SY-DATAR should be set to X if a value in a input field is changed

Max

Read only

aabhas_wilmar
Contributor
0 Likes
1,056

Hi Sridhar.

Two ways to know if data was changed:

1. Before displaying the popup, store the old value (that you are about to display) in a variable

When the user clicks back, check the new value in the screen field is same as old value or not. If not, display your popup to confirm SAVE.

2. Using the variable SY-DATAR which is set to 'X' after any key press. This is not much reliable... you may not want to ask for SAVE if the user changed the data but wrote it back, example: "ABAP" -> "ABA" -> "ABAP" the final value is still the same as previous value but SY-DATAR is set to X.

regards,

Aabhas...

Edited by: Aabhas K Vishnoi on Sep 24, 2009 2:56 PM

Read only

SureshRa
Active Participant
0 Likes
1,055

Hi Sridhar,

Within the table control loop, create a chain of all the fields in the structure of line type. call a PAI module with addition ON CHAIN-REQUEST. This is a conditional module call which will be triggered ONLY when user changes something on the screen. In this module you can set a global variable DATA_CHANGED to say 'X'. When user chooses BACK function, check this global variable to decide on the confirmation popup.

One small caution. If you have the ROW SELECTION field also included in the line type of your internal table associated with the table control, you need to exclude that from the CHAIN of fields above; otherwise even when user selects a line or de-selects, this module will be triggered.

Read ON CHAIN-REQUEST and ON REQUEST online ABAP help for more clarity.

Regards

Suresh

Edited by: Suresh Radhakrishnan on Sep 28, 2009 4:29 PM