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

Track Changes to Custom Screen fields on Exit command

Former Member
0 Likes
1,358

Hi all,

I want to track the changes in my screen fields, if it is already updated in the database table, when user selects any exit command it should not give any pop up message(allowing them to go back). If not i need to give a pop up message, giving the user an option to save before exit.

Thanks a bunch.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,199

Rob,

If you understand my question, could you explain how can i use sy-datar.

Seshu,

That way is too long to reach my answer, which will lead to ambiguous state for others.

I guess we can use SCU3 and AUT10 for data log changes. Could any one of you explain how can i use. I am not familiar with that piece.

Warm regards

8 REPLIES 8
Read only

Former Member
0 Likes
1,199

clear flag.

Check the screen fields value with respect to database.

if sy-subrc eq 0.

flag = 'X'

endif.

when 'EXIT'.

if flag = 'X'.

leave to screen 0.

else.

give pop up message

leave to screen current screen.

endif.

Do not use at exit command ,if you use will not get output as you expected

Thanks

Seshu

Read only

Former Member
0 Likes
1,199

I think you can check sy-datar to see if the screen has changed.

So long as the command you are using to exit is defined as an exit-command, you can use an exit module.

Rob

Message was edited by:

Rob Burbank

Read only

Former Member
0 Likes
1,200

Rob,

If you understand my question, could you explain how can i use sy-datar.

Seshu,

That way is too long to reach my answer, which will lead to ambiguous state for others.

I guess we can use SCU3 and AUT10 for data log changes. Could any one of you explain how can i use. I am not familiar with that piece.

Warm regards

Read only

0 Likes
1,199

Like this:


*&---------------------------------------------------------------------*
*&      Module  EXIT_100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module exit_0100 input.

  data: answer.

  case ok_code.

    when 'CAN'.
      if not sy-datar is initial.
        call function 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
             exporting
                  titel     = 'Exit Editing'
                  textline1 = 'Do you want to exit editing?'
             importing
                  answer    = answer.
        if answer = 'J'.
          leave program.
        endif.
      else.
        leave program.
      endif.

    when '%EX'.
      if not sy-datar is initial.
        call function 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
             exporting
                  titel     = 'Exit Editing'
                  textline1 = 'Do you want to exit editing?'
             importing
                  answer    = answer.
        if answer = 'J'.
          leave program.
        endif.
      else.
        leave program.
      endif.

    when 'CLEAR'.
      perform clear_screen.
      leave to screen '0100'.

    when 'HELP'.
      perform action_help.

  endcase.

endmodule.                 " EXIT_100  INPUT

Rob

Read only

0 Likes
1,199

Do you have a table control in the screen? I'm not sure if sy-datar can keep track of changes in a table control.

Rob

Read only

0 Likes
1,199

yes, I have table control in my screen...........but let me check

Read only

Former Member
0 Likes
1,199

Thanks Rob,

I got it done, it is working for table control also. Thanks a lot.

Read only

0 Likes
1,199

Good - glad to help.

Rob